[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
The elements are not bound to any namespace prefix - as you can see from the example, so a default namespace of null or "" is used. The namespace "urn:hl7-org:v3" has no prefix, so the sub elements do not need the prefix, how to I access such elements in code??
Subject: RE: [xsl] How to select nodes with explicitly set default namespace - DOM4J
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 23 Mar 2005 15:54:31 -0000
RE: [xsl] How to select nodes with explicitly set default namespace - DOM4J
Subject: RE: [xsl] How to select nodes with explicitly set default namespace - DOM4J From: "Barbara Worwood" <bworwood@xxxxxxxxxxxxx> Date: Thu, 24 Mar 2005 09:46:32 -0000 |
The elements are not bound to any namespace prefix - as you can see from the example, so a default namespace of null or "" is used. The namespace "urn:hl7-org:v3" has no prefix, so the sub elements do not need the prefix, how to I access such elements in code??
<PRSC_IN080000UK06 xmlns="urn:hl7-org:v3" <device> <id root="2.16.840.1.113883.2.1.3.2.4.10" extension="RJR-0000217" /> </device> </PRSC_IN080000UK06>
Subject: RE: [xsl] How to select nodes with explicitly set default namespace - DOM4J
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 23 Mar 2005 15:54:31 -0000
In XPath 1.0, if you want to select an element that's in a namespace, you need to bind a prefix to that namespace and use a prefixed QName in the path expression. The fact that the namespace is the default namespace in the source document makes no difference.
Michael Kay http://www.saxonica.com/
-----Original Message----- From: Barbara Worwood [mailto:bworwood@xxxxxxxxxxxxx] Sent: 23 March 2005 15:26 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] How to select nodes with explicitly set default namespace - DOM4J
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/200 1/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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] A few problems with XSL:F, Sven Waibel | Thread | RE: [xsl] How to select nodes with , Michael Kay |
Re: [xsl] A few problems with XSL:F, Sven Waibel | Date | RE: [xsl] How to select nodes with , omprakash . v |
Month |