When grabbing data from a web server, it's highly likely that you'll receive it in a structured format of one kind or another, with XML and JSON being the most common options. In this example, we'll look at how to make use of data served up as XML.
To use this example, you'll need to have an XML file available on a server somewhere. The easiest way to do this is to create a file locally on your machine, then run the following:
python -m SimpleHTTPServer
From the same directory as the file, provide access to it via localhost. Here's the file that I'll be using as the example:
<xml version="1.0"> <object type="cube"> <x>0</x> <y>2</y> <z>3</z> <size>3</size> </object> <object type="sphere"> <size>2</size> <x>0</x> <y>0</y> <z>0</z> </object> </xml>
The...