Recently I've been developing an API using python and Django for work, which uses XML responses to speak to clients. One of my goals for the client was to be able to easily parse the XML responses that the server sends, so that I could appropriately handle errors.
Fortunately, python has many tools for building and parsing XML. During my research, I tested several options, but found that the well supported library LXML was a perfect match for what I needed. Unfortunately, I had a hard time figuring this out, as examples to just parse XML content was lacking in the official tutorial, and there were no good resources online with code samples.
So let's take a quick peek at a sample XML document, then we'll analyze some simple LXML code to see how it works. Of course, before you can run any of these code samples, you'll need to download and install LXML (there are packages available on most linux systems already).
...