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 ...
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.