1.1 --- a/libxml2dom/svg.py Sun Jan 26 21:53:15 2014 +0100
1.2 +++ b/libxml2dom/svg.py Sun Jan 26 22:55:18 2014 +0100
1.3 @@ -5,7 +5,7 @@
1.4 See: http://www.w3.org/TR/SVGMobile12/python-binding.html
1.5 See: http://www.w3.org/TR/SVGMobile12/svgudom.html
1.6
1.7 -Copyright (C) 2007, 2008, 2012 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2007, 2008, 2012, 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 @@ -33,6 +33,10 @@
1.13
1.14 SVG_NAMESPACE = "http://www.w3.org/2000/svg"
1.15
1.16 +default_ns = {
1.17 + "svg" : SVG_NAMESPACE
1.18 + }
1.19 +
1.20 comma_wsp = re.compile("\s*,\s*|\s+")
1.21
1.22 TYPE_MISMATCH_ERR = 17
1.23 @@ -737,20 +741,9 @@
1.24
1.25 class SVGNode(libxml2dom.Node):
1.26
1.27 - "Convenience modifications to nodes specific to libxml2dom.svg."
1.28 -
1.29 - def xpath(self, expr, variables=None, namespaces=None):
1.30 + "An SVG-specific node."
1.31
1.32 - """
1.33 - Evaluate the given 'expr' using the optional 'variables' and
1.34 - 'namespaces'. If not otherwise specified, the "svg" prefix will be bound
1.35 - to SVG_NAMESPACE as defined in this module.
1.36 - """
1.37 -
1.38 - namespaces = namespaces or {}
1.39 - if not namespaces.has_key("svg"):
1.40 - namespaces["svg"] = SVG_NAMESPACE
1.41 - return libxml2dom.Node.xpath(self, expr, variables, namespaces)
1.42 + pass
1.43
1.44 # NOTE: DocumentEvent is from DOM Level 3 Events.
1.45 # NOTE: EventSystem is a special libxml2dom.events class.
1.46 @@ -759,14 +752,15 @@
1.47
1.48 "An SVG-specific document node."
1.49
1.50 - def __init__(self, node, impl):
1.51 + def __init__(self, node, impl, namespaces=None):
1.52
1.53 """
1.54 Initialise the document with the given 'node', implementation 'impl',
1.55 and global (SVGGlobal) details.
1.56 """
1.57
1.58 - libxml2dom._Document.__init__(self, node, impl)
1.59 + libxml2dom._Document.__init__(self, node, impl, None)
1.60 + self._update_namespaces([default_ns, namespaces])
1.61 self.global_ = self.impl.get_global(self) # parent
1.62
1.63 class SVGElement(SVGNode, EventTarget, TraitAccess, ElementTraversal): # NOTE: SVGNode instead of Element.