Xpath not working but BaseX map view works fine (Issue or beginner question?)
Friday, 17 May 2013 · 2 messages
O
Oliver17 May 2013 15:41 #
Just importing the following XML fragment into a new database. It is not queriable for some reason.
The following do not return anything:
//representedOrganization
db:open("item","item.xml")/document
db:open("item","item.xml")/document/author/assignedEntity/representedOrganization
----- item.xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet
href="http://www.fda.gov/oc/datacouncil/stylesheets/spl/spl.xsl"
type="text/xsl"?>
<document xmlns:voc="http://www.hl7.org/v3/voc" xmlns="urn:hl7-org:v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hl7-org:v3
http://www.fda.gov/oc/datacouncil/schemas/spl/spl.xsd">
<id root="ABD6ECF0-DC8E-41DE-89F2-1E36ED9D6535"/>
<code code="34391-3" codeSystem="2.16.840.1.113883.6.1"
codeSystemName="LOINC" displayName="HUMAN PRESCRIPTION DRUG LABELING"/>
<title mediaType="text/x-hl7-title+xml">RENESE<sup>®</sup>
<br/>
<br/>(polythiazide)<br/>
<br/>TABLETS<br/>
<br/>for Oral Administration</title>
<effectiveTime value="20051214"/>
<setId root="ABD6ECF0-DC8E-41DE-89F2-1E36ED9D6535"/>
<versionNumber value="1"/>
<author>
<time/>
<assignedEntity>
<representedOrganization>
<name>Pfizer Labs</name>
</representedOrganization>
</assignedEntity>
</author>
</document>JE
Jens Erat17 May 2013 15:46 #
Hi Oliver,
your document includes namespaces which you will have to declare for accessing these items.
declare namespace h17 = "urn:hl7-org:v3";
db:open("item","item.xml")/h17:document
db:open("item","item.xml")/h17:document/h17:author/h17:assignedEntity/h17:representedOrganizationAlternatively, you can declare the default namespace and use the queries you've got:
declare default element namespace "urn:hl7-org:v3";Kind regards from Lake Constance, Germany,
Jens
--
Jens Erat
[phone]: tel:+49-151-56961126
[mail]: mailto:email at jenserat.de
[jabber]: xmpp:jabber at jenserat.de
[web]: http://www.jenserat.de
PGP: 350E D9B6 9ADC 2DED F5F2 8549 CBC2 613C D745 722B
Quoted text · Oliver · 37 lines
Am 17.05.2013 um 15:41 schrieb Oliver <oliver at corabojahr.de>: > Just importing the following XML fragment into a new database. It is not queriable for some reason. > > The following do not return anything: > //representedOrganization > db:open("item","item.xml")/document > db:open("item","item.xml")/document/author/assignedEntity/representedOrganization > > > ----- item.xml > <?xml version="1.0" encoding="utf-8"?> > <?xml-stylesheet href="http://www.fda.gov/oc/datacouncil/stylesheets/spl/spl.xsl" type="text/xsl"?> > <document xmlns:voc="http://www.hl7.org/v3/voc" xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://www.fda.gov/oc/datacouncil/schemas/spl/spl.xsd"> > <id root="ABD6ECF0-DC8E-41DE-89F2-1E36ED9D6535"/> > <code code="34391-3" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="HUMAN PRESCRIPTION DRUG LABELING"/> > <title mediaType="text/x-hl7-title+xml">RENESE<sup>®</sup> > <br/> > <br/>(polythiazide)<br/> > <br/>TABLETS<br/> > <br/>for Oral Administration</title> > <effectiveTime value="20051214"/> > <setId root="ABD6ECF0-DC8E-41DE-89F2-1E36ED9D6535"/> > <versionNumber value="1"/> > <author> > <time/> > <assignedEntity> > <representedOrganization> > <name>Pfizer Labs</name> > </representedOrganization> > </assignedEntity> > </author> > </document> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery