File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xpath question for reading attribute value namespace-unaware

 
manuel aldana
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
manuel aldana
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a colleague was quicker than you ;)

//*/@*[local-name()='bla'] made the trick
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic