From: "David Hooker" <[EMAIL PROTECTED]>
> Isn't there a dom4j API call to get the namespace URI's from the XML
> file and bind them into your xpath expression?

Kind of, though a document can redefine prefixes <-> URI mappings throughout
the document, so you need to pick a node and get the namespaces available
there.

By default dom4j with inherit any namespace prefixes -> URIs that are
available in the source node on which XPaths occur. e.g. if you parsed this
document

<foo:root
    xmlns:foo="http://www.foo.com/123";
    xmlns:bar="http://somewhere.com/bar";>
    <bar:one>
        <bar:two>hello!</bar:two>
    </bar:one>
</foo:root>

Then the following XPath expression on the document (or
document.getRootElement()) should work fine...

foo:root/bar:one/bar:two

James


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to