471,316 Members | 1,496 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

Checking when Microsoft.XMLDOM is done with XML import?

I have a web app that uses a form with its fields populated from XML
using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM 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(xmlQuery,xmlSrc,xmlTarget)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
};
xmlDoc.load("http://home1/sandbox/XMLResponder.nsf/XMLResponder?openagent&frm="+
xmlSrc +"&z=.xml");
return true;
}

function parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
{
var x = xmlDoc.getElementsByTagName('field');
var sValue;
var sText;
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x[i].childNodes.length;j++)
{
if (x[i].childNodes[j].nodeType != 1)
continue;
sValue =
x[i].childNodes[j].firstChild.nodeValue;
j++;
sText =
x[i].childNodes[j].firstChild.nodeValue
addOption(xmlTarget,sText,sValue);
}
}
}
Jul 23 '05 #1
2 1871
jfizer wrote:
I have a web app that uses a form with its fields populated from XML
using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM 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(xmlQuery,xmlSrc,xmlTarget)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
};
xmlDoc.load("http://home1/sandbox/XMLResponder.nsf/XMLResponder?openagent&frm="+
xmlSrc +"&z=.xml");
return true;
}

function parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
{
var x = xmlDoc.getElementsByTagName('field');
var sValue;
var sText;
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x[i].childNodes.length;j++)
{
if (x[i].childNodes[j].nodeType != 1)
continue;
sValue =
x[i].childNodes[j].firstChild.nodeValue;
j++;
sText =
x[i].childNodes[j].firstChild.nodeValue
addOption(xmlTarget,sText,sValue);
}
}
}


The XML document is loaded when xmlDoc.readyState == 4 and the fields
are populated when the parseXML function finishes.

Regards,
Steve
Jul 23 '05 #2
On Fri, 30 Jul 2004 07:07:51 GMT, Steve van Dongen
<st*****@hotmail.com> wrote:
jfizer wrote:
I have a web app that uses a form with its fields populated from XML
using Microsoft.XMLDOM. The problem is that Microsoft.XMLDOM 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(xmlQuery,xmlSrc,xmlTarget)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4)
parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
};
xmlDoc.load("http://home1/sandbox/XMLResponder.nsf/XMLResponder?openagent&frm="+
xmlSrc +"&z=.xml");
return true;
}

function parseXML(xmlQuery,xmlSrc,xmlTarget,xmlDoc)
{
var x = xmlDoc.getElementsByTagName('field');
var sValue;
var sText;
for (i=0;i<x.length;i++)
{
var row = document.createElement('TR');
for (j=0;j<x[i].childNodes.length;j++)
{
if (x[i].childNodes[j].nodeType != 1)
continue;
sValue =
x[i].childNodes[j].firstChild.nodeValue;
j++;
sText =
x[i].childNodes[j].firstChild.nodeValue
addOption(xmlTarget,sText,sValue);
}
}
}


The XML document is loaded when xmlDoc.readyState == 4 and the fields
are populated when the parseXML function finishes.

Regards,
Steve


I am aware of this, however my problem is as follows.

I have four select lists. The user can select items from list A and
add or delete them from list B. Depending on whats in list B, list C
gets populated via XML. The user can then select items from list C and
add or remove them from list D. The problem is when there are items in
list D and the user then removes an item from list B. This means that
list C changes and I need to make sure that the selected items that
got inserted into list D are still in list C. I've not been able to
find a way to do this because I dont know when list C is done being
populated.
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by kmunderwood | last post: by
5 posts views Thread by jon morgan | last post: by
67 posts views Thread by Steven T. Hatton | last post: by
1 post views Thread by Dave Romig | last post: by
5 posts views Thread by Dikkuuhh | last post: by
reply views Thread by =?Utf-8?B?TWF0dCBDYWxob29u?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.