XML parsing - ElementTree vs SAX and DOM

后端 未结 4 1287
梦毁少年i
梦毁少年i 2020-12-12 11:47

Python has several ways to parse XML...

I understand the very basics of parsing with SAX. It functions as a stream parser, with an event-driven API

4条回答
  •  借酒劲吻你
    2020-12-12 11:54

    ElementTree's parse() is like DOM, whereas iterparse() is like SAX. In my opinion, ElementTree is better than DOM and SAX in that it provides API easier to work with.

提交回复
热议问题