Jump to content

Ie6 Compatability Xml


cowsdonthack
 Share

Recommended Posts

JS

oldTextAry = new Array();var xmlDoc;if (window.XMLHttpRequest)  {	xmlDoc=new window.XMLHttpRequest();	xmlDoc.open("GET","data.xml",false);	xmlDoc.send("");	xmlDoc=xmlDoc.responseXML;	}else if (ActiveXObject("Microsoft.XMLDOM"))  {	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");	xmlDoc.async=false;  xmlDoc.load("data.xml");	}

Unfortunately this doesn't load DATA.XML for IE6How should I get it to load for IE6?

Link to comment
Share on other sites

Little UpdateAfter reading the XML Tutorial Sticky I changed the Code to thisJS

oldTextAry = new Array();var xmlDoc;if (window.XMLHttpRequest)  {	xmlDoc=new window.XMLHttpRequest();	xmlDoc.open("GET","data.xml",false);	xmlDoc.send("");	xmlDoc=xmlDoc.responseXML;	}else if (ActiveXObject) {	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");	xmlDoc.async=false;  xmlDoc.load("data.xml");	}

Still doesn't work T-T

Link to comment
Share on other sites

Try to use the old XMLHttpRequest control instead, like

if (window.XMLHttpRequest)  {	xmlDoc=new window.XMLHttpRequest();	}else if (window.ActiveXObject) {	xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");	xmlDoc.async=false;	}xmlDoc.open("GET","data.xml",false);xmlDoc.send("");xmlDoc=xmlDoc.responseXML;

Link to comment
Share on other sites

Try to use the old XMLHttpRequest control instead, like
if (window.XMLHttpRequest)  {	xmlDoc=new window.XMLHttpRequest();	}else if (window.ActiveXObject) {	xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");	xmlDoc.async=false;	}xmlDoc.open("GET","data.xml",false);xmlDoc.send("");xmlDoc=xmlDoc.responseXML;

Still works for Firefox, but doesn't work for Internet Explorer.Is there something else to this? Like loading the variants from Internet Explorer, is that the same as in Firefox? Here let me give you a link to what I'm working on.
Link to comment
Share on other sites

Still works for Firefox, but doesn't work for Internet Explorer.Is there something else to this? Like loading the variants from Internet Explorer, is that the same as in Firefox? Here let me give you a link to what I'm working on.
Last time I tried (quite a long time ago), Internet Explorer accepts that window.XMLHttpRequest exists but it can't use it as a function. The solution I gave was to use try/catch.
try {	xmlDoc=new window.XMLHttpRequest();} catch (err) {	xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");	xmlDoc.async=false;}xmlDoc.open("GET","data.xml",false);xmlDoc.send("");xmlDoc=xmlDoc.responseXML;

Link to comment
Share on other sites

Last time I tried (quite a long time ago), Internet Explorer accepts that window.XMLHttpRequest exists but it can't use it as a function. The solution I gave was to use try/catch.
try {	xmlDoc=new window.XMLHttpRequest();} catch (err) {	xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");	xmlDoc.async=false;}xmlDoc.open("GET","data.xml",false);xmlDoc.send("");xmlDoc=xmlDoc.responseXML;

oldTextAry = new Array();try {	xmlDoc=new window.XMLHttpRequest();} catch (err) {	xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");	xmlDoc.async=false;}xmlDoc.open("GET","data.xml",false);xmlDoc.send("");xmlDoc=xmlDoc.responseXML;var x=xmlDoc.getElementsByTagName("PR");i=0;

Same issues, I'm begginning to wonder if it's how I pulled OUT the information that's the problemI'm using code likeJS

enl5=(x[i+4].getElementsByTagName("ENL")[0].childNodes[0].nodeValue);enl=enl5;document.getElementById("E").innerHTML=enl;}

http://www[dot]qualitydoor[dot]com/c[dot]phpI don't know if it helps if you guys see the actual project

Link to comment
Share on other sites

In firefox, the error console tells me thaat opt1 does not exist

document.getElementById("OPT1t").innerHTML=opt1;

Internet Explorer seems to have a problem on this line:

lnk1=(x[i+0].getElementsByTagName("LINK")[0].childNodes[0].nodeValue);

You should declare all your variables before using them, using the var keyword.Since you have PHP available, why not extract the information and display it with PHP instead? The DOMDocument class works just like Javascript's XML DOM:

$XML = new DOMDocument();$XML->open('data.xml');echo $XML->getElementsByTagName("ENL")->item(0)->childNodes->item(0)->nodeValue

Edited by Ingolme
Link to comment
Share on other sites

In firefox, the error console tells me thaat opt1 does not exist
document.getElementById("OPT1t").innerHTML=opt1;

Internet Explorer seems to have a problem on this line:

lnk1=(x[i+0].getElementsByTagName("LINK")[0].childNodes[0].nodeValue);

You should declare all your variables before using them, using the var keyword.Since you have PHP available, why not extract the information and display it with PHP instead? The DOMDocument class works just like Javascript's XML DOM:

$XML = new DOMDocument();$XML->open('data.xml');echo $XML->getElementsByTagName("ENL")->item(0)->childNodes->item(0)->nodeValue

I moved the test page to www.frozeninksecret.com/m/c.php since the companies site is moving really slow.
22] <body onLoad="productline();">23] <?php24] $XML = new DOMDocument();25] $XML->open('data.xml');26] echo $XML->getElementsByTagName( "ENL" )->item(0)->childNodes->item(0)->nodeValue;27] ?>

Hey, I tried using that code, but it says

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/5/d166572423/htdocs/frozeninksecret/m/c.php on line 26

Whenever I try to use it. I spent an hour trying to see where the code needed a , and a ; and i figured, it needed a ; at the end of it , but that didn't seem to help. If I can use PHP instead and it loads in Ie6, I'll just use that instead.

Edited by cowsdonthack
Link to comment
Share on other sites

I moved the test page to www.frozeninksecret.com/m/c.php since the companies site is moving really slow.
22] <body onLoad="productline();">23] <?php24] $XML = new DOMDocument();25] $XML->open('data.xml');26] echo $XML->getElementsByTagName( "ENL" )->item(0)->childNodes->item(0)->nodeValue;27] ?>

Hey, I tried using that code, but it says

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/5/d166572423/htdocs/frozeninksecret/m/c.php on line 26

Whenever I try to use it. I spent an hour trying to see where the code needed a , and a ; and i figured, it needed a ; at the end of it , but that didn't seem to help. If I can use PHP instead and it loads in Ie6, I'll just use that instead.

Actually, I have a mistake there, try $XML->load('data.xml');
Link to comment
Share on other sites

Actually, I have a mistake there, try $XML->load('data.xml');
23] <?php24] $XML = new DOMDocument();25] $XML->load('data.xml');26] echo $XML->getElementsByTagName( "ENL" )->item(0)->childNodes->item(0)->nodeValue;27] ?>

It still says

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/5/d166572423/htdocs/frozeninksecret/m/c.php on line 26

I'm sorry, I'm not really all that experienced with PHP, I tried looking to see where it might need an ENDER but even in other people's code, it looks like you're using the right syntax on line 26

Link to comment
Share on other sites

23] <?php24] $XML = new DOMDocument();25] $XML->load('data.xml');26] echo $XML->getElementsByTagName( "ENL" )->item(0)->childNodes->item(0)->nodeValue;27] ?>

It still says

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /homepages/5/d166572423/htdocs/frozeninksecret/m/c.php on line 26

I'm sorry, I'm not really all that experienced with PHP, I tried looking to see where it might need an ENDER but even in other people's code, it looks like you're using the right syntax on line 26

Maybe it's better to refer to the documentElement:
echo $XML->documentElement->getElementsByTagName('ENL')->item(0)->firstChild->nodeValue;

Also, be sure that the node actually exists.

Link to comment
Share on other sites

Maybe it's better to refer to the documentElement:
echo $XML->documentElement->getElementsByTagName('ENL')->item(0)->firstChild->nodeValue;

Also, be sure that the node actually exists.

23] <?php24] $xmlDoc = new DOMDocument();25] $xmlDoc->load("data.xml");26] //print $xmlDoc->saveXML();27] //echo $XML->documentElement->getElementsByTagName("ENL")->item(0)->firstChild->nodeValue;28] //echo $XML->getElementsByTagName( "ENL" )->item(0)->childNodes->item(0)->nodeValue;29] ?>

I tried taking out anything calling on the XML altogether, and there is still an error.

Fatal error: Call to undefined method: domdocument->load() in frozeninksecret/m/c.php on line 25

Tried changing it to Open, I also tried taking out the included js

Link to comment
Share on other sites

Is your PHP actually PHP5? Or is it PHP4?If you aren't sure, create a new PHP file with the following contents:

<?php phpinfo(); ?>

and open it with your browser. The PHP version should be at the very top of the page.You need PHP5 in order to have DOM in PHP. Ask your host if they offer PHP5 support in case it turns out you have PHP4.

Edited by boen_robot
Link to comment
Share on other sites

Is your PHP actually PHP5? Or is it PHP4?If you aren't sure, create a new PHP file with the following contents:
<?php phpinfo(); ?>

and open it with your browser. The PHP version should be at the very top of the page.You need PHP5 in order to have DOM in PHP. Ask your host if they offer PHP5 support in case it turns out you have PHP4.

Oh wow, yeah, it's PHP 4.4.9Let me contact my host right now
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...