mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Source/NSXMLNode.m (execute_xpath): Use correct node for
relative paths. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34821 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ecc9ca5a69
commit
7b7ea12045
2 changed files with 11 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
|||
2012-02-26 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSXMLNode.m (execute_xpath): Use correct node for
|
||||
relative paths.
|
||||
* Source/NSXMLNode.m (isEqualTree): Correct equality test to
|
||||
ignore siblings.
|
||||
* Source/NSXMLNode.m (+elementWithName:stringValue:): Correct
|
||||
recursive call.
|
||||
Patch by Ivan Vučica <ivucica@gmail.com>
|
||||
|
|
|
@ -582,11 +582,12 @@ int register_namespaces(xmlXPathContextPtr xpathCtx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
NSArray *execute_xpath(NSXMLNode *node,
|
||||
NSArray *execute_xpath(NSXMLNode *xmlNode,
|
||||
NSString *xpath_exp,
|
||||
NSString *nmspaces)
|
||||
{
|
||||
xmlDocPtr doc = ((xmlNodePtr)[node _node])->doc;
|
||||
xmlNodePtr node = [xmlNode _node];
|
||||
xmlDocPtr doc = node->doc;
|
||||
NSMutableArray *result = [NSMutableArray arrayWithCapacity: 10];
|
||||
xmlChar* xpathExpr = (xmlChar *)XMLSTRING(xpath_exp);
|
||||
xmlChar* nsList = (xmlChar *)XMLSTRING(nmspaces);
|
||||
|
@ -615,7 +616,10 @@ NSArray *execute_xpath(NSXMLNode *node,
|
|||
}
|
||||
|
||||
if (![xpath_exp hasPrefix: @"/"])
|
||||
xpathCtx->node = (xmlNodePtr)doc; // provide a context for relative paths
|
||||
{
|
||||
// provide a context for relative paths
|
||||
xpathCtx->node = node;
|
||||
}
|
||||
|
||||
/* Evaluate xpath expression */
|
||||
xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
|
||||
|
|
Loading…
Reference in a new issue