I have an XML document that looks like:
The xmlns="http:something" is correct; there is no prefix.
Using XPath wildcards, can get all nodes returned. Using XPath expressions relating to nodes below the <another element> node, eg "//other elements" returns nothing. Removing the xmlns clauses causes the XPath query to work. I cannot change the document structure.
I want to use xmlDoc.SelectSingleNode("xpath query") or xmlDoc.SelectNodes("xpath query"). How can I create an XPath query that will ignore (or cope with) this 'anonymous' namespace?
Thanks for any help.
Code:
<?xml version="1.0" encoding="utf-8"?>
<root element>
[tab]<next element>
[tab][tab]<another element xmlns:xsd="http:something" xmlns:xs="http:somthing" xmlns="http:something">
[tab][tab][tab]<other elements />
[tab][tab][tab]<other elements />
[tab][tab][tab]<other elements />
[tab][tab][tab]....
[tab][tab]</another element>
[tab]</next element>
</root element>
Using XPath wildcards, can get all nodes returned. Using XPath expressions relating to nodes below the <another element> node, eg "//other elements" returns nothing. Removing the xmlns clauses causes the XPath query to work. I cannot change the document structure.
I want to use xmlDoc.SelectSingleNode("xpath query") or xmlDoc.SelectNodes("xpath query"). How can I create an XPath query that will ignore (or cope with) this 'anonymous' namespace?
Thanks for any help.