probs using getElementsByTagNameNS
843834May 12 2005 — edited May 14 2005Hi,
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