(Which list is the correct one for XML processing? Is there a Web SIG? Should there be an XML SIG? There certainly seems to be interest in this now.) I've now made a skeleton SAX library to see how SAX translates to Python, as a convenience for others doing SAX-related stuff in Python and as a focal point for further development. I found that SAX translated quite naturally to Python and that the xml-dev developers had IMHO done a very good job. The library provides minimal base classes with the default behaviour prescribed by the SAX spec and a trivial SAX-based ESIS printer. The only deviations from the letter of the specification are these: - HandlerBase has a superclass that is not described in SAX in order to make subclassing HandlerBase a little easier. This was done because HandlerBase has been made to ignore all unknown method calls, which might not be desirable in subclassed handlers. (As I write this I'm beginning to think that I should instead add empty methods to the class to avoid this problem. Opinions?) - Two methods have been added to AttributeMap: __getitem__ and keys, in order to make it possible to use AttributeMap as an ordinary Python hash table. Comments of all kinds are most welcome. The URL is <URL:http://www.stud.ifi.uio.no/~larsga/download/python/xml/> Also, if the __getitem__ and keys additions are accepted as part of the Python SAX specification, perhaps we should make a PySAX specification that describes the additions to the generic SAX? Now I'll get some sleep and tomorrow I'll start working on a SAX driver for xmllib. I'll also add a command-line interface so that we get a demo ESIS-producing XML parser. -- "These are, as I began, cumbersome ways / to kill a man. Simpler, direct, and much more neat / is to see that he is living somewhere in the middle / of the twentieth century, and leave him there." -- Edwin Brock http://www.stud.ifi.uio.no/~larsga/ http://birk105.studby.uio.no/ _______________ DOC-SIG - SIG for the Python Documentation Project send messages to: doc-sig@python.org administrivia to: doc-sig-request@python.org _______________
participants (1)
-
Lars Marius Garshol