python from Java

Fredrik Lundh fredrik at pythonware.com
Tue Sep 7 11:54:38 EDT 2004


>> okay i tried the above approaches but no luck. See the problem is an XML
>> parser which works on a PDA - pythonce. Now elementtree uses pyexpat
>> (which  pythonce doesn't have)
>
> that's why ElementTree ships with several alternative tree builders.

by the way, it's trivial to build trees from arbitrary SAX-style sources.
just create an instance of the ElementTree.TreeBuilder class, and call
the "start", "end", and "data" methods as appropriate.

    builder = ElementTree.TreeBuilder()
    builder.start("tag", {})
    builder.data("text")
    builder.end("tag")
    elem = builder.close()

</F> 






More information about the Python-list mailing list