I am currently trying to parse and xml file that is of the following format:
<holidays> <holiday1> text </holiday1> <holiday2> text </holiday2> <holiday3> text </holiday3> <holiday4> text </holiday4> ... with the following code:
$.ajax({ url: '<filename>', dataType: 'xml', success: xmlParser }); function xmlParser(xml) { $('#load').fadeOut(); $(xml).contents().each(function () { $("#holidates").append('<p>' + $(this).text() + '</p>'); }); $(".dates").fadeIn(2000); } The current output is:
<p>01/13/2016 02/02/2016 12/24/2015 12/24/2015 12/24/2015 12/29/2015 12/30/2015 11/23/2015 01/01/2016 01/26/2016 12/25/2015</p> I would prefer:
<p>01/13/2016</p> <p>02/02/2016</p> <p>12/24/2015</p> .... Is there a way to achieve his without formatting the xml file? The file is part of another system and is required in the indicated format.
Many thanks.
No comments:
Post a Comment