tags:

views:

27

answers:

1

Hey guys, hoping I might get some help. Have XML file here of a list of books each with unique id and numeral value for whether they are checked out or not. I need a JavaScript snippet that requests the XML file after the page loads and displays the content of the XML file.

XML file looks like this:

    <?xml version="1.0" encoding="UTF-8" ?>
    <response>
      <library name="My Library">
        <book id="1" checked-out="1">
          <authors>
            <author>John Resig</author>
          </authors>
          <title>Pro JavaScript Techniques (Pro)</title>
          <isbn-10>1590597273</isbn-10>
        </book>
        <book id="2" checked-out="0">
          <authors>
            <author>Erich Gamma</author>
            <author>Richard Helm</author>
            <author>Ralph Johnson</author>
            <author>John M. Vlissides</author>
          </authors>
          <title>Design Patterns: Elements of Reusable Object-Oriented Software</title>
          <isbn-10>0201633612</isbn-10>
        </book>
        ...
      </library>
    </response>

Would LOVE any and all help!

A: 

It all depends on how complex you want the result to be. If you want to create a sortable table from that XML file and you like YUI, there's a YUI2 widget that works wonders for that. Here's an example: http://developer.yahoo.com/yui/examples/datatable/dt_xhrpostxml.html

juandopazo
I just want a simple dump of the XML styled according to some basic css and markup.
Fuego DeBassi