Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:27:58+00:00 2026-06-02T22:27:58+00:00

So I was parsing my xml with this code and all worked fine untill

  • 0

So I was parsing my xml with this code and all worked fine untill i added a review node.

$(document).ready(function generatexml(){
$.ajax({
                type: "GET",
                url: "data/concerts.xml",
                dataType: "xml",
                success: function(xml){
                $(xml).find("concert").each(function(){
                $('#concerten').append('<div id="tabel" onclick="navigate('+"'"+$(this).find('artist').text()+"'"+')"><div id="tabelimage"><img src="http://griekenland.mixxt.at/storage/images/events/0/0/0/00000000000000000000000000000.jpg"/></div>'
                +'<div id="tabelartist">'+$(this).find('artist').text()+'</div>'
                +'<div id="tabellocation">'+$(this).find('location').text()+'</div>'
                +'<div id="tabelqs">'+$(this).find('review').text()+'</div>'
                +'<div id="tabeldate">'+$(this).find('date').text()+'</div>'
                +'<div id="tabelurl"><a href="'+$(this).find('url').text()+'">'+$(this).find('url').text()+'</a></div>').trigger('create');             
                })
                }
                })
})

The xml is like this:

<?xml version="1.0"?>
<concerts>
<concert>
<artist>Sioen</artist>
<location>De Zwerver leffinge</location>
<date>24/03/2012</date>
<review>Met die woorden, op zelf getekende en verspreide flyers, riep Willis Earl Beal iedereen op hem te bellen om hem één van z’n liedjes te horen zingen</review>
<url>http://www.test.be</url>
</concert>
<concert>
<artist>Sioen</artist>
<location>De Zwerver leffinge</location>
<date>24/03/2012</date>
<review>Met die woorden, op zelf getekende en verspreide flyers, riep Willis Earl Beal iedereen op hem te bellen om hem één van z’n liedjes te horen zingen</review>
<url>http://www.test.be</url>
</concert>
</concerts>

I cannot figure out the reason why it won’t parse, i have ran it trough an xml validator and there are no js errors in firebug. Is it possible that the text inside my node is to long (just a hunch) and how do i counter this?

Any help is welcome,
Tyvm

Toon Van Dooren

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:28:01+00:00Added an answer on June 2, 2026 at 10:28 pm

    Not a direct answer to your particular issue but I think it could be useful.

    I think you should consider using some template engine here. Here is why:

    • Forces you to prepare/parse your data before rendering
    • Allows you to unit test every single part independently
    • Improves code readability and maintainability
    • Easier to update later (for example if you decide to return JSON instead of XML in your AJAX request)

    Please consider the following example on JSBin based on your code (and using Mustache template engine but you can find many other engines).

    Some details bellow:

    1- define your template

    <script id="concertsTpl" type="text/x-custom-tpl">
    {{#concerts}}
      <div id="tabel" onclick="navigate('{{artist}}')">
        <div id="tabelimage">
          <img src="http://griekenland.mixxt.at/storage/images/events/0/0/0/00000000000000000000000000000.jpg">
        </div>
        <div id="tabelartist">{{artist}}</div>
        <div id="tabellocation">{{location}}</div>
        <div id="tabelqs">{{review}}</div>
        <div id="tabeldate">{{date}}</div>
        <div id="tabelurl">
          <a href="{{url}}">{{url}}</a>
        </div>
      </div>
    {{/concerts}}
    </script>
    

    2- define a function to parse your data

    function parseConcertsData(data) {
      var concerts = [];
    
      $(data).find("concert").each(function(){
        var concert = {
            artist: $(this).find('artist').text(),
          location: $(this).find('location').text(),
            review: $(this).find('review').text(),
              date: $(this).find('date').text(),
               url: $(this).find('url').text()
        };
        concerts.push(concert);
      });
      return {concerts: concerts};
    }
    

    3- send the request and process the result

    var jqXhr = $.ajax({
          type: 'get',
           url: "data/concerts.xml",
      dataType: 'xml'
    });
    
    jqXhr.done(function(xml){
    
      var concerts = parseConcertsData(xml),
          tpl = $('#concertsTpl').html(),
          rendered = Mustache.to_html(tpl, concerts);
    
      $('#concerten').append( rendered ).trigger('create');
    
    }).fail(function(){
      alert('Something went wrong with the query');
    });
    

    With this kind of refactoring, you should be able to find the problem easily:

    • Do you receive a response from your query?
    • Do you get the expected data (ie: Is the response parsed correctly)?
    • Is the template rendering OK?
    • Is the rendered template appended to the document?

    Hope it helps.


    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all i am new to XML parsing on VB.net. This is the code
I tried parsing this huge XML document using XML minidom . While it worked
Hi at all I want to parsing a date from XML with this format:
I am using this code to parsing xml DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db
I am parsing this xml <Root><Status>1</Status><Message>Get call Successful</Message><StatusCode></StatusCode><Item type = 'all' subtype = '0'
this is my first time using StAX for parsing XML documents (still in the
I am parsing data from this XML url The text input varies, depending on
When parsing an xml file in android, I'm doing like this: try { InputStream
I got a string from parsing a XML file which looks like this: Fri,
I have student.xml file and am parsing this file using SAX Parser and now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.