I'll second the JSON suggestion. Assuming from your XML code example
that you're only ever going to have day/show nodes, here's the JSON:

{
  'Monday' : [
    { time : "0800-1000", dj : "mc funk", name : "nonstop music" },
    { time : "1000-1200", dj : "mc rap", name : "nonstop music" }
  ],
  'Tuesday' : [
    { time : "0800-1000", dj : "mc stoner", name : "nonstop music" },
    { time : "1000-1200", dj : "mc ambient", name : "nonstop music" }
  ]
}

The Javascript code looks like
$(function() {
  $.ajax({
    url:'test.php',
    dataType:'json',
    success:function(schedule) {
      for (var day in schedule) {
        $('body').append('<h3>' + day + '</h3>');
        for (var i = 0; i < schedule[day].length; i++) {
          var s = schedule[day][i];
          $('body').append('<p>' + s.time + '<br />' + s.dj + '<br />'
+ s.name + '</p>');
        }
      }
    },
    error:function(r,t,e) { alert(t); }
  });
});

Hope that helps .. JSON is about as lightweight as it gets.

-Wick
http://www.CarComplaints.com


On May 18, 3:21 am, Josh Powell <seas...@gmail.com> wrote:
> If you aren't forced to use XML, look at trying JSON instead.  It is a
> MUCH friendlier format for passing information around.
>

Reply via email to