Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38907

Re: Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc

From dieter <dieter@handshake.de>
Subject Re: Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc
Date 2013-02-15 08:34 +0100
References <3fcc6105-3b6a-4077-87a0-50732795df58@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.1798.1360913656.2939.python-list@python.org> (permalink)

Show all headers | View raw


Acácio Centeno <acaciocenteno@gmail.com> writes:

> 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 am 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 would 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.

You could have a look at the PyPI packages "dm.zope.rpc"
and "dm.zope.rpc.wsdl_suds". They provide a middleware
to support protocol independent web services (for the
"Zope" application server). Together, they support
XML-RPC, JSON-RPC and WSDL decribed SOAP web services.
As you are likely not using Zope, you probably cannot use
these packages directly but you may get some ideas how
to create such a middleware for your web framework.

Python (from 2.6 on) has "json" support. Thus converting
a dict to "json" is simple ("json.dumps").

"dm.zope.rpc.wsdl_suds" abuses "suds" to parse the WSDL
and generate appropriate SOAP responses from a dict.
Alternatively, you might use "PyXB" for that.

You could also have a look at "Spyne" (formerly known (among others)
as "rpclib"). I think (but am not sure) that it targets
your use case for the "twisted" environment.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc Acácio Centeno <acaciocenteno@gmail.com> - 2013-02-14 13:08 -0800
  Re: Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc dieter <dieter@handshake.de> - 2013-02-15 08:34 +0100

csiph-web