Query for value where a default namespace node exists
Posted
by Jay
on Stack Overflow
See other posts from Stack Overflow
or by Jay
Published on 2010-05-14T15:57:36Z
Indexed on
2010/05/14
16:54 UTC
Read the original article
Hit count: 253
I have the following XML that is provided to me and I cannot change it:
<Parent>
<Settings Version="1234" xmlns="urn:schemas-stuff-com"/>
</Parent>
I am trying to retrieve the "Version" attribute value using XPath. It appears since the xmlns is defined without an alias it automatically assigns that xmlns to the Settings node. When I read this XML into an XMLDocument and view the namespaceURI value for the Settings node it is set to "urn:schemas-stuff-com".
I have tried:
//Parent/Settings/@Version - returns Null
//Parent/urn:schemas-stuff-com:Settings/@Version - invalid syntax
© Stack Overflow or respective owner