GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes xpath question for reading attribute value namespace-unaware Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xpath question for reading attribute value namespace-unaware" Watch "xpath question for reading attribute value namespace-unaware" New topic
Author

xpath question for reading attribute value namespace-unaware

manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308
hi i want to read an attribute value ignoring bound namespace (namespace declarations are omitted in following):

<xml bla="asdf"/>
<xml ns1:bla="asdf"/>

the retrieval i am doing with xpath.

i tried //*[@attributeName] but this would only work with the unqualified (<xml bla="asdf"/>) version. is there a wildcard version which ignores the namespace prefix of the attribute?
i do not want to use the local-name() function for i don't know the element the attribute is contained in.

thanks for your help!


aldana software engineering blog & .more
manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308
a colleague was quicker than you ;)

//*/@*[local-name()='bla'] made the trick
 
Don't get me started about those stupid light bulbs.
 
subject: xpath question for reading attribute value namespace-unaware