ANN: generateDS.py 8a available

Discussion in 'Python' started by Dave Kuhlman, Dec 22, 2004.

  1. Dave Kuhlman

    Dave Kuhlman Guest

    generateDS.py 1.8a has been released.

    If you try it and have suggestions, comments, or bug reports,
    please send them my way.


    Where to find generateDS.py
    ===========================

    You can find generateDS.py here:

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


    What is new
    ===========

    Recent enhancements include the following:

    - Mixed content -- generateDS.py now will generate code that
    handles mixed content when the element definition includes the
    attribute mixed="true". The generated code is awkward, but at
    least you are not blocked completely when an XML Schema uses
    this feature.

    - Element extensions -- generateDS.py now generates subclasses for
    extensions, that is when an element definition contains
    something like this:

    <xs:extension base="sometag">

    There is an important limitation, however: member names
    duplicated (overridden ?) in an extension generate erroneous
    code. Sigh. I guess I needed something to do in 2005.

    - Attribute groups -- generateDS.py now handles definition and use
    of attribute groups, that is the use of something like the
    following:

    <xs:attributeGroup name="favorites">
    <xs:attribute name="fruit" />
    <xs:attribute name="vegetable" />
    </xs:attributeGroup>


    - Substitution groups -- generateDS.py now handles a *limited*
    range of substitution groups, in particular it handles
    substitution groups that involve complex types, but does not
    handle those that involve (substitute for) simple types (for
    example, xs:string, xs:integer, etc). This is because the code
    generated for members defined as simple types does not provide
    the needed information to handle substitution groups.


    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. 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.

    The generated Python code contains:

    - A class definition for each element defined in the XML Schema
    document.

    - A main and driver function that can be used to test the
    generated code.

    - A parser that will read an XML document which satisfies the XML
    Schema from which the parser was generated. The parser creates
    and populates a tree structure of instances of the generated
    Python classes.

    - Methods in each class to export the instance back out to XML
    (method ``export``) and to export the instance to a literal
    representing the Python data structure (method
    ``exportLiteral``).

    The generated classes contain the following:

    - A constructor method (__init__), with member variable
    initializers.

    - Methods with names 'getX' and 'setX' for each member variable
    'X' or, if the member variable is defined with
    maxOccurs="unbounded", methods with names 'getX', 'setX',
    'addX', and 'insertX'.

    - A "build" method that can be used to populate an instance of the
    class from a node in a minidom tree.

    - An "export" method that will write the instance (and any nested
    sub-instances) to a file object as XML text.

    - An "exportLiteral" method that will write the instance (and any
    nested sub-instances) to a file object as Python literals (text).


    Dave


    --
    Dave Kuhlman
    http://www.rexx.com/~dkuhlman
    Dave Kuhlman, Dec 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natty Gur
    Replies:
    0
    Views:
    2,573
    Natty Gur
    Jun 6, 2004
  2. =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?=
    Replies:
    0
    Views:
    2,388
    =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?=
    Jun 7, 2004
  3. Replies:
    1
    Views:
    805
    Sebastian Millies
    Nov 2, 2006
  4. Vladimir Kropylev
    Replies:
    1
    Views:
    292
    Stefan Behnel
    Mar 6, 2008
  5. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    427
    Luke Kenneth Casson Leighton
    Jan 18, 2009
Loading...

Share This Page