I parse data using JSON in javascript, I find this is very convenient. But when I using XML, I need to look down every nodes. It seems that the XML is more complex. Is there any Javascript for erase some plain on creating and reading xml document? plx recommend.
Javascript can handle XML, it is just that JSON is in a native javascript format, but if you look at this tutorial it may help you understand how to use XML in javascript, without using a library: http://www.captain.at/howto-ajax-process-xml.php
How about jQuery? I feel very comfortable manipulating and processing both html and xml data. Take a look at the following to give a hint on how it will be processing xml using jquery.
- http://marcgrabanski.com/article/jquery-makes-parsing-xml-easy
- http://think2loud.com/reading-xml-with-jquery/
- http://www.webmonkey.com/tutorial/Easy_XML_Consumption_using_jQuery?oldid=20032
In case you want to know, jQuery is good at easing your life with JSON too, you may take a look at the getJSON
function to know more about it.
I have to throw in a plug for MooTools. Like jQuery, it greatly simplifies working with the DOM, and offers a great, very simple AJAX and JSON API as well.
Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. It offers various XML related goodies like Document instantiation, XML loading from URLs or strings, XSLT transformations, XPath queries etc and comes especially handy for people doing what is lately known as "AJAX" development.
I recommend JKL ParseXML It's a lightweight single-purpose library and works very well.