June 2000
Intermediate to advanced
556 pages
8h 45m
English
The most straightfoward (and least powerful) way of using the Pyxie library is to process the PYX notation directly. We have already seen numerous examples of the two command-line utilities, xmln and xmlv, that generate PYX output. We have seen how they can be used from within Python programs by use of the popen function. The program below outputs the start-tags occurring in an XML document by processing the PYX-generated by xmln.
CD-ROM reference=12001.txt C>type hello.xml <?xml version="1.0"?> <greeting> Hello <b>World</b> </greeting> C>type p1.py """ Print start-tags from an XML document by processing PYX-generated from xmln. """ import os,sys pyx = os.popen ("xmln " + sys.argv[1]) for L in pyx.readlines(): if ...
Read now
Unlock full access