[XML-SIG] ANN: New version of generateDS.py

Dave Kuhlman dkuhlman at cutter.rexx.com
Fri Nov 5 22:49:52 CET 2004


Version 1.7a of generateDS.py is available.

This new work was done with the help and guidance of Lloyd Kvam.

The significant new features are:

- Support for mixed content -- When an element is defined with
  mixed="true", generateDS.py generates a class with a very
  different data model, basically a list of container objects for
  nested text and elements.  It's clumsey and it has limitations,
  but at least you are not completely stuck when your XML Schema
  defines elements with mixed content.

- Extensions - When element A is defined as an extension whose base
  is element B, then generateDS.py generates class A as a subclass
  of class B.  Thanks especially to Lloyd for his guidance in using
  subclasses to solve this one.  Without his guidance and design
  suggestions, I would have wandered cluelessly into something
  quite kludgy.

- Ability to access the text content of elements defined to have
  attributes but no nested elements.  Formerly, generateDS.py did
  not support this.  Now, for these classes, there is a valueOf_
  member, which is used to access text content.

The lack of support for mixed content was discussed by Uche in his
article "XML Data Bindings in Python", which is at:

    http://www.xml.com/pub/a/2003/06/11/py-xml.html

What is generateDS.py? -- generateDS.py generates Python data
structures (for example, class definitions) from an XML Schema
document. These data structures represent the elements in an XML
document described by the XML Schema. It also generates parsers
that load an XML document into those data structures, as well as
export methods that write classes out to XML and to Python literal
data structures. In addition, a separate file containing subclasses
(stubs) is optionally generated. The user can add methods to the
subclasses in order to process the contents of an XML document.

You can find generateDS.py here:

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

And, as usually, your suggestions and comments are welcome.

Dave

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


More information about the XML-SIG mailing list