Project Member
Reported by
jwight,
Apr 7, 2008
Broken out from issue #4
I've got this working with a default namespace, but I'm having trouble figuring out the syntax for
relative paths-- those starting with
"./". For example, with my XML document, I can look up "track" nodes with:
NSArray *trackNodes;
NSDictionary *namespaceMappings = [NSDictionary
dictionaryWithObjectsAndKeys:@"http://xspf.org/ns/0/", @"seeqpod", nil];
trackNodes = [rootElementC nodesForXPath:@"//seeqpod:track"
namespaceMappings:namespaceMappings error:&error];
But each track node has a child named "location". With NSXML I can grab that with:
for (NSXMLNode *currentTrack in trackNodes) {
NSArray *locationNodes = [currentTrack nodesForXPath:@"./location" error:&error];
...
}
With TouchXML, I tried it this way and get zero hits:
for (CXMLNode *currentTrack in trackNodes) {
NSArray *locationNodes = [currentTrack nodesForXPath:@"./seeqpod:location"
namespaceMappings:namespaceMappings
error:&error];
...
}
I tried a number of variations on the path-- "seeqpod:./location", "seeqpod:./seeqpod:location",
etc. Is this another case of NSXML
abusing the XPath spec, or have I just not found the magic cookie?
Labels: TouchXML