# Safari 4 Java/XML/HTML problem

**URL:** <https://forum.kirupa.com/t/safari-4-java-xml-html-problem/288667>\
**Category:** Uncategorized\
**Created:** [May 19, 2009, 4:46pm UTC](https://forum.kirupa.com/t/safari-4-java-xml-html-problem/288667 "2009-05-19T16:46:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beaulne](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/beaulne/32/3027_2.png) [@Beaulne](https://forum.kirupa.com/u/Beaulne)\
**Post date:** [May 19, 2009, 4:46pm UTC](https://forum.kirupa.com/t/safari-4-java-xml-html-problem/288667/1 "2009-05-19T16:46:33Z")

</div>

Hello,

So I have been making a website for a friend that requires posts to be loaded via an external XML sheet on the server. I am more or less using w3schools example ([http://www.w3schools.com/xml/xml\_to\_html.asp](http://www.w3schools.com/xml/xml_to_html.asp)). The problem is that it does not load using safari 4 or google chrome web browser. is there any reasons? I have been trying to google it but I am not sure exactly what I am looking for.

w3schools code that does not work in chrome or safari 4

> \<html\>  
> \<body\>

\<script type=“text/javascript”\>  
var xmlDoc=null;  
if (window.ActiveXObject)  
{// code for IE  
xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”);  
}  
else if (document.implementation.createDocument)  
{// code for Mozilla, Firefox, Opera, etc.  
xmlDoc=document.implementation.createDocument(“”,“”,null);  
}  
else  
{  
alert(‘Your browser cannot handle this script’);  
}  
if (xmlDoc!=null)  
{  
xmlDoc.async=false;  
xmlDoc.load(“cd\_catalog.xml”);

document.write(“\<table border=‘1’\>”);

var x=xmlDoc.getElementsByTagName(“CD”);  
for (i=0;i\<x.length;i++)  
{  
document.write(“\<tr\>”);  
document.write(“\<td\>”);  
document.write(  
x\*.getElementsByTagName(“ARTIST”)[0].childNodes[0].nodeValue);  
document.write(“\</td\>”);

document.write(“\<td\>”);  
document.write(  
x\*.getElementsByTagName(“TITLE”)[0].childNodes[0].nodeValue);  
document.write(“\</td\>”);  
document.write(“\</tr\>”);  
}  
document.write(“\</table\>”);  
}  
\</script\>

\</body\>  
\</html\>

Thank you in advance for your help!
