• 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: A Simple NSXML XPath Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Simple NSXML XPath Problem


  • Subject: Re: A Simple NSXML XPath Problem
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Sat, 28 May 2011 21:55:14 -0500

On Sat, May 28, 2011 at 9:40 PM, Bing Li <email@hidden> wrote:
> The XML is pretty simple.
>
>    <?xml version="1.0" encoding="UTF-8"?>
>    <addresses>
>        <road>Orange ST</road>
>        <apt>RM235</apt>
>    </addresses>
>
> The following code is use to extract the value of the road, "Orange ST". In
> Java, the XPath is the same, i.e., /addresses/road.

You're selecting the <road> node which happens to contain a text node
with the value you want. That Java and Cocoa return different strings
when asked isn't a bug because what a toString()/description returns
isn't in a spec.

If you want the text node, you should be selecting:

/addresses/road/text()
_______________________________________________

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

References: 
 >A Simple NSXML XPath Problem (From: Bing Li <email@hidden>)

  • Prev by Date: A Simple NSXML XPath Problem
  • Next by Date: UIColor vs. NSColor methods
  • Previous by thread: A Simple NSXML XPath Problem
  • Next by thread: UIColor vs. NSColor methods
  • Index(es):
    • Date
    • Thread