O'Reilly logo

XML Processing with Python by Sean McGrath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16.5. Source Code for the xTract1 Utility

We end this chapter with the full source code for xTract1. The main thing to watch for in the code is how the XML to be searched is processed in an event-driven style. Once a start-tag occurs that matches the root element of the Query-By-Example template, processing switches to tree-driven style. A debug variable has been provided in this code. Set the variable to 1 to get logging information about what is going on as the algorithm executes.

 CD-ROM reference=16012.txt """ xTract1 -- An XML-Based Query-By-Example system for Web Resource Retrieval Given: A URL referencing an XML file An XML fragment to treat as a Query-By-Example template (containing Python regular expressions) Return list of matching ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required