Hi,
I am having a problem selecting nodes that are part of a default namespace.
The xml format cannot be modified as it is part of an NHS UK standard.
For Example: xmlns=="urn:hl7-org:v3" is the default namespace, though a
call to selectSingleNode from the root element will not return anything for
me. See code below...
=======================================================================
=======================================================================
<?xml version="1.0" encoding="UTF-8" ?>
<!-- The element below is the content of the first payload container -->
<PRSC_IN080000UK06 xmlns="urn:hl7-org:v3"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:voc="urn:hl7-org:v3/voc"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hl7-org:v3../Schemas/PRSC_IN080000UK06.xsd">
<id root="A6C66142-1DD1-11B2-9062-8F5E91AA2DD7"/>
<creationTime value="20040913030014" />
<versionCode code="V3NPfIT2.0" />
<interactionId root="2.16.840.1.113883.2.1.3.2.4.12"
extension="PRSC_IN080000UK06" />
<processingCode code="P" />
<processingModeCode code="T" />
<acceptAckCode code="NE" />
<communicationFunctionRcv>
<device>
<id root="2.16.840.1.113883.2.1.3.2.4.10" extension="RJR-0000217" />
</device>
</communicationFunctionRcv>
<communicationFunctionSnd>
<device>
<id root="2.16.840.1.113883.2.1.3.2.4.10" extension="T141A-0000202" />
</device>
</communicationFunctionSnd>
<ControlActEvent>
<subject>
<RequestAvailableSlots classCode="SPLY" moodCode="RQO">
<id root="A6C66142-1DD1-11B2-9062-8F5E91AA2DD7" />
<effectiveTime>
<low value="200411090000" inclusive="true" />
<high value="200412100000" inclusive="false" />
</effectiveTime>
<location typeCode="LOC">
<clinic classCode="SDLOC">
<id root="2.16.840.1.113883.2.1.3.2.4.2" extension="DAVID"
displayable="true" />
</clinic>
</location>
</RequestAvailableSlots>
</subject>
</ControlActEvent>
</PRSC_IN080000UK06>
=======================================================================
=======================================================================
/* Code */
InputStream is =
CabCfg.class.getClassLoader().getResourceAsStream("testdoc.xml"); //
testdoc.xml is doc above
Document doc = new SAXReader().read(is);
Element el = doc.getRootElement();
el.add(new Namespace("", "urn:hl7-org:v3"));
Element interIdEl = (Element)(el.selectSingleNode("//interactionId"));
=======================================================================
=======================================================================
interIdEl returns null.
Any help with this would be greatly appreciated!
Thanks,
Barbara
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--