cici xml output..
This commit is contained in:
+2
-1
@@ -27,7 +27,8 @@ def getNodeText(node, tagpath = ""):
|
|||||||
except AttributeError: # no node by that name
|
except AttributeError: # no node by that name
|
||||||
return None
|
return None
|
||||||
if child.nodeType == child.TEXT_NODE:
|
if child.nodeType == child.TEXT_NODE:
|
||||||
return child.data
|
# in any case, strip whitespaces...
|
||||||
|
return child.data.strip()
|
||||||
else:
|
else:
|
||||||
raise XmlError("getNodeText: Expected text node, got something else!")
|
raise XmlError("getNodeText: Expected text node, got something else!")
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -38,7 +38,8 @@ class XmlFile(object):
|
|||||||
|
|
||||||
def writexml(self, fileName):
|
def writexml(self, fileName):
|
||||||
f = codecs.open(fileName,'w', "utf-8")
|
f = codecs.open(fileName,'w', "utf-8")
|
||||||
self.dom.writexml(f)
|
f.write(self.dom.toprettyxml())
|
||||||
|
f.close()
|
||||||
|
|
||||||
def verifyRootTag(self):
|
def verifyRootTag(self):
|
||||||
if self.dom.documentElement.tagName != self.rootTag:
|
if self.dom.documentElement.tagName != self.rootTag:
|
||||||
|
|||||||
Reference in New Issue
Block a user