Help! Xml Data Island is not refreshing!!!!

Discussion in 'XML' started by Joe Bloggs, Apr 7, 2005.

  1. Joe Bloggs

    Joe Bloggs Guest

    Hi,

    I have an xml data island which is used for providing data for a
    dropdown list. However, change the 'src' attribute of the xml data
    island doesn't seem to reload the xml island properly....

    Here is my code:

    <html>
    <head>
    </head>
    <body>

    <script language="javascript">

    function getNoneTextNode(node)
    {
    if(node.hasChildNodes && node.firstChild.nodeType!=3)
    {
    return node.firstChild;
    }
    else if(node.hasChildNodes && node.childNodes[1].nodeType==1)
    {
    return node.childNodes[1];
    }
    else if(node.hasChildNodes && node.firstChild.nodeType==1)
    {
    return node.firstChild;
    }
    return null;
    }

    function SelectData(control)
    {

    var xmlDoc = document.getElementById("xmlDoc");
    xmlDoc.setAttribute("src", "DynamicXmlIsland.asp?Fetch=" +
    (control.selectedIndex+1));
    xmlDoc.load(xmlDoc.src);

    alert (" I am here");

    //get the root node
    ///var parentNode = xmlDoc.firstChild;
    var parentNode = getNoneTextNode(xmlDoc);

    var dropdown = document.getElementById("employeeDropdown");

    for (var i = dropdown.length;i > 0;i--) {
    dropdown.options[0] = null;

    }
    if (parentNode.hasChildNodes)
    {
    for(var i =0; i <parentNode.childNodes.length; i++)
    {
    var oOption = document.createElement("OPTION");
    var optionValue =
    document.createTextNode(parentNode.childNodes.childNodes[0].nodeValue);

    oOption.appendChild(optionValue);
    dropdown.appendChild(oOption);
    }
    }
    }


    </script>

    <xml id="xmlDoc" src="DynamicXmlIsland.asp?Fetch=1"/>
    Select 1 data file:
    <select ONCHANGE="return SelectData(this)" id="Select1"
    name="Select1" >
    <option selected>1</option>
    <option>2</option>
    </select>
    <br>
    Employee Name:
    <select id="employeeDropdown">
    </select>
    </body>
    </html>


    See the line where I have got the alert on.... if I comment that line
    out, it doesn't work, but if I have the alert turned on, the xml
    island is refreshed correctly....

    I am really puzzled!!!!

    Thanks in advanced
     
    Joe Bloggs, Apr 7, 2005
    #1
    1. Advertising

  2. Joe Bloggs

    Andy Dingley Guest

    On Thu, 7 Apr 2005 21:53:35 +0800, "Joe Bloggs" <>
    wrote:

    >I have an xml data island which is used for providing data for a
    >dropdown list. However, change the 'src' attribute of the xml data
    >island doesn't seem to reload the xml island properly....


    I don't really know why you'd expect it too. Do it right - use the
    XmlHttp object instead.


    If you think carefully about what's happening here, and how it
    strangely starts working when you have the alert(), then you should be
    able to work out why it's failing.
     
    Andy Dingley, Apr 7, 2005
    #2
    1. Advertising

  3. Joe Bloggs

    Joe Bloggs Guest

    Hi Andy,

    No everyone will allow ActiveX to work in their IE. Users can easily lock
    down their browser to disable ActiveX and the XmlHttp will fail... that is
    why I am thinking of using DSO as my fall back.

    Someone actually suggest that I check the readystate on the XML. The alert
    box is probably giving me the time to allow the XML to down to the client
    browser before I start iterating through the nodes.

    Regards,
    Joe

    "Andy Dingley" <> wrote in message
    news:...
    > On Thu, 7 Apr 2005 21:53:35 +0800, "Joe Bloggs" <>
    > wrote:
    >
    >>I have an xml data island which is used for providing data for a
    >>dropdown list. However, change the 'src' attribute of the xml data
    >>island doesn't seem to reload the xml island properly....

    >
    > I don't really know why you'd expect it too. Do it right - use the
    > XmlHttp object instead.
    >
    >
    > If you think carefully about what's happening here, and how it
    > strangely starts working when you have the alert(), then you should be
    > able to work out why it's failing.
    >
     
    Joe Bloggs, Apr 9, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFyaw==?=

    Access xml data Island from C# code

    =?Utf-8?B?TWFyaw==?=, Apr 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    459
    =?Utf-8?B?TWFyaw==?=
    Apr 27, 2004
  2. Mark Goldin

    Web control that acts as a xml data island

    Mark Goldin, Apr 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    389
    Ken Cox [Microsoft MVP]
    Apr 29, 2004
  3. Pat Alessi

    Persist data in XML data island

    Pat Alessi, May 25, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    714
    Rick Spiewak
    May 26, 2004
  4. =?Utf-8?B?YWRvbGYgZ2FybGlj?=

    How to access client side XML data island from server side?

    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,180
    aa7im
    Nov 23, 2004
  5. Tim
    Replies:
    5
    Views:
    7,014
    Thomas 'PointedEars' Lahn
    Mar 2, 2004
Loading...

Share This Page