News: Bridge the gap between XML and Ajax with JSON
- Posted by: Frank Charles
- Posted on: September 15 2006 08:29 EDT
- Re: Bridge the gap between XML and Ajax with JSON by Ilya Sterin on September 15 2006 14:25 EDT
- JSON+POJO+CASTOR+AJAX - A Good Mixture by elango maragatham on September 16 2006 07:49 EDT
- Re: Bridge the gap between XML and Ajax with JSON by Race Condition on September 16 2006 16:59 EDT
- JSON/DOJO/POJO by Rociel Buico on September 18 2006 04:00 EDT
JSON is the only viable tranfer mechanism is you intend to create browser independant 'AJAX' applications as Safari does not provide XPath or XSL support in their browser making it very difficult to do any practical rich client development. If you are only looking to support IE and Mozilla based browsers then XML is a fine choice for data transfer. However, you still face some other issues, and this depends on how rich your applications actually are. XML documents have limitiations (especially within the browser), you can't make references from one document to another (i.e. object references) this means you need one large monolithic document to store all the model data. It also means you need to do things like store id's in sections of the document in order to create references to other sections of the document. Once you have done this you then need very cumbersom XPath statements to refer to to elements that are indexed in this way. JSON maps directly to JS objects, this allows you to do all kinds of useful things like be able to make direct references to sub-graphs with standard JS variables, have many root objects that can still be refered to and can refer to each other. This makes developing applications much easier. Also the evaluation of JSON -> JS Object and visa versa is a very light weight process reducing the cost of communication processing. JSON does have issues, the non-cyclic graph requirement is unfortunate. Mozilla browsers can get past this using a simple referencing mechanism allowing for the serialisation and de-serialisation of cyclic graphs, but IE does not support this behaviour, thus it is not worth pursuing (Since one of the reasons for using JSON is better browser portability).
Agree, the eval and native object graph representation is a + from JSON. It's basically a serialized js object. Whether JS is really an OO language is another question:-) The support of XSL/XPath in non-(IE|Firefox) browsers is not an issue any more with Google's XSLT/XPath library, which is completely cross-browser. It's not as efficient as the native browser XSLT/XPath support, but I believe if use correctly can yield great results. Google apps like Google Maps, etc... use it extensively. Ilya Sterin
Recently we have deloped a project using AJAX and used the above technology for the Presenstion layer.It works quite well. Until the POJO we use the traditional patterns we keep the POJO as flat as possible and use Castor to convert that into XML then using JSON to convert the same in JSObject to be able to use in the view layer.We have no problem with browser (IE & Firefox) to paint the content. Elango Senior Systems Analyst
Has anyone tried Flex/Open Lazlo option? We are trying flex. We did look into Ajax/Json solutions but tried flex due to out of the box features - developer productvity and browser compatibility. We spent a lot of time making app work with IE, firefox (easy part) and Safari (very diff from the rest).Its nice to get over the browser compatibilitty issues for ever since its Flash and some data comes client side reducing network traffic. Overall looking pretty good so far.
A couple of years ago, many developers bet their futures on XML, XSLT, Extensible HTML (XHTML), and a host of tag-based "X" languages...Bet their futures? That's a pretty strong statement.
very nice combo