I would like to parse xml in python, but as a string, not taken from a file. Can someone help me do this?
Answer
From a file, you could normally do it as
from xml.dom import minidom
xmldoc = minidom.parse('~/diveintopython/common/py/kgp/binary.xml')
For a string, you can change it to
from xml.dom import minidom
xmldoc = minidom.parseString( Your string goes here )
No comments:
Post a Comment