开发者

Expat xml parser in python

开发者 https://www.devze.com 2023-03-08 17:23 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消