June 2000
Intermediate to advanced
556 pages
8h 45m
English
We have seen how Python's regular expressions can be gainfully applied to XML. We have also seen that there are some “gotchas” with this approach to bear in mind when processing arbitrary XML that may use features such as comments, CDATA sections, and entity references.
How can we deal with these gotchas? Well, the most obvious answer is to use a full-blown XML parser to process the XML document. If, for example, you processed PYX generated from xmln or xmlv, the XML parser will insulate you from any false hits such as those shown in the above sections.
This approach—using an XML parser to create “events” and then processing the events—is a popular and powerful technique. We use it to enhance xgrep in the ...
Read now
Unlock full access