[XML-SIG] Need an equivalent to Perl's XML::Parser "Tree" style

John Posner jjp@connix.com
Tue, 6 Jun 2000 12:10:15 -0400

Hi --

Back when I was a Perl hacker (more of a dabbler, really), I had good luck
creating an object that represents an entire XML document, using this call:

  new XML::Parser(Style => Tree)

Here's a description, in Python terms, of the recursive data structure
created by the above call:

The E-NODE representing the root element is a 2-item list:

* item 0 = string containing name of element

* item 1 = another 2-item list:
      * item 0 = a dictionary containing element's attributes
      * item 1 = a list containing multiple 2-item lists:

          * one of these 2-item lists captures the element's character data:
               * item 0 = string "0"
               * item 1 = string containing element's character data

          * each other 2-item list is an E-NODE representing a subelement

QUESTION: what set of Python tools comes closest to creating a data
structure similar to, or exactly like, the above?


John Posner, Editor           jjp@oreilly.com
O'Reilly & Associates         860-663-3147