Re: XML XPath question
Re: XML XPath question
- Subject: Re: XML XPath question
- From: Chris Patterson <email@hidden>
- Date: Wed, 1 Oct 2008 12:47:44 -0400
I am trying to retrieve some specific data from a XML document.
<data>
<department>
<employe id="1">
<name>abcd</name>
</employe>
<employe id="2">
<name>efrh</name>
</employe>
<employe id="3">
<name>ijkl</name>
</employe>
<employe id="4">
<name>mnop</name>
</employe>
</department>
</data>
so I'm trying to query the XML document with the following XPath
string.
[... stringWithFormat:@".//data/department/employe[id=\"%@\"]",
[employeID stringValue]]
this returns no objects.
Your XPath is almost correct, as far as I can tell. All you need to do
is insert an "@" character before the "id" attribute predicate, like so:
".//data/department/employe[@id=\"%@\"]"
================================================================
Chris Patterson chris dot s dot patterson at gmail dot com
"The only problem with Microsoft is they just have no taste."
-- Steve Jobs <http://www.youtube.com/watch?v=WfALGcDNEDw>
================================================================
_______________________________________________
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