This is what I need:
User opens HTML file—->data from XML file is displayed in order in HTML file
This is my problem:
User opens HTML file—->1 of 2 things happen depending on the HTML file used
1. all the data I need is displayed but not in the order it should be
2. the data is displayed in the correct order but only the first Tstamp and entry are displayed
Displays everything (requires loadxmldoc.js) HTML:
[code]<html>
<head>
<script type=”text/javascript” src=”loadxmldoc.js”>
</script>
</head>
<body>
<script type=”text/javascript”>
xmlDoc=loadXMLDoc(“CurrentLog.xml”);
var x=xmlDoc.getElementsByTagName(‘TStamp’)
for (i=0;i<x.length;i++)
{
document.write(x[i].childNodes[0].nodeValue)
document.write(“<br />”)
}
var x=xmlDoc.getElementsByTagName(‘Entry’)
for (n=0;n<x.length;n++)
{
document.write(x[n].childNodes[0].nodeValue)
document.write(“<br />”)
}
</script>
</body>
</html>
Loadxmldoc.js:
[code]function loadXMLDoc(dname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”);
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument(“”,””,null);
}
else
{
alert(‘Your browser cannot handle this script’);
}
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
Displays only the first TStamp and Entry HTML:
[code]<html>
<head>
<script type=”text/javascript”>
var xmlDoc
function loadXML()
{
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject(“Microsoft.XMLDOM”);
xmlDoc.async=false;
xmlDoc.load(“CurrentLog.xml”);
getmessage()
}
}
function getmessage()
{
document.getElementById(“TStamp”).innerHTML=
xmlDoc.getElementsByTagName(“TStamp”)[0].firstChild.nodeValue
document.getElementById(“Entry”).innerHTML=
xmlDoc.getElementsByTagName(“Entry”)[0].firstChild.nodeValue
}
</script>
</head>
<body onload=”loadXML()” bgcolor=”#FFFFFF”>
<p><font size=”7″><b>COBRA Log</b></font><p>
<b>Time Stamp:</b><span id=”TStamp”></span><br/>
<b>Entry:</b><span id=”Entry”></span>
</p>
</body>
</html>
XML:
[code]<?xml version=”1.0″ standalone=”yes” ?>
– <IncrepDataset xmlns=”http://tempuri.org/IncrepDataset.xsd”>
– <Control>
<Control_ID>0</Control_ID>
<Name>DocViewer</Name>
<Filename>docviewer.dll</Filename>
<Icon>doc</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28546</Version>
<TStamp>2006-11-06T18:00:09.4160070-06:00</TStamp>
</Control>
– <Control>
<Control_ID>-1</Control_ID>
<Name>RIDS</Name>
<Filename>ridswrapper.dll</Filename>
<Icon>tool</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:00:32.8518090-06:00</TStamp>
</Control>
– <Control>
<Control_ID>-2</Control_ID>
<Name>Explosives</Name>
<Filename>atfwrapper.dll</Filename>
<Icon>tool_bomb</Icon>
<IncrepLoadable>true</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:01:01.2952610-06:00</TStamp>
</Control>
– <Control>
<Control_ID>-3</Control_ID>
<Name>ChecklistViewer.Bomb Response</Name>
<Filename>checklistwrapper.dll</Filename>
<Icon>tool_checklist</Icon>
<IncrepLoadable>false</IncrepLoadable>
<Version>4.0.0.28559</Version>
<TStamp>2006-11-06T18:01:21.5461976-06:00</TStamp>
</Control>
– <DataType>
<Datatype_id>1</Datatype_id>
<name>String</name>
<description />
</DataType>
– <IncidentLog>
<IncidentLog_ID>-10</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.7541536-06:00</TStamp>
<Entry>- ‘COMMENCE IED SOP/ERG ACTIONS. GATHER ALL INFO.’ checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
– <IncidentLog>
<IncidentLog_ID>-11</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.8142454-06:00</TStamp>
<Entry>- ‘SET INITIAL EXCLUSION AREA.’ checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
– <IncidentLog>
<IncidentLog_ID>-12</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.8943678-06:00</TStamp>
<Entry>- ‘MAKE ALL NOTIFICATIONS.’ checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
– <IncidentLog>
<IncidentLog_ID>-13</IncidentLog_ID>
<TStamp>2006-11-06T18:01:26.9644749-06:00</TStamp>
<Entry>- ‘IDENTIFY ON-SCENE COMMAND (OSC)/ COMMAND POST (CP) LOCATION.’ checked</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
<Control_ID>-3</Control_ID>
</IncidentLog>
– <IncidentLog>
<IncidentLog_ID>-14</IncidentLog_ID>
<TStamp>2006-11-06T18:01:38.6222841-06:00</TStamp>
<Entry>Incident Summary selected</Entry>
<AddedByUser>false</AddedByUser>
<submission_id>0</submission_id>
<Priority>Low</Priority>
</IncidentLog>
</IncrepDataset>