In Part 2 of this tutorial, we looked at how libxml (through the use of the lxml Python bindings) can be used to parse XML documents. We covered how to load XML files from disk, parse them, look for specific tags and attributes, and generate custom datatypes from the results.
These are the operations that lxml is used most often for and are probably what most developers will need it for. It only scratches the surface of what it is capable of, however.
In Part 2, we talked about three common XML operations: parsing, validation, and transformation. Of these three, parsing is the most important. We touched upon validation and transformation, but didn’t look at how they work.
In this video, we’ll take a look at the last two operation. We’ll cover validation using DocType definitions and XML Schema and transformation, using XSLT style sheets.
Note: The example files used in the video can be downloaded from here.
Parsing XML with Python, Part 3: Validation and Transforms is a post from: Apolitically Incorrect. Copyright 2009 – 2010, Rob Oakes.