Chapter 8. Event-driven XML Processing

In chapter 7 we introduced regular expressions and built the first phase of the xgrep utility. In this chapter, we extend xgrep by making it XML-aware. That is, we give xgrep the ability to work with the PYX notation generated from XML files rather than process the plain text directly. This approach removes an entire layer of problems that crop up when XML is processed directly. Some of these problems were discussed at the end of the last chapter; we recap the problem areas at the start of this chapter.

On the road to making xgrep XML-aware, we will take the opportunity to introduce some more Python facilities, such as bitwise arithmetic operations and connecting to subprocesses via pipes. We will also ...

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.