XML XPath question
XML XPath question
- Subject: XML XPath question
- From: Sandro Noel <email@hidden>
- Date: Wed, 01 Oct 2008 11:39:31 -0400
Greetings.
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.
if i try the same line without th attribute in the query
[".//data/department/employe"]
I receive an array with all the employe records, witch is the expected
behavior.
what am I doing wrong in the first query, the documentation says this.
.//part/chapter[1]/section[title="Path Expressions"]
The evaluation of a path expression works from left to right. This
expression first gets all the elements named part and from that
selects the first element named chapter; from that it gets all child
elements named section, and from that sequence it returns the section
element whose title is “Path Expressions”. XPath also lets you find
attributes by name by using an at-sign (@) prefix. For example, the
following path expression gets the modification date (an attribute) of
the first chapter:
Thank you any help is appreciated.
Sandro._______________________________________________
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