Re: A Simple NSXML XPath Problem
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