Just in case anyone has got here by googling for a nice XPath parser and gone off and used TFHpple, Note that TFHpple uses XPathQuery. This is pretty good, but has a memory leak.
In the function *PerformXPathQuery, if the nodes are found to be nil, it jumps out before cleaning up.
So where you see this bit of code: Add in the two cleanup lines.
xmlNodeSetPtr nodes = xpathObj->nodesetval;
if (!nodes)
{
NSLog(@"Nodes was nil.");
/* Cleanup */
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
return nil;
}
If you are doing a LOT of parsing, it's a vicious leak.
Now.... how do I get my night back :-)