Sign In/My Account | View Cart  
advertisement

Article:
 XML Data Bindings in Python
Subject: Dave responds
Date: 2003-09-10 08:56:25
From: Dave Kuhlman

Thanks to Uche for his comments and suggestions on generateDS.py.


Looks to me like Uche had the following comments:


1. generateDS.py does not handle element declarations that are defined as simple types.


Dave replies: I've fixed this one. A new version that handles
element definitions that are simple types is at my Web site:


http://www.rexx.com/~dkuhlman/generateDS-1.3b.tar.gz


2. generateDS.py generates parsers that use minidom, whereas, for large XML input documents at least, it would be preferable if a SAX parser were used.


Dave replies: I'm working on this one. You are right. It needs to be done. However, since all of my own use of generateDS.py has been with small documents, I probably won't be fixing it too quickly.


3. generateDS.py generates code that does not handle mixed content.


Dave replies: I really should fix this one, but probably will not. I actually do not see how generateDS.py could handle mixed content, at least not without radical revision. I admit, the generated data structures were not designed well enough to handle mixed content. And, it now seems bizarre to me that I've used generateDS.py as much as I have without discovering this problem. I suppose that's because I've always used it for XML documents that represent data structures rather than for documents that contain text that was (later) marked up.


By the way, Uche did not mention that there is an option "-s" that can be used to instruct generateDS.py to generate a file containing subclasses of the data representation classes. (That he did not see this may be my fault. I noticed that the link from my main page refers to an older version. Now fixed.) These subclasses enable the user to inherit from the data representation classes and to add application specific behaviors. Using a sub-class file seems cleaner to me and also means that you can use a single super-class file (the data representation classes) along with multiple sub-class files to implement multiple tasks on the same XML document type.


Thanks again, Uche, for your interesting comments. They have been helpful to me. And, I appreciate all the work you've done on PyXML.


Dave


Dave Kuhlman
dkuhlman@rexx.com
http://www.rexx.com/~dkuhlman


Previous Message Previous Message   Next Message No Next Message


Titles Only Titles Only Newest First
  • Dave responds
    2003-09-17 14:34:22 Dave Kuhlman


    > 2. generateDS.py generates parsers that use minidom, >whereas, for large XML input documents at least, it would >be preferable if a SAX parser were used.
    >
    > Dave replies: I'm working on this one. You are right. It >needs to be done. However, since all of my own use of >generateDS.py has been with small documents, I probably >won't be fixing it too quickly.


    It's done. Now, generateDS.py also generates SAX parsers.


    A qualification: The generated SAX parser still builds a tree; it just does not build a DOM tree. So using generateDS.py parsers on *huge* documents is still a questionable thing to do.


    You can find the new version at:


    http://www.rexx.com/~dkuhlman/generateDS.html
    http://www.rexx.com/~dkuhlman/generateDS-1.4a.tar.gz


    Thanks to Uche for motivating me to fix this.


    Dave



Sponsored By: