O'Reilly logo

XML Processing with Python by Sean McGrath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required