Click to See Complete Forum and Search --> : Loading data from XML


Lotus
05-01-2004, 06:12 AM
Hello, I'm doing this site, where I'm developing this picture rating system. Now I have 5 <span> fields in a HTML document, that have ids from "pos1" to "pos5". I want to code something that makes the contents of those <span> fields load from an XML file, that looks something like this:

<root>
<top>
<pos1>First place</pos1>
<pos2>Second place</pos2>
<pos3>Third place</pos3>
<pos4>Fourth place</pos4>
<pos5>Fifth place</pos5>
</top>
</root>

What do I need to make this happen? Thx in advance for any input :)

Khalid Ali
05-01-2004, 03:05 PM
there may be 3 possible actions you can take
1.
Use XSL/XSLT to read the XML file and create appropriate HTML and display this may be done by some XSL/XSLT processor(such as xalan)

2.
Directly load the XML file in browser and apply XSL/XSLT to it to display appropriate HTML

3.
Read XML file in browser using
XMLHttpReqest object and parse the XML file and create appropriate HTML in the webpage...

You may find examples for items 2 and 3
at this link (http://www.webapplikations.com/pages/html_js/xml_js.html?menu_id=Web_sub)