Here it is.
This is the output I to get on the browser (Firefox2):
time = 0.05
time =
This is the output I would like to get:
time = 0.05
time = 0.05
Thank you for any information.
OutputData.xml
Code:
<params>
<time>0.05</time>
<iterations>28</iterations>
<error>1.26</error>
</params>
printTwice.xhtml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- printTwice.xhtml
Find out why when I print the same variable more than once, this is effectively printed the first time only.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms"
xml:lang="en" lang="en"
>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
var time = 0.0, iterations = 0, error = 0.0
function UpdateView()
{
window.location.reload()
}
function LoadXMLdata()
{
// Code for Mozilla, Firefox, Opera, etc.
if (document.implementation)
{
if (document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument("","",null);
xmlDoc.load("./outputData.xml");
xmlDoc.onload = GetXMLdata;
}
else
alert('I cannot handle this script with your browser');
}
// Code for IE
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load("./outputData.xml");
GetXMLdata();
}
else
{
alert('I cannot handle this script with your browser');
}
}
function GetXMLdata()
{
// params { time, iterations, error }
document.getElementById("time").innerHTML = xmlDoc.getElementsByTagName("time")[0].childNodes[0].nodeValue;
document.getElementById("iterations").innerHTML = xmlDoc.getElementsByTagName("iterations")[0].childNodes[0].nodeValue;
document.getElementById("error").innerHTML = xmlDoc.getElementsByTagName("error")[0].childNodes[0].nodeValue;
}
</script>
</head>
<body onload="LoadXMLdata()">
time = <span id="time" /><br /> <!-- ok -->
time = <span id="time" /><br /> <!-- Why here the value is not printed??? -->
</body>
</html>