| March 19, 2012 1:59 pm

Parsing XML with Python, Part 2As we talked about in Part 1 of this series, XML is one of the most versatile structural languages, which has led it to be used in nearly everything every sort of application imaginable. It serves as the basis of file formats, a way to store financial records, and for communication between web servers. For this reason, programmers and designers should be familiar with not only how to write it, but also how to parse, validate, and transform it.

One of the most powerful tools for working with XML is libxml, an open source parser. Given its versatility, libxml is used in many open source projects, and even commercial products. It can be found at the base of the Gnome desktop and in banking software.

In this video, Part 2 of a series on working with XML from Python, we’ll look at how you can use libxml from Python through the lxml bindings. We’ll show how to load and parse an XML document, iterate through the elements and attributes, test for specific tags, and translate the document structure into a custom object.

Note: The example files used in the video can be downloaded from here.


No Responses to “Parsing XML with Python, Part 2: Basic Use”

Care to comment?