Beyond these parsing tools, Python also ships with an xmlrpc package to support the
client and server sides of the XML-RPC protocol (remote procedure calls that transmit
objects encoded as XML over HTTP), as well as a standard HTML parser, html.parser,
that works on similar principles and is presented later in this chapter. The third-party
domain has even more XML-related tools; most of these are maintained separately from
Python to allow for more flexible release schedules. Beginning with Python 2.3, the
Expat parser is also included as the underlying engine that drives the parsing process.
XML Parsing in Action
XML processing is a large, evolving topic, and it is mostly beyond the scope of this
book. For an example of a simple XML parsing task, though, consider the XML file in
Example 19-8. This file defines a handful of O’Reilly Python books—ISBN numbers
as attributes, and titles, publication dates, and authors as nested tags (with apologies
to Python books not listed in this completely random sample—there are many!).
Example 19-8. PP4E\Lang\Xml\books.xml
1430 | Chapter 19: Text and Language