B
bissatch
Hi,
I am about to create a table, where the values are taken from an XML
file, where each column header you can click and it will sort the table
rows at the client side.
I have got to the following stage:
//first the xml file loading part
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function loadXML (xmlFile) {
xmldoc.load(xmlfile);
friends = xmldoc.documentElement;
}
loadXML ('friends.xml');
friends = friends.childNodes;
Below is a look at the XML file, friends.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<friends>
<person>
<firstname>Martin</firstname>
<surname>Bishop</surname>
<age>24</age>
</person>
<person>
<firstname>Robert</firstname>
<surname>Kennedy</surname>
<age>18</age>
</person>
<person>
<firstname>Nigel</firstname>
<surname>MacInnes</surname>
<age>23</age>
</person>
</friends>
Before I output the values of each node
(friends.childNodes[0].childNodes[0].text etc.), is it possible to
arrange / sort them by either firstname, surname or age?
Cheers
Burnsy
I am about to create a table, where the values are taken from an XML
file, where each column header you can click and it will sort the table
rows at the client side.
I have got to the following stage:
//first the xml file loading part
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
function loadXML (xmlFile) {
xmldoc.load(xmlfile);
friends = xmldoc.documentElement;
}
loadXML ('friends.xml');
friends = friends.childNodes;
Below is a look at the XML file, friends.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<friends>
<person>
<firstname>Martin</firstname>
<surname>Bishop</surname>
<age>24</age>
</person>
<person>
<firstname>Robert</firstname>
<surname>Kennedy</surname>
<age>18</age>
</person>
<person>
<firstname>Nigel</firstname>
<surname>MacInnes</surname>
<age>23</age>
</person>
</friends>
Before I output the values of each node
(friends.childNodes[0].childNodes[0].text etc.), is it possible to
arrange / sort them by either firstname, surname or age?
Cheers
Burnsy