This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
wood burning stoves
 
subject: xpath question for reading attribute value namespace-unaware
 
Similar Threads
Using XPath to retrieve attribute values?
XSL Generating HTML
Javascript parser
Simple yet perplexing XSLT question
Facing problem with JAXB1.0