June 2000
Intermediate to advanced
556 pages
8h 45m
English
The pyx2xml utility program converts PYX notation to XML. This utility greatly facilitates the development of XML to XML conversion programs. Combined with awk and other Unix line-oriented utilities, it is capable of a surprising amount of useful work.
CD-ROM reference=4039.txt """ Convert PYX to XML """ import string def PYXDecoder(s): """ Decode the escaped line ends and tabs in PYX notation. """ s = string.replace(s,"\\n","\n") s = string.replace(s,"\\t","\t") return s def pyx2xml(fo): """ Treat contents of file object fo as PYX. Create XML output. """ L = fo.readline() while L: if L[0] == "(": # Grab element type name. etn = L[1:-1] # Process any attributes that follow. attrs = {} L = fo.readline() ...Read now
Unlock full access