Dear all,

I got a problem when extracting data from XML using NSXML and XPath. When
doing the same thing using Java, it works fine. But using NSXML and XPath,
the result is different.

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.

    NSError *err = nil;
    NSArray *nodes = [xmlDoc nodesForXPath:@"/addresses/road" error:&err];
    for (int i = 0; i < [nodes count]; i ++)
    {
         NSLog(@"%@", [nodes objectAtIndex:i]);
    }

But the result is as follows, not "Orange ST".

    <road>Orange ST</road>

Thanks so much!
Bing
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to