Parse XML with Yotsuba 2
Yotsuba 2 has an incredible XML parsing module using CSS3 selecting algorithm. This is the short tutorial on how to use it.
First, we start with installation. You have two options here: using the source code (from SVN repo) or executing easy_install yotsuba.
Then, we start from importing Yotsuba.
import yotsuba
Then, read the file or string. In this case, you can either use the pre-instantiated parser kotoba (yotsuba.kotoba) or instantiate your own. In this example, I choose to use the pre-instantiated one to read an RSS-2.0-compatible file.
yotsuba.kotoba.read("rss2.xml");
Then, we want to get the title of the first item.
firstItemTitle = yotsuba.kotoba.get("item:first title").data();
That’s it. Just two lines and the knowledge of the standard (actually draft) CSS3 save your day.
If you want to see the complete documentation and examples, please visit at http://doc.shiroyuki.com/yotsuba/lib/kotoba.

Yotsuba