[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
RE: [xml-dev] XPath search problem
- From: "Laurens van den Oever" <laurens@xopus.com>
- To: "Marshall, Steven \(SKM\)" <SMarshall@skm.com.au>, <xml-dev@lists.xml.org>
- Date: Mon, 11 Feb 2008 10:58:40 +0100
Steven,
The codelistItem, CodeListDictionary and codeEntry elements are in the
http://www.isotc211.org/2005/gmx namespace, but you search for elements
with those names in the default namespace (you didn't provide a prefix
in your xpath).
If you declare a prefix (gmx) for that namespace you can change your
xpath to:
//gmx:codelistItem/gmx:CodeListDictionary[@gml:id='LanguageCode']/
gmx:codeEntry
Best regards,
Laurens van den Oever
Xopus Company
http://xopus.com
-----Original Message-----
From: Marshall, Steven (SKM) [mailto:SMarshall@skm.com.au]
Sent: maandag 11 februari 2008 9:36
To: xml-dev@lists.xml.org
Subject: [xml-dev] XPath search problem
I'm having a problem getting a .NET XMLDocument to give me back the set
of nodes I want. The relevant code looks like this:
Dim nl as XMLNodelist
Dim nsm as XMLNamespaceManager
nl=xDoc.SelectNodes("//codelistItem/CodeListDictionary[@gml:id='Language
Code']/codeEntry", nsm)
I have created the NamespaceManager and added to it every namespace
mentioned in the XML document. The SelectNodes always returns an empty
nodelist, unless I reduce it to a trivial Xpath expression like "//*",
which is not much use. If I use this exact same Xpath expression in
Altova XMLSpy, it works perfectly and gives me the exact set of nodes I
want. I'm almost sure that it is the multiple namespaces that are
somehow getting in the way here, but I can't see what's happening. Here
is the first part of the XML document - sorry about the formatting.
There definitely is a <CodeListDictionary> element further down that has
a gml:id='LanguageCode'. Anyone know what's happening here?
<?xml version="1.0" encoding="UTF-8"?>
<CT_CodelistCatalogue xmlns="http://www.isotc211.org/2005/gmx"
xmlns:gco="http://www.isotc211.org/2005/gco"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.isotc211.org/2005/gmx ../gmx/gmx.xsd
http://www.isotc211.org/2005/gco ../gco/gco.xsd
http://www.opengis.net/gml ../gml/gml.xsd http://www.w3.org/1999/xlink
../xlink/xlinks.xsd">
<!--=====Catalogue description=====-->
<name>
<gco:CharacterString>ADO_Codelists</gco:CharacterString>
</name>
<scope>
<gco:CharacterString>Codelists for description of metadata datasets
compliant with ADO_DM_MDP Version 1.0.2</gco:CharacterString>
</scope>
<fieldOfApplication>
<gco:CharacterString>GMX (and imported)
namespace</gco:CharacterString>
</fieldOfApplication>
<versionNumber>
<gco:CharacterString>0.1</gco:CharacterString>
</versionNumber>
<versionDate>
<gco:Date>2007-03-01</gco:Date>
</versionDate>
<!--============================= Codelists
=======================================-->
<!--=== DP_DateTypeCode ===-->
<codelistItem>
<CodeListDictionary gml:id="DP_DateTypeCode">
<gml:description>identification of when a given event
occurred</gml:description>
<gml:identifier
codeSpace="ISOTC211/19115">DP_DateTypeCode</gml:identifier>
<codeEntry>
<CodeDefinition gml:id="DP_DateTypeCode_creation">
<gml:description>date identifies when the resource was brought
into existence</gml:description>
<gml:identifier codeSpace="ADO_DM_MDP">creation</gml:identifier>
</CodeDefinition>
</codeEntry>
<codeEntry>
<CodeDefinition gml:id="DP_DateTypeCode_publication">
<gml:description>date identifies when the resource was
issued</gml:description>
<gml:identifier
codeSpace="ADO_DM_MDP">publication</gml:identifier>
</CodeDefinition>
</codeEntry>
<codeEntry>
<CodeDefinition gml:id="DP_DateTypeCode_revision">
<gml:description>date identifies when the resource was examined
or re-examined and imporved or amended</gml:description>
<gml:identifier codeSpace="ADO_DM_MDP">revision</gml:identifier>
</CodeDefinition>
.....and so on
SKM is committed to working with its clients to deliver a sustainable
future for all. Please consider the environment before printing this
e-mail.
Notice - This message contains confidential information intended only
for the exclusive use of the addressee named above. No confidentiality
is waived or lost by any mistaken transmission to you. If you have
received this message in error please delete the document and notify us
immediately.
Any opinion, text, documentation or attachment received is valid as at
the date of issue only. The recipient is responsible for reviewing the
status of the transferred information and should advise us immediately
upon receipt of any discrepancy.
All email sent to SKM will be intercepted, screened and filtered by SKM
or its approved Service Providers.
_______________________________________________________________________
XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.
[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]