Click here to Skip to main content
15,034,331 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i parse a xml file with jquery and display the result using a html page.?
gaurish thakkar 3-Jul-12 7:57am
I want to work in offline mode
How come you fail to see the parser in jQuery, which could be found in seconds? How come you formally accepted quite bad Solution 2? Right one is Solution 1.

please check this link it will help you i hope
Somebody voted "5" for Solution 2 (srnr), which is nothing good, and "3" for this solution. This is wrong, even stupid. I vote "5" for this one.
kimberly wind 4-Jul-12 0:40am
Thanks for supporting good answer
Sample XML file

<?xml version="1.0" encoding="utf-8" ?>
    <Title>My Cool Book Title</Title>
    <Description>The my cool book is possibly the best cool book in that any developer could use to be a great web designer.</Description>
    <Title>Another PHP book</Title>
    <Description>Learn everything about PHP with 'Another PHP book,' your ultimate guide to the ins and outs of PHP.</Description>
    <Title>jQuery Techniques</Title>
    <Description>jQuery techniques runs you through real life examples of jQuery from beginner to expert</Description>
    <Title>MySQL Database Book</Title>
    <Description>Brush up your knowledge with the best MySQL database book on the market.</Description>

Java Script
$(document).ready(function () {
        type: "GET",
        url: "books.xml",
        dataType: "xml",
        success: xmlParser
function xmlParser(xml) {
    $(xml).find("Book").each(function () {
        $(".main").append('<div class="book"><div class="title">' + $(this).find("Title").text() + '</div><div class="description">' + $(this).find("Description").text() + '</div><div class="date">Published ' + $(this).find("Date").text() + '</div></div>');

<div class="main">
<div align="center" class="loader"><img src="loader.gif" id="load" width="16" height="11" align="absmiddle"/></div>

<div class="clear"></div>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900