16.2. The xTract.py Utility in Action

Here is an example execution of the xTract utility using the above XML file from http://www.slashdot.com and the above query template. Note how the three stories returned match the search criteria expressed in the interesting.xml file.

CD-ROM reference=16003.txt
C>python xTract.py http://www.slashdot.org/slashdot.xml
					interesting.xml 3 fragment(s) match. <?xml version="1.0"?> <story> <title>LinuxPPC unleashes LinuxPPC 1999 Q3</title> <url>http://slashdot.org/articles/99/09/13/1240212 .shtml</url> <time>1999_09_13 20:43:11</time> <author>Hemos</author> <department>rolling_out_the_new</department> <topic>linux</topic> <comments>69</comments> <section>articles</section> <image>topiclinux.gif</image> </story> ...

Get XML Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.