diff --git a/release-notes.html b/release-notes.html index 1167be4..6ecb28d 100644 --- a/release-notes.html +++ b/release-notes.html @@ -9,6 +9,17 @@

Copyright 2009, Jeff Schiller

+
+
+

Version 0.19

+
+

Aug 9th, 2009

+ +
+

Version 0.18

diff --git a/scour.py b/scour.py index ba69e62..c420617 100755 --- a/scour.py +++ b/scour.py @@ -1870,7 +1870,9 @@ def remapNamespacePrefix(node, oldprefix, newprefix): newNode.appendChild(child.cloneNode(True)) # replace old node with new node - node = parent.replaceChild( newNode, node ) + parent.replaceChild( newNode, node ) + # set the node to the new node in the remapped namespace prefix + node = newNode # now do all child nodes for child in node.childNodes : @@ -2009,10 +2011,11 @@ def scourString(in_string, options=None): numAttrsRemoved += 1 # ensure namespace for SVG is declared + # TODO: what if the default namespace is something else (i.e. some valid namespace)? if doc.documentElement.getAttribute('xmlns') != 'http://www.w3.org/2000/svg': doc.documentElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg') # TODO: throw error or warning? - + # check for redundant SVG namespace declaration attrList = doc.documentElement.attributes xmlnsDeclsToRemove = [] diff --git a/testscour.py b/testscour.py index c52ca15..a7fae40 100755 --- a/testscour.py +++ b/testscour.py @@ -868,6 +868,13 @@ class NamespaceDeclPrefixesInXMLWhenNotInDefaultNamespace(unittest.TestCase): xmlstring = scour.scourString(open('unittests/xml-ns-decl.svg').read()) self.assert_( xmlstring.find('xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"') != -1, 'Improperly serialized namespace prefix declarations when not in default namespace') + +class MoveSVGElementsToDefaultNamespace(unittest.TestCase): + def runTest(self): + xmlstring = scour.scourString(open('unittests/xml-ns-decl.svg').read()) + self.assert_( xmlstring.find(' +