[XML-SIG] Converting XML Schema to data struture and then to XML

Stefan Behnel stefan_ml at behnel.de
Mon Jan 28 12:03:13 CET 2008


Hi,

Good Z wrote:
> Ok. My requirement is as follows: We have a third party PDF form with
> following input and output supplied by the vendor and used as below: 
> Input:Raw data that needs to be filled in ADOBE form through keyboard. 
> Output: Once the form is filled, the form has a buttons to generate XML
> file for the data and save it on harddisk.
> 
> There are many thousand users of this form and based on the input different
> xml are generated. They have also provided us schema so that we can
> generate XML and verify the XML against that.
> 
> Our software is accepting input from the web and thus has all data. We
> would like to generate the XML tree structure using schema and then use the
> data values entered by the user and then generate XML file.

Ok, so you're generating an XML tree in memory, filling in data, and
validating on the way out. Maybe this is of interest then:

http://codespeak.net/lxml/dev/objectify.html#tree-generation-with-the-e-factory

Note that lxml does support XML Schema *validation*, it just doesn't care
about the schema while you are working on the tree, and it does not generate
Python code from it. It's dynamic, not static.

BTW, from the POV of objectify, generating Python classes from a schema would
basically mean infering a document instance from an XML Schema (sort of a
meta-model to model transformation). I find that an interesting relation, but
maybe that's just me...

Stefan


More information about the XML-SIG mailing list