Hi, I've searched both this group and the web but was unable to find an answer, sorry if it has already been answered, it seems such a common problem that I’m sure someone has asked before.
We have a WebServices platform that must reply in XML, JSON, or JSONP. Having to convert between these formats is a really pain in the neck. What I’d like to do is, given some schema representation, that could be a DTD, XSD or whatever and a python dictionary with the values for each node, generate the output in either XML, JSON or JSONP. For instance, if the XSD would be: <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Foo"></xs:element> <xs:element name="Baz"></xs:element> <xs:element name="Choice" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="A" /> <xs:enumeration value="B" /> <xs:enumeration value="C" /> <xs:enumeration value="D" /> </xs:restriction> </xs:simpleType> </xs:element> </xs:schema> And given the following dict: { “foo”: “bar”, “hello”: “world”, “choice”: “B”, “callback”: “process_server_reply” } Be able to generate either this XML: <xml> <Foo>Bar</Foo> <Hello>World</Hello> <Choice>B</Choice> </xml> Or this JSON: { "foo": "bar", "hello": "world", "choice": "B" } Or this JSONP: process_server_reply({"foo": "bar","hello": "world","choice": "B"}); Which library/technique would you guys recommend for this kind of scenario? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list