June 2000
Intermediate to advanced
556 pages
8h 45m
English
Now that we can load XML that has been converted to PYX notation and re-create an XML document from the tree, we can add a simple test harness to the pyxie.py module. The code creates a tree from the XML document supplied as its first parameter. The tree is then “serialized” to XML as output.
CD-ROM reference=9018.txt
if __name__ == "__main__":
import os,sys
t = BuildTree (os.popen("xmln " + sys.argv[1]))
print `t`
Here is an example of the test harness in action.
CD-ROM reference=9019.txt C>type greeting.xml <greeting> Hello World. </greeting> C>python pyx.py greeting.xml <?xml version="1.0"?> <greeting>\nHello World.\n</greeting>
Read now
Unlock full access