Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Help! Xml Data Island is not refreshing!!!!

Reply
Thread Tools

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

 
 
Joe Bloggs
Guest
Posts: n/a
 
      04-07-2005
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[i].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


 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      04-07-2005
On Thu, 7 Apr 2005 21:53:35 +0800, "Joe Bloggs" <(E-Mail Removed)>
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.

 
Reply With Quote
 
 
 
 
Joe Bloggs
Guest
Posts: n/a
 
      04-09-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Thu, 7 Apr 2005 21:53:35 +0800, "Joe Bloggs" <(E-Mail Removed)>
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access client side XML data island from server side? =?Utf-8?B?YWRvbGYgZ2FybGlj?= ASP .Net 2 11-23-2004 05:16 PM
Persist data in XML data island Pat Alessi ASP .Net 3 05-26-2004 02:07 PM
Web control that acts as a xml data island Mark Goldin ASP .Net 1 04-29-2004 12:20 PM
Access xml data Island from C# code =?Utf-8?B?TWFyaw==?= ASP .Net 0 04-27-2004 08:46 PM
XML XSL javascript, sorting child node of data island Tim XML 5 03-02-2004 07:42 PM



Advertisments