XML DOM
XML DOM Contents
Summary How to select specific nodes in XmlDocument() when having a namespace in the XML?
You can not simple use the SelectNodes or SelectSingleNode function to retrieve specific nodes if you have a namespace in your XML file. If you still do, you will get the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
To get rid of that still get the nodes, you will have to use the XmlNameSpaceManager and add the namespace to the XmlDocument object. In this example you will see how you can achieve that. I am using the following XML file for the example. Note the namespace at the beginning of the file.
Output:
VC++
Partners
Dream.In.Code dotNet Slackers dotNet Spider Your HTML Source VisualBuilder.com DevGuru Planet Source Code ZVON.ORG Web Design ASPAlliance XML Pitstop Scripts
The Spot 4 SAP Bitshop Web Hosting