Hi All
I'm having a problem navigating through an XML document using XPath. I've never done this before, so I'm sure the answer is fairly obvious
I am using the following code to navigate to a particular node in an xml document (VB.NET):
Dim doc As XmlDocument = New XmlDocument()
doc.Load("doc.xml"
Dim nd As XmlNode
Dim rt As XmlElement = doc.DocumentElement
nd = rt.SelectSingleNode("descendant:
age[@PageName='default.aspx']"
'output text to the page, to check it is working
Label1.Text = nd.OuterXml()
This works perfectly, as long as there is no XSD document associated with my xml document. eg If I have the following lines at the top of my xml document, it doesn't work:
<?xml version="1.0" encoding="utf-8"?>
<PageList xmlns="....
However, if I have:
<?xml version="1.0" encoding="utf-8"?>
<PageList>
...
It does work!!
Please could somebody tell me why this is so and what I should be doing instead.
Thanks
I'm having a problem navigating through an XML document using XPath. I've never done this before, so I'm sure the answer is fairly obvious
I am using the following code to navigate to a particular node in an xml document (VB.NET):
Dim doc As XmlDocument = New XmlDocument()
doc.Load("doc.xml"
Dim nd As XmlNode
Dim rt As XmlElement = doc.DocumentElement
nd = rt.SelectSingleNode("descendant:
'output text to the page, to check it is working
Label1.Text = nd.OuterXml()
This works perfectly, as long as there is no XSD document associated with my xml document. eg If I have the following lines at the top of my xml document, it doesn't work:
<?xml version="1.0" encoding="utf-8"?>
<PageList xmlns="....
However, if I have:
<?xml version="1.0" encoding="utf-8"?>
<PageList>
...
It does work!!
Please could somebody tell me why this is so and what I should be doing instead.
Thanks