1.1 --- a/libxml2dom/__init__.py Sun Jan 26 21:53:15 2014 +0100
1.2 +++ b/libxml2dom/__init__.py Sun Jan 26 22:55:18 2014 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 DOM wrapper around libxml2, specifically the libxml2mod Python extension module.
1.6
1.7 -Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012, 2013 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012, 2013, 2014 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU Lesser General Public License as published by the Free
1.12 @@ -523,8 +523,9 @@
1.13 """
1.14
1.15 ns = {}
1.16 - ns.update(default_ns)
1.17 - ns.update(namespaces or {})
1.18 + ns.update(self.ownerDocument.namespaces)
1.19 + if namespaces:
1.20 + ns.update(namespaces)
1.21 result = Node_xpath(self._node, expr, variables, ns)
1.22 if isinstance(result, str):
1.23 return to_unicode(result)
1.24 @@ -588,10 +589,17 @@
1.25 VAL_FALSE = 6
1.26 VAL_UNKNOWN = 7
1.27
1.28 - def __init__(self, node, impl):
1.29 + def __init__(self, node, impl, namespaces=None):
1.30 self._node = node
1.31 self.implementation = self.impl = impl
1.32 self.error_handler = libxml2dom.errors.DOMErrorHandler()
1.33 + self.namespaces = {}
1.34 + self._update_namespaces([default_ns, namespaces])
1.35 +
1.36 + def _update_namespaces(self, additional_namespaces):
1.37 + for namespaces in additional_namespaces:
1.38 + if namespaces:
1.39 + self.namespaces.update(namespaces)
1.40
1.41 # Standard DOM properties and their implementations.
1.42