[XML-SIG] An 'XMLic' binding for Python objects
fz.3 at arcor.de
Fri Dec 16 08:54:22 CET 2005
Looking at Uche Ogbuji?s Amara and David Mertz? Gnosis Objectify, I was impressed by their simple 'pythonic' bindings ? the network of Python objects generated from an XML document reflect the document's (schema's) object model, rather than impose a fixed (meta)model on the data, the way DOM does. Dave Kuhlman's generateDS does something similar, but starts with an XML Schema rather than an instance document.
These approaches presuppose the existence of XML data (or of an XML Schema in the case of generateDS).
I need to go the opposite direction, however: I have a network of Python objects and need to generate XML from it. In the past, I have simply persisted my object network using pickle. This was sufficient until our customer discovered the need to generate reports from this data using (non-python) XML tools, so the idea was born to persist the data as XML document(s).
Xml_pickle immediately sprang to mind . The problem is that it generates the XML according to a fixed (meta)DTD, like the DOM approach in reverse. What we really need is a more 'XMLic' approach ;-), i.e. an XML that reflects the object model of our Python object network. Ideally, this approach should also supply the DTD/XSD/RelaxNG schema (our customer favours XML Schema).
What would be the best way to go about it? Is there any alternative to xml_pickle that is more 'XMLic'?
AFAIK there are tools that can infer the schema from an instance document, which could be a way of satisfying the second requirement, once we have succeeded in dumping an XML instance document.
I should also mention that our Python classes are modelled in UML using Enterprise Architect from Sparx Systems. This tool has the capability of generating XSD for a model. The XSD that it generates for our model would require quite a lot of post-editing, however.
Thanks a lot in advance
Machen Sie aus 14 Cent spielend bis zu 100 Euro!
Die neue Gaming-Area von Arcor - über 50 Onlinespiele im Angebot.
More information about the XML-SIG