# HG changeset patch # User paulb # Date 1106570804 0 # Node ID 366550ef6c84e68954f99eb6155fc4c6d0e7c0a0 # Parent d36ee849136d357fa39b14a1e9de0ac00242f87d [project @ 2005-01-24 12:46:44 by paulb] Fixed ownerDocument and xpath method implementations. diff -r d36ee849136d -r 366550ef6c84 libxml2dom/macrolib/macrolib.py --- a/libxml2dom/macrolib/macrolib.py Mon Jan 24 12:46:24 2005 +0000 +++ b/libxml2dom/macrolib/macrolib.py Mon Jan 24 12:46:44 2005 +0000 @@ -56,7 +56,7 @@ } def Node_ownerDocument(node): - return libxml2mod.doc(node) + return libxml2mod.doc(node) or node def Node_nodeType(node): global _nodesTypes @@ -266,12 +266,11 @@ def Node_xpath(node, expr, variables=None, namespaces=None): context = libxml2mod.xmlXPathNewContext(Node_ownerDocument(node)) - libxml2mod.xmlXPathSetContextNode(context, node) # NOTE: Discover namespaces from the node. for prefix, ns in (namespaces or {}).items(): libxml2mod.xmlXPathRegisterNs(context, prefix, ns) # NOTE: May need to tidy up the context. - return libxml2mod.xmlXPathEval(context, expr) + return libxml2mod.xmlXPathEval(expr, context) # Utility functions.