Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parseLiteral(inFileName):
doc = minidom.parse(inFileName)
rootNode = doc.childNodes[0]
rootObj = xml_behavior.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('from xmlbehavior import *\n\n')
sys.stdout.write('rootObj = xml_behavior(\n')
rootObj.exportLiteral(sys.stdout, 0)
sys.stdout.write(')\n')
return rootObj
def parse(inFileName):
doc = minidom.parse(inFileName)
rootNode = doc.childNodes[0]
rootObj = xml_behavior.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('\n')
rootObj.export(sys.stdout, 0)
return rootObj
def parseString(inString):
doc = minidom.parseString(inString)
rootNode = doc.childNodes[0]
rootObj = xml_behavior.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('\n')
rootObj.export(sys.stdout, 0)
return rootObj