generateDS Changelog

What's new in generateDS 2.15a Beta

Feb 19, 2015
  • Modifications so that we generate code that can be used by Python 3.
  • Thanks much to Richard Gerkin for this work.
  • Removed possible use of ElementTree. Lxml is now a requirement for both running generateDS.py itself and for running the generated code.
  • Fixed exporting of text content so that, when it contains CDATA sections, the mark-up characters inside the CDATA sections are not escaped. Thanks to George David for reporting this and for helping with a fix.

New in generateDS 2.13a Beta (Sep 10, 2014)

  • Minor fix to function generateToEtreeChildren. Must generate call to get_valueOf only when defined (i.e. when element is simpleContent or isMixed).
  • Fix to generation of class name prefixes added with the "-p" command line option. This fix was added by Christian Ascheberg. Thank you Christian.
  • Added unit test for class name prefixes command line option.

New in generateDS 2.12e (Jun 17, 2014)

  • Fix for formatting error. Thanks to Nikolay Lavrov for catching this and for providing a fix.
  • Fix to gds_parse_datetime(). The Python datetime module's datetime object uses microseconds, but xs:dateTime uses fractions of a second (e.g. 0.123). Converted from decimal fraction to microseconds. Thanks to Mikki Weesenaar for catching this.
  • Modified behavior and names for generated method insert_xxx(which are generated when, e.g., maxOccurs="unbounded"), so that now we generate insert_xxx_at and replace_xxx_at.
  • Wagenaar for pointing out this deviation from Pythonic style.
  • Function transitiveClosure in generateDS.py was susceptible to infinite looping. This seemed to occur when a substitutionGroup contains a member with the same name as the head of the substitutionGroup (but in a different namespace?).
  • Added a test to stop the recursion when this occurs.

New in generateDS 2.12a (Oct 31, 2013)

  • A name conflict issue caused by naming anonymous types. An anonymous type is a complexType that does not have a name attribute and that is nested inside an element that does not have a type attribute. Strengthened the code that generates new,
  • unique names.And, also fixed a problem or two in the surrounding code.Thanks to Shahaf Abileah for reporting this and for providing test files to reproduce the problem behavior.
  • Created unit test for anonymous types. Added command line option --fix-type-names. This may be useful if there are name conflicts in your XML schema, for example, because
  • the schema refers to two types with the same name but in different namespaces.
  • Ability added to generate one Python module for each XML Schema (.xsd file) imported/included.Added command line options --one-file-per-xsd, --output-directory=, and --module--suffix= in support of this.Thanks much to George David for implementing
  • this new feature.
  • This change provided by Logan Owen. -Return self from build function of generated classes, to allow easy chaining. The main use case for this change is if you have a list of xml documents, and you want to change them into generateDS class instances.

New in generateDS 2.11a (Aug 19, 2013)

  • Added ability to use XML catalog to find included/imported schemas.The -c command line option has been added to support this.Thanks to George David for implementing this enhancement.
  • Added unit test for the catalog capability.
  • Added ability to pick up the target namespace and its prefix, then use them in calling the export functions from the parse functions.
  • Thanks to George David for suggesting this.
  • Several fixes to formatting date and floats during export. Thanks to Domenico Mangieri for catching and fixing these.
  • Added generation of an extra, optional "silence" argument to the parse functions so that export can be turned on or off at runtime.
  • Domenico is the motivator on this one, too.
  • The information about minOccurs and maxOccurs in the generateDS document (generateDS.txt) was misleading or wrong.

New in generateDS 2.10b (Jul 23, 2013)

  • Changed flag for generating getters and setters.
  • Removed flag --use-old-getter-setter.Replaced it with new flag --use-getter-setter, which can have the following values:
  • "old" Name getters/setters getVar()/setVar().
  • "new" Name getters/setters get_var()/set_var().
  • "none" Do not generate getter/setter methods.
  • The default is "new".See the help (use --help option) or see the
  • doc (generateDS.txt/generateDS.html) for more on this.Thanks to
  • Mike Vella for suggesting this.
  • Changed suffix used to prevent name conflicts with Python keywords
  • from "xx" to "_".

New in generateDS 2.9a (Feb 21, 2013)

  • Added support for exporting to an Lxml element tree.The element
  • tree can then be serialized to XML, e.g. using Lxml
  • etree.tostring().This innovation is by Logan Owen, who also did
  • most of the work on it (but I helped some, too).Note that this
  • work is not yet complete; it's still "work in progress"; but it
  • looks very promising.
  • Added --export command line option.This enables the user to
  • selectively generate export methods for any or all of normal
  • export, export to etree (lxml element tree), or export to literal
  • python code.This will enable users to reduce bulk in their
  • generated files when any or all of these are not needed.The
  • default is "write literal", i.e. the normal export methods that we
  • are used to.Use the --help command line option or read the doc
  • for a description of this option.
  • Fixed a bug that occurs when a schema has an attributeGroup
  • referenced with a name that includes a namespace prefix but the
  • attributeGroup is defined with a name that does *not* have the
  • namespace prefix.Thanks to Mike Detecca for reporting this and
  • for nudging me in the right direction when I, initially, made the
  • wrong fix.
  • Added unit test for export to etree.
  • Various fixes to the to_etree (export to Lxml element tree)
  • capability: (1) fix to preserve names that contain special
  • characters (e.g. "-" and "."); (2) fix to preserve the type
  • attribute (xsi:type) for abstract types that whose type is set
  • explicitly.Round turn (XML --> gDS object tree --> lxml element
  • tree --> gDS --> lxml ...) now seems to work reasonably well,
  • although I'm guessing that there are still bits missing (in
  • particular, support for xs:anyAttribute).

New in generateDS 2.8b (Jan 31, 2013)

  • Fixed missing underscore in reference to member names in generateExportLiteralFn_2.
  • Fixed use of NameTable for mapping names when an element has an attribute and a child with the same name. Needed to use correct name (original name or mapped name) when doing (1)
  • fix_dup_names, (2) exportAttributes, and (3) buildAttributes.
  • Fixed gds_parse_datetime so that it will handle fractional seconds.T
  • Created a Mercurial repository for generateDS at Bitbucket: https://bitbucket.org/dkuhlman/generateds

New in generateDS 2.8a (Jan 12, 2013)

  • Fix to process_includes.py so as to remove the limitation on the
  • number of unique names it can generate when raising anonymous
  • types to the top level. Thanks to Daniel Browne for help with
  • this.
  • Added support for multiple level attributeGroup, i.e. for
  • attribute groups that themselves contain references to other
  • attribute groups. Thanks to Harley Green for pointing out the
  • need for this. Also added a unit test for attribute groups.
  • Added support for more date and time simple types, specifically
  • gYear, gYearMonth, gMonth, gMonthDay, and gDay. Thanks to
  • Nicholas Krasney for catching this. Added tests in the unit
  • tests for these types.
  • Quite a bit of code clean-up with the help of the flake8 Python
  • code checker. This is predominantly code cleanup that does not
  • affect behavior, most commonly splitting lines that are longer
  • than 80 characters across multiple lines for readability. (See:
  • http://pypi.python.org/pypi/flake8 for info about the flake8
  • Python code checker. I use it with the Syntastic plugin for the
  • Vim text editor.)
  • Added generation of a dictionary that maps element definition
  • names to generated class names. Thanks to Elena Dolinin for the
  • original work on this one.
  • Added support for xs:date and xs:dateTime. These are now
  • captured as instances of class datetime.datetime from the Python
  • standard library. They are parsed and exported with the help of
  • that class and using methods gds_format_date,
  • gds_format_datetime, gds_parse_date, and gds_parse_datetime in
  • class GeneratedsSuper (which is part of the generated module).
  • Logan Owen did the work on this. Thanks much to Logan for
  • implementing this and contributing this patch.
  • Turned logging off. I did not realize that generateDS.py had
  • been creating a log file (generateDS.log). Logging can be
  • turned back on by modifying the logging calls near the top of
  • generateDS.py.
  • Fixed exception that is thrown when the XML schema file (.xsd)
  • only contains a simple type. Now, the output is generated, but
  • it contains no data representation classes. Thanks to Daniel
  • Browne for catching this.

New in generateDS 2.7a (Nov 5, 2011)

  • Fix for case where a child is defined with a reference (ref="")
  • to a complexType (rather than a simpleType) and the complexType
  • is abstract.
  • Added minimal support for xs:any. See section "Support for
  • xs:any" in the documentation.
  • Added unit test for xs:any.

New in generateDS 2.6b (Oct 14, 2011)

  • Fix for case where a child element is declared with a type that
  • is a simpleType whose restriction base is another simpleType
  • that is referred to with a namespace prefix. With this fix we
  • ignore the prefix, so that at least it will work when there are
  • *not* two different simpleTypes whose qualified names have the
  • same local name (qualified name minus the namespace prefix).
  • Thanks to Thomas Nichols for finding and reporting this one.
  • Added a unit test for the above restriction base with namespace
  • prefix.
  • Added a blank character when needed at the beginning and end of
  • of doc strings inserted in generated classes to protect against
  • the case where the doc string begins or ends with a double quote
  • character.
  • Fixes to various files in the tutorial/Code/ directory and to
  • the text files in the tutorial/ directory in order to make them
  • more consistent and less confusing. Added the individual sample
  • code files to the distribution so that users will not have to
  • find and unzip a zipped archive.
  • Fixes to files in tests/ and to the distribution config
  • (MANIFEST.in) so that the distributed version would pass unit
  • tests. (Please let me know if it does not.)
  • Removed file generatedssuper.py from the distribution. Added
  • notes to the documentation on how to create this module by
  • copying from a generated module for those who want to customize
  • those methods in the common superclass.
  • Fix to django/generatedssuper.py -- Regularized and fixed the
  • names generated in models and forms files.
  • Fix to the code that generates the member_data_item_/MemberSpec_
  • list/dict. If the type of a child element is defined by a
  • reference (ref="") to an element rather than, e.g. a
  • complexType, it was using the child's name not it's type.
  • Added xs:base64Binary and xs:language to the list of string
  • types in generateDS.py and django/generatedssuper.py. Also,
  • xs:anyURI and xs:duration.

New in generateDS 2.5a (Jun 7, 2011)

  • Fix for generation of default value in parameters for the
  • constructors.
  • Fix for lookup of attribute value in generated buildAttributes
  • methods -- Formerly, attribute names having a namespace prefix
  • were not being found.
  • Added some support for xs:group -- Named model groups (model
  • group definitions) are now treated as definitions of blocks of
  • elements to be copied/inserted where referred to. This
  • replacement has been added to the preprocessing done in
  • process_includes.py. So, this is
  • replaced by the contents of ...
  • Fix to generation of calls to validator methods for child
  • elements. Before the fix, the validators were called in
  • buildAttributes methods but not in buildChildren. Also,
  • generation of the validator method (stubs) was also missing in
  • some cases. Thanks to B√©res Botond for alerting me to this.
  • Fixes to generateds_gui.py -- Now it can load a session again.
  • Also a fix to the check for and warnings about the changes to
  • current session on exit.
  • process_includes.py -- Fix for yet another problem with
  • including the same file multiple times when included from
  • differnet directories.

New in generateDS 2.4c (Mar 29, 2011)

  • Added minimal support for unsignedLong, unsignedInt, and
  • unsignedByte.
  • Made the retrieval of the parent (superclass) name and parent
  • object for an element more consistent. Fixed some cases where
  • this was not handled correctly, in particular, the generation of
  • arguments and paramenters for ctors (__init__) was inconsistent
  • and caused errors.
  • Regularized the handling of fromsubclass_ and added this
  • handling to the exportChildren methods. This is used to tell a
  • superclass, during build and export, that the subclass has
  • already performed certain operations.
  • Fix to process_includes.py so as to prevent it from loading
  • schemas multiple times. The check for already_processed was
  • formerly incorrect.
  • Fix related to restrictions on complexType -- Do not generate
  • call buildChildren in the superclass for restrictions (as
  • opposed to extensions) of a complexType. Ditto for
  • exportChildren. Note that restrictions must repeat (and
  • restrict the value of) each sub-element that is to be included
  • in the content of the restriction. See:
  • http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#DerivByRestrict

New in generateDS 2.4b (Feb 22, 2011)

  • Fix to generation the superclass in the class statement header line. Formerly we did not correctly pick-up the superclass name (from extension base="").

New in generateDS 2.4a (Feb 17, 2011)

  • A few fixes to format of some error messages.
  • Clean-up names in the exportableClassList (__all__).
  • Modify reading session object/doc to use lxml instead of
  • minidom.
  • Fix to process_includes.py to protect against crash when an
  • import element is missing a schemaLocation attribute.
  • Fix to parsing and exporting simpleTypes declared as lists
  • ().
  • Added new methods to class GeneratedsSuper to validate (during
  • build) and format (during export) for simpleTypes declared as lists
  • ().
  • Fix for incorrect detection of type during generation of build
  • method.
  • Added first cut at generating Django models and forms.
  • Thanks to Derek Corbett for this suggestion.
  • Added "meta-app" that generates Django database models and
  • Django forms. See doc and files in subdirectory django/.
  • Fix to generation of __all__ list: converted non-word
  • characters to "_" etc
  • Fix to process_includes.py so that it uses the entire path to a
  • file when trying to determine whether it duplicates a previous
  • import. Perhaps this will avoid skipping an import when
  • attempting to import two files with the same name from
  • different directories. Thanks to Mihai Ibanescu for pointing
  • out this fix.

New in generateDS 2.3b (Dec 29, 2010)

  • Fix for simpleTypes defined as a restriction whose (ultimate)
  • base type is a pre-defined simple type which were not generating
  • correct (type-specific) code in build method. Thanks to
  • Noel Merket for finding this problem.
  • Fix for simpleTypes defined as a xs:list with "itemType"
  • attribute where the type was not being recognized.
  • Fix so that we recognize some other simple types as xs:string
  • type (e.g. xs:NMTOKEN, xs:ID, xs:Name).

New in generateDS 2.3a (Dec 3, 2010)

  • Added generatation of code to handle attributes inherited by a
  • restriction from its base type and the types that the base
  • extends (i.e. from a restriction base class and its
  • superclasses).
  • Fix to code that generate the references to the superclass from
  • a type that is an extension: special characters (e.g. dash)
  • were not being cleaned/mapped. Reported by Koen Smets; thanks.

New in generateDS 2.2b (Nov 11, 2010)

  • Added generation of __all__ global variable containing a list
  • of generated class names. This enables you to do a reasonably
  • safe "from mymodule import *. It's sorted, so it also gives
  • you something in the way of an alphabetical table of contents
  • of the generated classes. Thanks to Jaime Cepas for this.
  • Added another fix so that the generated code for mixed content
  • elements will not generate empty blank lines on export. Thanks
  • again to Jaime for this fix.
  • Added patch to sort mixed content in their class containers.
  • Jaime contributed this one too. Thanks again.
  • Added check for endless recursion while collection list of
  • parent type element names. When detected, raises exception
  • that identifies the elements. Thanks to Maximilian Holtzberg
  • for finding this one. One case that can cause this problem is
  • when an element type definition extends a type definition of
  • the same name in a different namespace. Since generateDS.py
  • ignores the namespace, this looks like a type that is extending
  • itself.
  • Modified code generated to process token lists in order to
  • prevent breakage processing some strings.
  • The "Clear" buttons in generateds_gui.py a broken when run with
  • GTK2. generateds_gui.py is still usable, but, if you need to
  • erase the contents of a text field, you will have to do so
  • manually until I can figure out a fix.

New in generateDS 2.2a (Sep 15, 2010)

  • Changes for coding consistency -- Used wrt() pervasively
  • instead of outfile.write().
  • Re-write of process_includes.py -- It now handles
  • xs:include/xs:import elements that include a file from another
  • directory that incude a file relative to that directory that
  • include a file across HTTP, and so on.
  • The command line option --search-path is no longer supported. I
  • don't think that behavior was standard for XML schema anyway.
  • Removed support for search_path from generateDS.py,
  • process_includes.py, and generateds_gui.py.
  • Added support for specifying additional name mappings in a config
  • file: generateds_config.py. That file, if it exists, must be
  • located where it can be imported by generateDS.py and should
  • contain a dictionary named NameTable. For example, the following
  • maps the name "range" to "rangeType" so that if the schema defines
  • a complexType "range", generateDS.py will generate a class named
  • "rangeType":
  • NameTable = {
  • 'range': 'rangeType',
  • See the doc for more on this.
  • Instead of using the lower() function from the string module,
  • added a function to the GeneratedsSuper class and used the string
  • method. Prepares for Python 3.0
  • Added "gds_" prefix to all methods in class GeneratedsSuper to
  • make possible name clashes less likely.
  • Fixes to exporting elements with mixed="true" -- Reduced extra
  • whitespace.
  • Fixes to building (capturing) attribute values for elements with
  • anyAttribute="..." -- Eliminated capture of duplicate attribute
  • values.

New in generateDS 2.1d (Aug 24, 2010)

  • Fix to indentation of generated code in the build method for
  • type checking of NonNegativeIntegerType.
  • Fix to generation parameters in call to superclass constructor.
  • Count of children was incorrect, triggering generation of
  • valueOf_.
  • Known issue -- If type B extends type A, and type A declares
  • anyAttribute, then duplicate attributes with the same name may
  • be produced during export.
  • Known issue -- Some namespaces ("{URI}") are not converted to
  • namespace prefix during export. The needed information is not
  • available during export.

New in generateDS 2.1c (Aug 10, 2010)

  • Fix to functions parse, parseString, and parseLiteral so that
  • they start the build with the correct root class. I believe
  • that there yet is another case that this does not handle,
  • specifically when element name is different from class/type
  • name and the element definition is not the first definition in
  • the schema.
  • Fix to generation of build method for derived elements (i.e.
  • elements with "extension base=". These were being treated as
  • if they were abstract, i.e. 'abstract="true"'.
  • Fix to generation of the call to the superclass constructor in
  • the generated subclass module. Prevented the generation of
  • duplicate arguments.
  • Added a comment to the generated superclass module at the top
  • that specifies the utf-8 source code encoding:
  • # -*- coding: utf-8 -*-

New in generateDS 2.1b (Aug 3, 2010)

  • Fixed error that caused incorrect tag name to be exported
  • when the tag name contains special characters and the tag name is
  • different from the type name.

New in generateDS 2.0b (Jul 2, 2010)

  • Fix to generation of export method so that valueOf_ is exported when childCount == 0 and not isMixed.

New in generateDS 2.0a (Jun 22, 2010)

  • Switched to use of lxml/ElementTree in generated files.
  • Thanks to Biswanath Patel and Jaime Huerta Cepas for
  • encouraging me to implement the switch to lxml/ElementTree.
  • Modified the generation of functions parse(), parseString(),
  • and parseLiteral() so that they automatically recognize the
  • root element of an instance XML document and call the build
  • method of the appropriate class.
  • Fix to hasContent_ method so that so that in elements defined
  • with extension-base, the superclass is checked also.
  • For classes that must call an overridden method m in the
  • superclass, switched to use "super(superclassname, self).m(...)"
  • instead of "m.(self, ...)".
  • Known issues -- (1) generateDS.py loops and crashes with
  • RuntimeError: maximum recursion depth exceeded" on some
  • schemas (for example collada_schema_1_4.xsd). (2) Failure in
  • process_includes.py with import of remote file and nested
  • imports (for example collada_schema_1_5.xsd).

New in generateDS 1.20g (May 22, 2010)

  • Update to documentation -- Added a section on suggested ways to handle/recognize different top level (root) elements.

New in generateDS 1.20f (May 4, 2010)

  • Fix to generation of export so that anyAttribute does not cause
  • duplicate attributes to be exported.
  • Fix so that we do a better job of determining whether a
  • reference to a type is a simple, builtin type in generation of
  • constructor.
  • Fix to generation of constructors so that (1) valueOf_ is
  • initialized in subclass modules and (2) valueOf_ is initialized
  • to None (rather than '').
  • To do: Extend the --root-element flag so that we can specify both
  • the tag name and the element/type name. Sometimes they are
  • different.

New in generateDS 1.20e (Feb 9, 2010)

  • Fixed error that caused incorrect tag name to be exported
  • when the tag name contains special characters and the tag name is
  • different from the type name.
  • Fixed links so that latest versions are included in the install
  • distribution file.

New in generateDS 1.20d (Feb 4, 2010)

  • Updated version number/info in genereateds_gui.py.
  • Fix to process_includes.py -- Handle include elements and
  • import elements in the same way. In particular, allow both to
  • reference schema files on either the local file system or
  • remotely across the Net (via ftp or http).
  • Fix to generation of properties -- When the name of a member is
  • mapped (e.g. a Python language keyword), wrong name for getter
  • and setter was used.
  • Fix to generation of export methods: missing encoding.
  • Fix to selection of type for exportLiteral.
  • Added missing files in the tests/ directory to the distribution.

New in generateDS 1.16c (Mar 21, 2009)

  • One more fix for abstract types -- When the implementation element/class for an abstract class exports itself, it adds the xsi:type="class_name" attribute.
  • A minor fix to handling namespace prefix and the -a command line option.
  • Additional fixes so that in constructors (__init__), all instance variables are initialized to None.
  • Some fixes to quoting and escaping quotes when exporting attribute values. Thanks to Kerim Mansour for help with this.

New in generateDS 1.16a (Feb 28, 2009)

  • Generated export methods now check for empty content and write out rather than if empty.
  • All generated constructors (__init__()) now initialize instance variables to None.
  • Generated export methods now check for None before attempting to write out attributes and children.
  • More consistent use of direct access to instance variables rather than calling getter methods with a class, that is use of self.xxx rather than self.get_xxx().

New in generateDS 1.15d (Jan 23, 2009)

  • Fix to setup.py so that it also installs process_includes.py.
  • Enhancements to process_includes.py so that it can also retrieve included files via ftp and http.
  • Fixes for default values for attributes.
  • The above changes are all from Arne Grimstrup.