1.1 --- a/libxml2dom/macrolib/macrolib.py Wed Nov 16 17:19:40 2005 +0000
1.2 +++ b/libxml2dom/macrolib/macrolib.py Wed Nov 16 17:19:56 2005 +0000
1.3 @@ -310,6 +310,9 @@
1.4 raise ValueError, "Node type '%s' (%d) not supported." % (_reverseNodeTypes[other.nodeType], other.nodeType)
1.5
1.6 def Node_xpath(node, expr, variables=None, namespaces=None):
1.7 + # NOTE: Need to convert from Unicode.
1.8 + expr = from_unicode(expr)
1.9 +
1.10 context = libxml2mod.xmlXPathNewContext(Node_ownerDocument(node))
1.11 libxml2mod.xmlXPathSetContextNode(context, node)
1.12 # NOTE: Discover namespaces from the node.
1.13 @@ -319,6 +322,8 @@
1.14 libxml2mod.xmlXPathRegisterNs(context, prefix, ns)
1.15 # NOTE: No such functions are exposed in current versions of libxml2.
1.16 #for (prefix, ns), value in (variables or {}).items():
1.17 + # # NOTE: Need to convert from Unicode.
1.18 + # value = from_unicode(value)
1.19 # libxml2mod.xmlXPathRegisterVariableNS(context, prefix, ns, value)
1.20 result = libxml2mod.xmlXPathEval(expr, context)
1.21 libxml2mod.xmlXPathFreeContext(context)