8.12. In Conclusion

We have seen how the event-driven approach cuts out a lot of potential trouble spots for processing XML by leaving the handling of XML syntax in the safe hands of an XML parser.

We now have a version of xgrep that doubles as a plain text grepping tool and an XML-aware grepping tool. It has its faults, but even as it stands, it is a useful utility.

In the next chapter, we will extend xgrep further, but for now, we close out this chapter with a couple of small changes to xgrep.

Before we finish this chapter, we will improve the PrintMatch function. Currently, it prints its output on standard output with the print statement. This is likely to be a less-than-perfect behavior when the module is imported into larger programs, especially ...

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.