I have a web app that uses a form with its fields populated from XML
using Microsoft.XMLDO M. The problem is that Microsoft.XMLDO M functions
seem to run on their own thread, so I dont know when the fields are
done populating.
Can anyone think of a way for me to check when the following function
finishes?
function importXML(xmlQu ery,xmlSrc,xmlT arget)
{
var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.onreadys tatechange = function () {
if (xmlDoc.readySt ate == 4)
parseXML(xmlQue ry,xmlSrc,xmlTa rget,xmlDoc)
};
xmlDoc.load("ht tp://home1/sandbox/XMLResponder.ns f/XMLResponder?op enagent&frm="+
xmlSrc +"&z=.xml");
return true;
}
function parseXML(xmlQue ry,xmlSrc,xmlTa rget,xmlDoc)
{
var x = xmlDoc.getEleme ntsByTagName('f ield');
var sValue;
var sText;
for (i=0;i<x.length ;i++)
{
var row = document.create Element('TR');
for (j=0;j<x[i].childNodes.len gth;j++)
{
if (x[i].childNodes[j].nodeType != 1)
continue;
sValue =
x[i].childNodes[j].firstChild.nod eValue;
j++;
sText =
x[i].childNodes[j].firstChild.nod eValue
addOption(xmlTa rget,sText,sVal ue);
}
}
}
using Microsoft.XMLDO M. The problem is that Microsoft.XMLDO M functions
seem to run on their own thread, so I dont know when the fields are
done populating.
Can anyone think of a way for me to check when the following function
finishes?
function importXML(xmlQu ery,xmlSrc,xmlT arget)
{
var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.onreadys tatechange = function () {
if (xmlDoc.readySt ate == 4)
parseXML(xmlQue ry,xmlSrc,xmlTa rget,xmlDoc)
};
xmlDoc.load("ht tp://home1/sandbox/XMLResponder.ns f/XMLResponder?op enagent&frm="+
xmlSrc +"&z=.xml");
return true;
}
function parseXML(xmlQue ry,xmlSrc,xmlTa rget,xmlDoc)
{
var x = xmlDoc.getEleme ntsByTagName('f ield');
var sValue;
var sText;
for (i=0;i<x.length ;i++)
{
var row = document.create Element('TR');
for (j=0;j<x[i].childNodes.len gth;j++)
{
if (x[i].childNodes[j].nodeType != 1)
continue;
sValue =
x[i].childNodes[j].firstChild.nod eValue;
j++;
sText =
x[i].childNodes[j].firstChild.nod eValue
addOption(xmlTa rget,sText,sVal ue);
}
}
}
Comment