The XML APIs

There are two main approaches to working with XML data:

  • Reading a whole document and creating an object-based representation of it, then manipulating it by using an object-oriented API
  • Processing the document from start to end, and performing actions as specific tags are encountered

For now, we're going to focus on the object-based approach by using a Python XML API called ElementTree. The second so-called pull or event-based approach (also often called SAX, as SAX is one of the most popular APIs in this category) is more complicated to set up, and is only needed for processing large XML files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset