[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XPath search problem

  • From: "Laurens van den Oever" <laurens@x...>
  • To: "Marshall, Steven \(SKM\)" <SMarshall@s...>, <xml-dev@l...>
  • Date: Mon, 11 Feb 2008 10:58:40 +0100

RE:  XPath search problem
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@s...] 
Sent: maandag 11 februari 2008 9:36
To: xml-dev@l...
Subject:  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@l...
subscribe: xml-dev-subscribe@l...
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.