There is a new version of generateDS.py etc -- version 2.4a. Here are a few notes and details from the README:
# ========================================================= Version 2.4a (02/16/2010) * 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 (<xs:list>). * Added new methods to class GeneratedsSuper to validate (during build) and format (during export) for simpleTypes declared as lists (<xs:list>). * 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 subdirectorydjango/. * 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 MihaiIbanescu for pointing out this fix. # ========================================================= Validating data ================= There are new validating methods in GeneratedsSuper, the class that is generated near the top of files generated with the -o command line option. Some of these methods are used to validate character content during the build process and are called by method buildChildren. Some of those new methods actually do some checking, and some of them just pass through data with no checking or modification. If you want to add code that does customized validation, you can override these methods. There is more on this in the doc in the section titled "Overridable methods". The validate methods are passed an argument "node". If the path to that node is of use to determine how to validate the data at that node *and* you are using lxml, then consider using the get_path method, which is also in the generated superclass. Generating Django models and forms ==================================== The added files that can be used to generate Django model.py and form.py files are very experimental. Or, maybe they're just for fun. The ability to model an XML schema in a relational database using an ORM (object-relational mapper) may be one of those ideas that seem interesting on the surface but is not of practical use. My belief is that you'd need the ability to import and export XML instance documents to and from the relational DB before it would become useful. And, I suspect that that large XML documents would occupy lots of space when stored in a relational DB. For those of you who feel a need for the query-like capabilities that an RDB would give you but want to handle XML data, take a look at the xpath capability provided by lxml. As for doing inserts ... hmmm, maybe there is a need for something like this. By the way, the files that implement this capability may also be interesting because the same technique could be used to perform other, similar code generation tasks. Basically, this approach is to add a (class) method to the common super-class (in django/generatedssuper.py), then use the generated list __all__ to visit each generated class and call this method. You can find it in the usual places: - Python Package Index -- http://pypi.python.org/pypi/generateDS/ - Source Forge -- http://sourceforge.net/projects/generateds/ - My Web site -- http://www.rexx.com/~dkuhlman/generateDS-2.4a.tar.gz If you have comments, suggestions, or problems, please send them along. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ generateds-users mailing list generateds-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/generateds-users