P
pbeast
have the following xml (named CPARKS.xml):
-<CARPARKS>
<DATE>15 May 2006</DATE>
<TIME>15:59 hrs</TIME>
-<LOCATION>
<PLACE>PGS</PLACE>
- <CARPARK>
<LOCATION>Belle Meadow</LOCATION>
<STATUS>Spaces</STATUS>
<EMPTY_PLACES>124</EMPTY_PLACES>
<CAPACITY>124</CAPACITY>
</CARPARK>
- <CARPARK>
<LOCATION>Queen St MSCP</LOCATION>
<STATUS>Spaces</STATUS>
<EMPTY_PLACES>339</EMPTY_PLACES>
<CAPACITY>339</CAPACITY>
</CARPARK>
</LOCATION>
</CARPARKS>
-------------------------------------
I'm trying to extract all the car park nodes. So it should display:
Bell Meadow, Spaces, 124, 124
Queen St MSCP, Spaces, 339, 399
Using the following function, but can only get one node for each
parking lot at a time.
<xml ID="writersXML"
SRC="CPARKS.xml"></xml>
<script language="JavaScript">
function findWriters() {
var myXML, myNodes;
var display="";
myXML= document.all("writersXML").XMLDocument;
//Put the <name> element into an object.
myNodes=myXML.getElementsByTagName("EMPTY_PLACES");
//Extract the different values using a loop.
for(var counter=1;counter<myNodes.length;counter++) {
display += myNodes.item(counter).firstChild.nodeValue +
"\n";
}
document.show.me.value=display;
}
How do i pull all the car park information?
I'm trying to extract all the car park nodes. So it should display:
Bell Meadow, Spaces, 124, 124
Queen St MSCP, Spaces, 339, 399
however, the code is just giving me one node at a time, ie
EMPTY_PLACES, etc
-<CARPARKS>
<DATE>15 May 2006</DATE>
<TIME>15:59 hrs</TIME>
-<LOCATION>
<PLACE>PGS</PLACE>
- <CARPARK>
<LOCATION>Belle Meadow</LOCATION>
<STATUS>Spaces</STATUS>
<EMPTY_PLACES>124</EMPTY_PLACES>
<CAPACITY>124</CAPACITY>
</CARPARK>
- <CARPARK>
<LOCATION>Queen St MSCP</LOCATION>
<STATUS>Spaces</STATUS>
<EMPTY_PLACES>339</EMPTY_PLACES>
<CAPACITY>339</CAPACITY>
</CARPARK>
</LOCATION>
</CARPARKS>
-------------------------------------
I'm trying to extract all the car park nodes. So it should display:
Bell Meadow, Spaces, 124, 124
Queen St MSCP, Spaces, 339, 399
Using the following function, but can only get one node for each
parking lot at a time.
<xml ID="writersXML"
SRC="CPARKS.xml"></xml>
<script language="JavaScript">
function findWriters() {
var myXML, myNodes;
var display="";
myXML= document.all("writersXML").XMLDocument;
//Put the <name> element into an object.
myNodes=myXML.getElementsByTagName("EMPTY_PLACES");
//Extract the different values using a loop.
for(var counter=1;counter<myNodes.length;counter++) {
display += myNodes.item(counter).firstChild.nodeValue +
"\n";
}
document.show.me.value=display;
}
</script>
How do i pull all the car park information?
I'm trying to extract all the car park nodes. So it should display:
Bell Meadow, Spaces, 124, 124
Queen St MSCP, Spaces, 339, 399
however, the code is just giving me one node at a time, ie
EMPTY_PLACES, etc