Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


XML 101

Selecting nodes from a default namespace with msmxl Dom by DrHeadgear
Posted: 1 Nov 01

Does your XML document have a default namespace? Do your selectNodes and selectSingleNode methods on your DOMDocument draw a blank?

Try this:

objDom.setProperty "SelectionNamespaces", "xmlns:newPrefix='myCurrentDefaultNamespace'"


What happens is that the dom object, being namespace aware, knows your nodes belong to your default namespace. But as you haven't declared that this namespace applies to nodes with a certain prefix you have no way of specifying which namespace the nodes you wish to select belong to. If you just use the node name in your selection then you will draw a blank; the dom object will assume you are asking for nodes with NO namespace.

The setProperty method allows you to assign a temporary prefix for the namespace and use it in your selection queries.

For more information about WHY these methods don't seem to work when there is a default namespace see JJR's FAQ: How to match nodes if there's a default namespace in the xml.

Back to XML FAQ Index
Back to XML Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close