Checking when Microsoft.XMLDOM is done with XML import?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jfizer

    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.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);
    }
    }
    }
  • Steve van Dongen

    #2
    Re: Checking when Microsoft.XMLDO M is done with XML import?

    jfizer wrote:
    [color=blue]
    >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(xmlQu ery,xmlSrc,xmlT arget,xmlDoc)
    > };
    >
    >
    >xmlDoc.load("h ttp://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);
    > }
    > }
    >}[/color]

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

    Regards,
    Steve

    Comment

    • jfizer

      #3
      Re: Checking when Microsoft.XMLDO M is done with XML import?

      On Fri, 30 Jul 2004 07:07:51 GMT, Steve van Dongen
      <stevevd@hotmai l.com> wrote:
      [color=blue]
      >jfizer wrote:
      >[color=green]
      >>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(xmlQ uery,xmlSrc,xml Target,xmlDoc)
      >> };
      >>
      >>
      >>xmlDoc.load(" http://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);
      >> }
      >> }
      >>}[/color]
      >
      >The XML document is loaded when xmlDoc.readySta te == 4 and the fields
      >are populated when the parseXML function finishes.
      >
      >Regards,
      >Steve[/color]

      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.

      Comment

      Working...