NamespaceContext and using namespaces with XPath

Posted by Jherico on Stack Overflow See other posts from Stack Overflow or by Jherico
Published on 2009-05-27T04:57:04Z Indexed on 2010/05/14 5:54 UTC
Read the original article Hit count: 263

Filed under:
|
|

Resolving an xpath that includes namepsaces in Java appears to require the use of a NamespaceContext object, mapping prefixes to namespace urls and vice versa. But I can find no mechanism for getting a NamespaceContext other than implementing it myself. This seems counter-intuitive. Is there any easy way to acquire a NamespaceContext from a document, or to create one, or failing that, to forgo prefixes altogether and specify the xpath with fully qualified names?

© Stack Overflow or respective owner

Related posts about java

Related posts about xpath