On 10/23/14 13:43, Holger Joukl wrote:
So you'd need to (re-) implement XML Schema capabilities to do anything with the Schema information, i.e. adding/enforcing type information, generating structure or whatnot.
FYI, most of such stuff related is implemented here and there inside Spyne. Here's the xml schema parser: https://github.com/arskom/spyne/blob/master/spyne/interface/xml_schema/parse... It deserializes the schema according to the schema definition in https://github.com/arskom/spyne/blob/master/spyne/interface/xml_schema/defn.... and creates Python classes from object definitions found in the schema. The code imitates libxml's own schema parser up to a point -- I wrote the python code with the libxml's C code open side-by-side. Enforcing schema rules on incoming Xml documents are supported maybe since 2009 or something. Here's a stackoverflow answer that solves a given problem using both spyne and lxml.objectify. http://stackoverflow.com/questions/19545067/python-joining-and-writing-xml-e... And here's how all this is supposed to be used together: https://github.com/arskom/spyne/blob/master/examples/xml/schema.py The missing bit is xsd => python compiler. I started implementing it but figured it was a bit pointless and stopped working on it. Here's what's done so far: https://github.com/arskom/spyne/blob/master/spyne/interface/xml_schema/genpy... Best, Burak