"""This File is to be used as a example of some simple uses of the Pyxie2 module""" __author__ = "Derek Higgins" import Pyxie2.Pyxie2Utils import Pyxie2.Pyxie2TP def Person2HTML(xTree): assert xTree.AtElement("Person"), "Expected ETN to be Person" HTML = "%s
\n"%xTree.Cursor.AVs.get("Name", "") xTree.PushPos() xTree.SeekToChildElement("Address") assert xTree.AtElement("Address"), "Expected ETN to be Address" HTML += xTree.JoinData("
") + "
\n" xTree.PopPos() xTree.SeekToChildElement("TelNo") assert xTree.AtElement("TelNo"), "Expected ETN to be TelNo" HTML += "%s

\n"%xTree.JoinData("") return HTML if __name__ == "__main__": # In this program I will convert our xml file to HTML # First we need to build out xTree xTree = Pyxie2.Pyxie2Utils.File2xTree("example.xml") # Don't worry about this yet xTree = Pyxie2.Pyxie2TP.NoMixedContentTP(xTree) HTML = "\n\n" for x in xTree.Children(): xTree.Seek(x) HTML += Person2HTML(xTree) HTML += "" fp = open("pyxie-example-3.html", "w") fp.write(HTML) fp.close()