Reply
Using Javascript to read in XML into Safari - HELP!
Old 04-05-2009, 05:52 PM Using Javascript to read in XML into Safari - HELP!
Super Talker

Posts: 116
Trades: 0
Hey all,

I have to read in an xml file. So far it's working in IE6, IE7 and FireFox.

It DOES NOT work on Safari.

Below is the code...

<script type="text/javascript">
var xmlDoc;
function loadXMLDoc()
{
// XML loader for IE
if (window.ActiveXObject)
{ xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("condos.xml");
printCondos(); }
// XML for other browsers
else
{ xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.load("condos.xml");
xmlDoc.onload = printCondos; }
}

function printCondos()
{
var nameNodes = xmlDoc.getElementsByTagName("name");
var addrNodes = xmlDoc.getElementsByTagName("address");
var addr2Nodes = xmlDoc.getElementsByTagName("address2");
var imgNodes = xmlDoc.getElementsByTagName("img");

for(var i = 0; i<nameNodes.length; i++)
{
document.write("<div style='font-family:arial; font-weight:bold; color:maroon;'>" + nameNodes[i].firstChild.nodeValue + "</div>");
}

}
</script>

I'm just reading in for the "nameNodes" first...

Anyone have any suggestions?

Thanks
Donna
DonnaZ is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 04-05-2009, 09:10 PM Re: Using Javascript to read in XML into Safari - HELP!
Sleeping Troll's Avatar
Ultra Talker

Posts: 266
Name: Butch Begy
Trades: 0
Don't use the browser specific handlers for xml, write your own.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Using Javascript to read in XML into Safari - HELP!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10044 seconds with 13 queries