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!

probs using getElementsByTagNameNS

843834May 12 2005 — edited May 14 2005
Hi,
i have an xml doc with a namespace declared and am trying to retrieve information from an element that falls under this namespace. here are some of the relevant details of the code

String docNS = "urn:hl7-org:v3";
....
NodeList resultVals = doc.getElementsByTagNameNS(docNS,"receiver");
System.out.println(resultVals.getLength());

and heres the relevant parts of the doc i am trying to retrieve info from

<?xml version='1.0' encoding='ISO-8859-1'?>
<Message xmlns='urn:hl7-org:v3'>
....
<receiver>
<device determinerCode='INSTANCE'>
<id extension='xxx' root='xxxxx'/>
</device>"
</receiver>
....
</Message>

i have checked the the doc is parsed etc ok but this program always prints out the value "0" indicating that it didnt find any elements from the given namespace with the local name of "receiver". i have tried different variations of this for a couple of days now but still can't get it to work!! any helps greatly appreciated,
regards,
jeremy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2005
Added on May 12 2005
1 comment
215 views