• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSXMLElement & Xpath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLElement & Xpath


  • Subject: Re: NSXMLElement & Xpath
  • From: Alastair Houghton <email@hidden>
  • Date: Thu, 6 Dec 2007 10:41:31 +0000

On 6 Dec 2007, at 00:26, Alexander Griekspoor wrote:

I bet a trivial question for experts but I couldn't find an answer nevertheless. Given the following NSXML fragment:

<author>
<name>G. G. Kacprzak</name>
<arxiv:affiliation xmlns:arxiv="http://arxiv.org/schemas/ atom">NMSU</arxiv:affiliation>
</author>


With the XPath query: /author[1]/name[1] I correctly get the name element
With the XPath query: /author[1]/arxiv:affiliation[1] I expect to get the arxiv:affiliation element


However, the latter won't work, even though if I ask the rootelement for its 2nd child and ask for its XPath, I do get /author[1]/ arxiv:affiliation[1] !!

The latter is a bug; that XPath would only work if the XPath engine was mapping the prefix arxiv to the URN http://arxiv.org/schemas/atom, which it clearly isn't. Some XPath implementations provide functions to define prefixes; I'm not sure that Cocoa's implementation does though... I can't see any obvious way to do that.


Try something like

  /author[1]/{http://arxiv.org/schemas/atom}affiliation[1]

instead.

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSXMLElement & Xpath
      • From: Alexander Griekspoor <email@hidden>
References: 
 >NSXMLElement & Xpath (From: Alexander Griekspoor <email@hidden>)

  • Prev by Date: Re: Immediate sending of changes to text fields
  • Next by Date: Re: Enabling Caching in Web-kit based cocoa application
  • Previous by thread: Re: NSXMLElement & Xpath
  • Next by thread: Re: NSXMLElement & Xpath
  • Index(es):
    • Date
    • Thread