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=\"[EMAIL PROTECTED]"]",
[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/[EMAIL PROTECTED]"[EMAIL PROTECTED]"]"

================================================================
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 (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 [EMAIL PROTECTED]

Reply via email to