June 2000
Intermediate to advanced
556 pages
8h 45m
English
Pyxie provides a collection of functions for the creation and processing of lists of nodes. The Descendants method creates a Python list of all the nodes beneath the active position in an xTree. The following program creates a list of descendants of the root node and uses it to print the data content of an XML document backwards.
CD-ROM reference=12018.txt C>type p16.py """ Print the data content of an XML document backwards. """ from pyxie import * import sys t = File2xTree (sys.argv[1]) L = t.Descendants() L.reverse() for node in L: if isinstance(node,xData): strlist = list(node.Data) strlist.reverse() print string.join(strlist,"") C>python p16.py hello.xml dlroW olleH C>type AbleWasIEreISawElba.xml <palindrome> able was I ...
Read now
Unlock full access