equal
deleted
inserted
replaced
2007 |
2007 |
2008 """ |
2008 """ |
2009 This function generate a xml parser from a class factory |
2009 This function generate a xml parser from a class factory |
2010 """ |
2010 """ |
2011 |
2011 |
|
2012 NAMESPACE_PATTERN = re.compile("xmlns(?:\:[^\=]*)?=\"[^\"]*\" ") |
|
2013 |
2012 class DefaultElementClass(etree.ElementBase): |
2014 class DefaultElementClass(etree.ElementBase): |
2013 |
2015 |
2014 def init(self): |
2016 def init(self): |
2015 pass |
2017 pass |
2016 |
2018 |
2017 def getLocalTag(self): |
2019 def getLocalTag(self): |
2018 return etree.QName(self.tag).localname |
2020 return etree.QName(self.tag).localname |
2019 |
2021 |
2020 def tostring(self): |
2022 def tostring(self): |
2021 return etree.tostring(self, pretty_print=True) |
2023 return NAMESPACE_PATTERN.sub("", etree.tostring(self, pretty_print=True)) |
2022 |
2024 |
2023 class XMLElementClassLookUp(etree.PythonElementClassLookup): |
2025 class XMLElementClassLookUp(etree.PythonElementClassLookup): |
2024 |
2026 |
2025 def __init__(self, classes, *args, **kwargs): |
2027 def __init__(self, classes, *args, **kwargs): |
2026 etree.PythonElementClassLookup.__init__(self, *args, **kwargs) |
2028 etree.PythonElementClassLookup.__init__(self, *args, **kwargs) |