[XML-SIG] ANN: User methods for generateDS.py

Dave Kuhlman dkuhlman at rexx.com
Tue May 15 20:40:12 CEST 2007

User Methods

generateDS.py now has the ability to add user methods to the
classes it generates.

The user provides definitions (source) for the methods to be added
and (for each method) a regular expression to identify the names
of classes to which the method should be added.  Then, the
--user-methods command line flag is used to instruct generateDS.py
to add the specified methods to the classes generated in the
superclass file.

A class variable (_member_data_items) providing information about
the member data items of each generated class has also been added.

There is a sample file (gends_user_methods.py in the distribution)
that provides examples of:

- walking the document object tree,
- accessing member data items using the _member_data_items class
- getting and setting the values of member data items, and
- determining the type of member data items.

You can read more about this capability in the "User Methods"
section of the documentation:


You can find the latest version here:


and at Source Forge:


If you consider using this new user methods capability, also think
about the ability to generate subclasses of generated classes
using the -s command line flag and then manually adding methods to
those generated subclasses.  In some situation, this might be a
better solution.

To find out more about generateDS.py, read this:



Dave Kuhlman

More information about the XML-SIG mailing list