There is a update to generateDS.py at the online repository:

    https://bitbucket.org/dkuhlman/generateds

This version contains several fixes as well as an important new
feature.  What's new is the generateDS.py now generates code that
validates the data defined by xs:simpleType.  It does this by
looking at the restrictions in a simpleType and generating code that
checks data to determine whether it satisfies those restrictions.
The generated code then prints out warnings (using the warning
module in the Python standard library), when restrictions are not
satisfied.  It even handles restrictions from a simpleType that is
defined with a base simpleType that has restrictions.  I believe
(hope?) that I have the logic in all such cases correct.

This new version handles all my tests.  And, I also threw a number
of schemas (large and small) at it to make sure that it would
generate code without throwing an exception and to ensure that the
resulting code could be imported without errors by Python.

However, there is quite a bit of new code.  I certainly
recommend that you try it to take advantage of the fixes and new
features.  *But*, hang on to your old version just in case.

In order to implement features like this, I've used the xpath
capability in lxml.  So, now, installation of lxml is a requirement
for running generateDS.py, although I'm pretty sure that it would
not work without lxml previously either.

Please let me know when you have comments or problems.

Below is a description of what's new from the README.

Dave

# =========================================================
Version 2.14a (11/04/2014)
- Fixed export of simpleType lists (added "' '.join(data)".  Thanks
  to Per Rosengren for catching this.
- Added new style validation of simpleType data.  Validation
  requirements are captured from the XML schema definition of the
  simpleType, e.g. 'restriction base="..."' etc.  Thanks to
  azer gh for implementing much of this extended capability.
- Added unit test for simpleType validation, including test for
  proper detection of bad (invalid) data.
- Did some code cleanup with the help of the flake8 code checker.
- Added a fix so that attribute declarations that use ref= rather
  than type= will also be generated with the specific type.  Thanks
  to Florian Wilmshoever for catching and reporting this and for
  providing an XML schema as a test case.
- Added unit test for reference to simpleType.
- Fix to generation of names of substitutionGroup.  The namespace
  prefix was not being stripped in some cases.
# =========================================================
-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to