nodesForXPath almost always returns no objects
nodesForXPath almost always returns no objects
- Subject: nodesForXPath almost always returns no objects
- From: Ryan Homer <email@hidden>
- Date: Mon, 8 Jan 2007 19:47:44 -0500
I have an NSXMLDocument object with an XML document that looks like
the following:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
.
.
.
</soap:Header>
<soap:Body>
<FindMembershipResponse xmlns="http://www.msn.com/webservices/
AddressBook">
<FindMembershipResult>
.
.
.
</FindMembershipResult>
</FindMembershipResponse>
</soap:Body>
</soap:Envelope>
Then I have the following simple code:
NSXMLNode *n = [xmldoc rootElement];
NSArray *a = [n nodesForXPath:@"//soap:Body/FindMembershipResponse"
error:&error];
which returns no elements in the array. However, if I use just "//
soap:Body" for the XPath query, it returns 1 object, specifically:
<soap:Body>
<FindMembershipResponse xmlns="http://www.msn.com/webservices/
AddressBook">
<FindMembershipResult>
.
.
.
</FindMembershipResult>
</FindMembershipResponse>
</soap:Body>
I have tried with the initial dot (".//soap:Body/
FindMembershipResponses"), without the dot, with one slash and with
both slashes, but I just can't seem to get any further than the Body.
I actually need to go quite deep to get a branch of the tree and then
traverse the nodes to get all information I need.
I've also included "soap:Envelope" as well (".//soap:Envelope/
soap:Body/FindMembershipResponse") to no avail.
Am I getting the syntax wrong? Any ideas? Thanks in advance.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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