Chapter 16. xTract: A Query-By-Example XML Retrieval System

In this chapter, we develop xTract—a utility for retrieving fragments of XML files matching particular search criteria on the Web.

The user specifies a search template in a manner similar to Query-By-Example systems often used with relational databases.

An example will help make this clear. The web site http://www.slashdot.org publishes an XML file on their site that lists the main stories of the day. The geturl utility developed earlier can be used to retrieve this file.

CD-ROM reference=16001.txt
C>python geturl.py http://www.slashdot.org/slashdot.xml <?xml version="1.0"?><backslash xmlns:backslash="http://slashdot.org/backslash.dtd"> <story> <title>Doubleclick's Banner Ad Patent</title> ...

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.