Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jaxp namespaces in document elements

843834Nov 24 2009 — edited Nov 27 2009
I am trying to use Java to access xml items using XPath.
I am OK with an xml document with name spaces in root element.
But not namespaces declared in elements.

Typically see two documents at
http://www.w3schools.com/XML/xml_namespaces.asp
Under
XML Namespaces - The xmlns Attribute
Quote "Namespaces can be declared in the elements where they are used or in the XML root element:"


My Xpath is "/root/h:table/h:tr/h:td"

This works OK for second document with namespaces in root element.
But not the first document with namespaces in the elements.

I have tried using lookupNamespaceURI but this only seems to process root element.
It's hair pulling time!
Any Ideas
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2009
Added on Nov 24 2009
16 comments
423 views