473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 1955
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kmunderwood | last post by:
I am trying to combine "if match=" and "when test" I am a newbie, and have made both work separately, but I can not seem to combine them. This is my xml("index.xml")page(I can not change this,...
5
by: jon morgan | last post by:
Hi, I am trying to clean out all the VB specific code in a project before porting to C#. Having removed all the import references I still see the VB runtime is loaded at startup. How can I pin...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
1
by: Dave Romig | last post by:
Can anyone provide guidance for saving and restoring an XMLDOM object as a binary blob? In a VB application, I need to repeatedly save and restore a large, dynamic XML document. Currently, the...
5
by: Dikkuuhh | last post by:
I must get a lot of information out of my database into a XMLDOM. The database part is done, all the information is in SQLDataReaders, but how can i convert all that information into a XMLDOM?? ...
8
by: J-P-W | last post by:
Hi, anyone got any thoughts on this problem? I have sales reps. that remotely send their data to an ftp server. The office downloads all files, the code creates an empty file, then downloads the...
16
by: Claudio Grondi | last post by:
Sometimes it is known in advance, that the time spent in a loop will be in order of minutes or even hours, so it makes sense to optimize each element in the loop to make it run faster. One of...
0
by: =?Utf-8?B?TWF0dCBDYWxob29u?= | last post by:
HI there, I am getting an error on my page which calls up a web service. Microsoft VBScript runtime error '800a13ba' Unknown runtime error: 'SearchQueryXML' /SearchResults.asp, line 142
1
AnuSumesh
by: AnuSumesh | last post by:
Hi, I want to read the text property of XML file. My xml file is as follows: <?xml version="1.0"?> <Domain_Credentials> <User> anu </User>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.