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

Get XML Processing with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.