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

4.2. Simple XML-Processing Tasks with XMLN and XMLV

The line-oriented output of xmln and xmlv lends itself to processing with simple, common shell utilities such as wc, grep and awk. Unix users already have these as part of the standard Unix toolset. For Windows users, the GNU versions of the grep and awk utilities can be found in the windows subdirectory of the CD-ROM.

In the following sections, xmln is used to perform useful work by combining its ability to parse and tokenize XML with generic line-oriented text-processing tools. In all cases, xmlv could just have easily been used to perform a validating parse.

In the examples that follow, we illustrate various processing tasks on the following XML file.

CD-ROM reference=4015.txt
C>type staff.xml ...

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