Re: [XML-SIG] Converting XML Schema to data struture and then to XML
Stefan Behnel <[email protected]> Mon, 28 Jan 2008 11:28:04 +0100
| Newsgroups | gmane.comp.python.lxml.devel,gmane.comp.python.xml |
|---|---|
| Message-ID | <[email protected]> |
Hi, Stefan Behnel wrote: > Good Z wrote: >>>> I need to write an application to convert XML schema (.xsd) to a data >>>> structure then using this data structure and the data from some other >>>> files, generate an XML file. >>>> >>>> I have seen generateDS and pyfo library that can be combined to write >>> this >>>> application but my problem is that i somehow do not like DOM and >>> would like >>>> to write this in ElementTree. I wonder if anyone can point me how to >>>> write >>>> this quickly in ElementTree or someone has already done this effort. >> In case you can do without the schema, lxml.objectify might be worth a >> look: >> >> http://codespeak.net/lxml/dev/objectify.html >> >> Thanks Stefan, >> >> But my primary requirement is converting XML Schema. > > Sure, no problem. But may I ask what the reasoning behind this requirement is? > I mean, code generation isn't really a value by itself. Just in case you're interested (and since similar topics have come up a couple of times on lxml's mailing list), I added a doc section on parse-time schema validation in lxml 2.0 here: http://codespeak.net/svn/lxml/trunk/doc/objectify.txt Look out for section 2, "Asserting a Schema". It's not yet included in the online docs at http://codespeak.net/lxml/dev/objectify.html but it will appear there by the end of the week. Stefan