Reading Xml with JQuery

Posted by

Image credit: >

Reading Xml with JQuery

Reading Xml with JQuery is an easier approach if we have interest on the usage of client-side script as this script does not post back the whole page to the server and hence, speed the network performance.
What we have to do is to refer or download latest jquery library.
The same approach can also be obtained using server side script such as c#,java,php. But as far as the power of javascript is concerned, it works on client browser, unloading unnecessary burden of web server round trips.

Did you realize that you can utilize jquery’s quick and compelling DOM traversal and control strategies to process any XML record? This capacity, consolidated with jquery’s capacity to effectively stack XML documents utilizing Ajax, makes this Javascript library an extraordinary decision for building element, XML-based UI applications. Along the way, you get a review of DOM preparing in the program and find how helpful jquery’s routines can demonstrate when you parse XML. The post, likewise,traces the essential steps in the advancement of a non specific, program based live XML editorial manager utilizing the secured strategies.
Lets see some examples:

Our XML file

<?xml version=”1.0″ encoding=”utf-8″?>
<Booklist >
<Book isbn=”1111″ title=”HarryPotter” />
<Book isbn=”2222″ title=”HarryPotter2″ />

$.ajax({ type: “GET”, url: “Booksinlist.xml”, dataType: “xml”, success: function(xml)
{ $(this).find(‘Book’).each(function()
{ var name = $(this).attr(‘Book’); $(‘



‘).appendTo(‘#page-wrap’); }); }); }, error:function(a,b,c) { console.log( c ) } });

Facebook Comments

Syed Adeel Ahmed
Analyst, Programmer, Educationist and Blogger at Technofranchise
Computer Systems Engineer from Sir Syed University Of Engineering & Technology.I am passionate about all types of programming.
Syed Adeel Ahmed on FacebookSyed Adeel Ahmed on GoogleSyed Adeel Ahmed on InstagramSyed Adeel Ahmed on Twitter