Solved

XML Namespaces and SelectNodes

Posted on 2004-09-09
4
665 Views
Last Modified: 2013-11-19
I have an XML file with the line:

 <REQUEST_GROUP MISMOVersionID="2.3.1" _ID="XSLT120" xmlns="http://www.MISMO.org/schema/Envelope_2_3_1">

When I try to do a SelectSingleNode method to that node, i get a null refrence

When I modify that line to

 <REQUEST_GROUP MISMOVersionID="2.3.1" _ID="XSLT120">

it selects just fine.

What does SelectSingleNode have to do with namespacing?
0
Comment
Question by:Siberwulf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
Javert93 earned 500 total points
ID: 12021851
XML namespaces allow you to logically seperate nodes with the same name into different "areas" or "namespaces." When you don't specify a namespace, the node is placed in a global namespace, which was where SelectSingleNode looks if you don't provide an XmlNamespaceManager for the second parameter. Since you were defining the node to be in the http://www.MISMO.org/schema/Envelope_2_3_1 namespace (which removed it from the default namespace).
0
 

Author Comment

by:Siberwulf
ID: 12021966
Ok, I see how that works.

Now, it is having me look in the namespace each time i try to acess a node inside.  

I end up wiht something like this:

"//mismo:REQUEST_GROUP/mismo:REQUEST/mismo:REQUEST_DATA"


Is there any way to not have it need those extra namespace tags?
0
 
LVL 4

Expert Comment

by:Javert93
ID: 12022015
Not unless you don't define a namespace for the nodes. Otherwise, the namespace is required.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question