Removed namespaces declaration in subtree elements xml description when copy/paste
--- a/xmlclass/xmlclass.py Fri Aug 30 18:10:30 2013 +0200
+++ b/xmlclass/xmlclass.py Mon Sep 02 09:41:15 2013 +0200
@@ -2009,6 +2009,8 @@
This function generate a xml parser from a class factory
"""
+NAMESPACE_PATTERN = re.compile("xmlns(?:\:[^\=]*)?=\"[^\"]*\" ")
+
class DefaultElementClass(etree.ElementBase):
def init(self):
@@ -2018,7 +2020,7 @@
return etree.QName(self.tag).localname
def tostring(self):
- return etree.tostring(self, pretty_print=True)
+ return NAMESPACE_PATTERN.sub("", etree.tostring(self, pretty_print=True))
class XMLElementClassLookUp(etree.PythonElementClassLookup):