diff options
author | David Sommerseth <davids@redhat.com> | 2009-07-15 14:03:49 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-07-15 14:03:49 +0200 |
commit | ccf38d37c54a85b356d6c13a53aa6c79330ea4e4 (patch) | |
tree | 9bceb59e346e05590f72b1ddbaafddaaabf632b3 /rteval/xmlout.py | |
parent | 43c6505efa069447cb81d1a92fcc476cffc13c90 (diff) | |
download | rteval-ccf38d37c54a85b356d6c13a53aa6c79330ea4e4.tar.gz rteval-ccf38d37c54a85b356d6c13a53aa6c79330ea4e4.tar.xz rteval-ccf38d37c54a85b356d6c13a53aa6c79330ea4e4.zip |
Added new method GetXMLdocument()
This method returns a libxml2.xmlDoc object, for further manual processing.
Fixed in addition an error, trying to access self.xmldoc before it was initialised.
Diffstat (limited to 'rteval/xmlout.py')
-rw-r--r-- | rteval/xmlout.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rteval/xmlout.py b/rteval/xmlout.py index 2b2768a..a17206f 100644 --- a/rteval/xmlout.py +++ b/rteval/xmlout.py @@ -18,11 +18,13 @@ class XMLOut(object): self.status = 0 # 0 - no report created/loaded, 1 - new report, 2 - loaded report, 3 - XML closed self.tag_trans = self.__setup_tag_trans() self.roottag = self.__fixtag(roottag) - + self.xmldoc = None + def __del__(self): if self.level > 0: raise RuntimeError, "XMLOut: open blocks at __del__ (last opened '%s')" % self.currtag.name - self.xmldoc.freeDoc() + if self.xmldoc is not None: + self.xmldoc.freeDoc() def __setup_tag_trans(self): t = maketrans('', '') @@ -180,6 +182,10 @@ class XMLOut(object): resdoc.freeDoc() xsltdoc.freeDoc() + def GetXMLdocument(self): + if self.status != 2 and self.status != 3: + raise RuntimeError, "XMLOut: XML document is not closed" + return self.xmldoc def openblock(self, tagname, attributes=None): if self.status != 1: |