diff options
author | Kevin Rocard <kevin.rocard@intel.com> | 2015-02-10 20:45:35 +0100 |
---|---|---|
committer | Kevin Rocard <kevin.rocard@intel.com> | 2015-02-10 20:50:12 +0100 |
commit | 794fea64ed11b6c2b2604c3a0daa374c885f09d6 (patch) | |
tree | 7824cd7f46aa58a83633dfab8833f6ca5b26ddd3 /tools | |
parent | f39078a6c340431a749ded1f69deb6c646de531c (diff) | |
download | external_parameter-framework-794fea64ed11b6c2b2604c3a0daa374c885f09d6.zip external_parameter-framework-794fea64ed11b6c2b2604c3a0daa374c885f09d6.tar.gz external_parameter-framework-794fea64ed11b6c2b2604c3a0daa374c885f09d6.tar.bz2 |
Use minidom factory methods in xml coverage generator
The exportToXML was creating an minidom.Element using
it's constructor, which is forbidden in the documentation:
> Applications should not instantiate the classes themselves; they should use the creator functions available on the Document object.
http://docs.python.org/library/xml.dom.minidom.html
Since python 3.4 this method no longer works (private interface change)
thus the xml coverage generation was broken.
Fix by calling the recommended method Document.createElement.
See bug: http://bugs.python.org/issue15290
Signed-off-by: Kevin Rocard <kevin.rocard@intel.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/coverage/coverage.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/coverage/coverage.py b/tools/coverage/coverage.py index 0b9dd4c..1df02ae 100755 --- a/tools/coverage/coverage.py +++ b/tools/coverage/coverage.py @@ -204,14 +204,14 @@ class Element(): str(dumpedDescription) for dumpedDescription in self._dumpDescription(withCoverage, withNbUse)) - def exportToXML(self, domElement=None): + def exportToXML(self, document, domElement=None): if domElement == None: - domElement = xml.dom.minidom.Element(self.tag) + domElement = document.createElement(self.tag) self._XMLaddAttributes(domElement) for child in self.children : - domElement.appendChild(child.exportToXML()) + domElement.appendChild(child.exportToXML(document)) return domElement @@ -877,10 +877,10 @@ class Root(Element): def exportToXML(self): """Export tree to an xml document""" impl = xml.dom.minidom.getDOMImplementation() - newdoc = impl.createDocument(namespaceURI=None, qualifiedName=self.tag, doctype=None) - super().exportToXML(newdoc.documentElement) + document = impl.createDocument(namespaceURI=None, qualifiedName=self.tag, doctype=None) + super().exportToXML(document, document.documentElement) - return newdoc + return document # ============================ # Command line argument parser |