public
Description: Tools that allow client-side XML calls in the browser. Using Flash crossdomain calls, the XML is converted to JSONML and delivered in JavaScript
Homepage:
Clone URL: git://github.com/dominiek/xml-to-json-proxy.git
name age message
file README Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
directory com/ Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
file xml_json_proxy.fla Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
file xml_json_proxy.html Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
file xml_json_proxy.js Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
file xml_json_proxy.swf Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
directory xmltojson/ Thu Jan 01 08:10:44 -0800 2009 Initial commit [dominiek]
README
= XML to JSON Proxy =

Tools that allow client-side XML calls in the browser. Using Flash crossdomain calls, the XML is converted to JSONML and 
delivered in JavaScript.

== When to use? ==

you want to do a simple light integration, but the API your using only supports XML calls or JSON calls without 
callbacks. An example service at the moment of writing is Imeem.com. To work around doing browser-client-side calls, we 
can use a Flash/SWF proxy (written in ActionScript 3) that does the XML call and delivers it in JSONML format 
(http://jsonml.org/) to a Javascript callback.

Note: this was originally written for Last.fm - which at the time didn't have JSON callback support in their API, now 
they do.

== Example code ==

Check xml_json_proxy.html for an example of how to use this with Imeem.

Setting up the proxy:

<script type="text/javascript" src="xml_json_proxy.js"></script>
<script type="text/javascript">
  function callback_on_error(code, message) {
    alert(code + ': '+ message);
  }
  function callback_on_success(url, jsonml) {
    alert(jsonml);
  }
  proxy = new XMLJSONProxy('error_callback');
</script>

Performing a GET call (POST support is yet to come):

proxy.get('callback_on_success', 'http://url.of.call.xml/');

== License ==

All is Creative Commons attributed to Dominiek ter Heide (http://dominiek.com/)