Changeset 2821
- Timestamp:
- 02/16/2009 01:49:08 PM (9 months ago)
- Files:
-
- gip/trunk/gip/lib/python/xml_common.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gip/trunk/gip/lib/python/xml_common.py
r2247 r2821 6 6 7 7 import xml.dom.minidom 8 from gip_common import fileRead 8 from gip_common import fileRead, fileOverWrite 9 9 from xml.sax import make_parser 10 10 from xml.sax.handler import feature_external_ges … … 22 22 if node.nodeType == node.TEXT_NODE: 23 23 rc = rc + node.data 24 if node.childNodes: 25 for child in node.childNodes: 26 if child.nodeType == node.CDATA_SECTION_NODE: 27 rc = rc + child.data 24 28 return rc 25 29 … … 58 62 parser.parse(fp) 59 63 64 def addChild(dom, leaf, child_name, text=""): 65 child = dom.createElement(child_name) 66 leaf.appendChild(child) 67 text = str(text) 68 if len(text) > 0: 69 txtNode = dom.createTextNode(text) 70 child.appendChild(txtNode) 71 72 return child 60 73 74 def writeXML(dom, filename, pretty=False): 75 if pretty: 76 contents = dom.toprettyxml() 77 else: 78 contents = dom.toxml() 79 fileOverWrite(filename, contents)
