When us开发者_JAVA百科ing expat xml parser in python, how can I get it store the parsed the xml data in a string or in a file or in any data structure. Please show me a way to accomplish how to parse and use the nodes of the xml data.
Why are you using a low-level interface like the expat parser when you can use xml.etree.[c]ElementTree? It creates a tree of elements (nodes) for you. Elements have tag, text, and tail attributes and contain a dict that maps attribute names to values, and a list of child elements.
Have a look at the Python documentation for xml.etree.ElementTree, and this additional information.
精彩评论