Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with selectSingleNode and IE5

Status
Not open for further replies.

belwig

Programmer
Oct 14, 2002
3
US
Hi all,

I'm having an issue with the following XML Data Island/Javascript code. It works fine in IE6 but generates an error (object required) when tried in IE5 or IE5.5.

Here is the data island (greatly reduced)

<XML ID='xmlStationAirlines'>
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<stations>
<station desc=&quot;Albany&quot; id=&quot;E09&quot;>
<airline adesc=&quot;Air Georgian&quot; aid=&quot;GGN&quot;/>
</station>
</stations>
</XML>

Here is the (simplified) javascript, which is called via the onchange event for a dropdown.

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function getAirlines()
{
var xmlBlock = document.getElementById(&quot;xmlStationAirlines&quot;);
var xmlDoc = xmlBlock.XMLDocument;

var node = &quot;/*/station[@id=\&quot;&quot; + selStationId + &quot;\&quot;]&quot;

var selNode = xmlDoc.selectSingleNode( node );

alert(selNode.nodeName);
}
</SCRIPT>

The error occurs on the alert line.

Thanks!
 
And just to clarify, the line

var node = &quot;/*/station[@id=\&quot;&quot; + selStationId + &quot;\&quot;]&quot;

should have a &quot;;&quot; at the end. This isn't the problem, though.
 
On the IE 5.0/5.5 system, did you install msxml 4? IE 6.0 comes with the current msxml. for others, you'll have to install it yourself from microsoft.
 
Thanks for the response. I've not done this, but everything I've read indicates that the code should work on IE5. I'm not using anything that I know of that is specific to MSXML 4. Is there a way to alter the code so avoid having to upgrade?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top