June 2000
Intermediate to advanced
556 pages
8h 45m
English
We need to add a reasonable amount of new code to xgrep in this chapter. We will also take the opportunity of modularizing the code a little. We introduce a separate function, XMLGrepEvents, to handle the PYX event-based form of XML-aware processing. This reorganization will stand us in good stead when we add another form of XML-aware processing in the next chapter.
In the code below, a -e switch has been added to tell xgrep to function in “event mode.” In this mode, xgrep treats files as XML files and processes the output of xmln rather than processing the text of the XML file directly.
The existing XMLGrep function has not been modified in any way and so is not reproduced here.
CD-ROM reference=8005.txt import ...
Read now
Unlock full access