| | |
xmlDoc.transformNode is not a function (Error in Firefox)
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2007
Posts: 8
Reputation:
Solved Threads: 0
Hi Guys...
I'm having problem with XML transformation. I have this code where I click a link that will open a new window that is referenced to XML. It works fine in IE but in Firefox, a new window is opened and the contents are not displayed.
Here's a code snippet:
if (window.ActiveXObject) //code for IE
{
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
xslDoc.async=false;
xslDoc.load(xslPath);
transformxsl();
}
//code for Mozilla, Firefox
else (document.implementation && document.implementation.createDocument)
{
xslDoc=document.implementation.createDocument("","",null);
xslDoc.load(xPath);
xslDoc.onload=transformxsl;
}
function transformxsl()
{
var OpsDocStr = xmlDoc.transformNode (xslDoc)
document.getElementById("it").innerHTML = OpsDocStr //xmlDoc.transformNode (xslDoc)
}
The line in red is where the error is: xmlDoc.transformNode is not a function
Can anyone help me???
Will really appreciate it. Thanks.
I'm having problem with XML transformation. I have this code where I click a link that will open a new window that is referenced to XML. It works fine in IE but in Firefox, a new window is opened and the contents are not displayed.
Here's a code snippet:
if (window.ActiveXObject) //code for IE
{
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
xslDoc.async=false;
xslDoc.load(xslPath);
transformxsl();
}
//code for Mozilla, Firefox
else (document.implementation && document.implementation.createDocument)
{
xslDoc=document.implementation.createDocument("","",null);
xslDoc.load(xPath);
xslDoc.onload=transformxsl;
}
function transformxsl()
{
var OpsDocStr = xmlDoc.transformNode (xslDoc)
document.getElementById("it").innerHTML = OpsDocStr //xmlDoc.transformNode (xslDoc)
}
The line in red is where the error is: xmlDoc.transformNode is not a function
Can anyone help me???
Will really appreciate it. Thanks.
Last edited by Dennis_Phils; Dec 6th, 2007 at 6:45 am.
•
•
Join Date: Dec 2007
Posts: 134
Reputation:
Solved Threads: 21
First of all, your code does not show where you initialized xmlDoc. I see xslDoc, but not xmlDoc. I assume this happens before the posted code.
With the assumptions above, the method "transformNode" is only valid for
xml objects created specifically for IE. In your code, this would be:
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
However, the reason you get the error is because xmlDoc is not an ActiveXObject('Microsoft.XMLDOM'). FF does not support such object. It has its own object with its own methods.
The following page might be instructive if you want to pursue this route. Meaning, if you want to write your own "library". Section 8.13 uses the transformNode and shows you how to do the same for FF.
http://www.dcs.bbk.ac.uk/~ptw/teachi...t-2/notes.html
However, my recommendation is for you to download the Sarissa library. Basically, it is a library that takes care of these browser incompatibilities. Thus, you don't need to remember/learn the IE syntax and Firefox Syntax or whatever other browser syntax. You just need to learn the sarissa functions and how to use them to perform your transformations. Most often than not, once your script works on one browser, it automatically works on the others! I cannot stress enough how much of a head ache you will avoid by pursing this route instead. Good Luck.
With the assumptions above, the method "transformNode" is only valid for
xml objects created specifically for IE. In your code, this would be:
xslDoc=new ActiveXObject("Microsoft.XMLDOM");
However, the reason you get the error is because xmlDoc is not an ActiveXObject('Microsoft.XMLDOM'). FF does not support such object. It has its own object with its own methods.
The following page might be instructive if you want to pursue this route. Meaning, if you want to write your own "library". Section 8.13 uses the transformNode and shows you how to do the same for FF.
http://www.dcs.bbk.ac.uk/~ptw/teachi...t-2/notes.html
However, my recommendation is for you to download the Sarissa library. Basically, it is a library that takes care of these browser incompatibilities. Thus, you don't need to remember/learn the IE syntax and Firefox Syntax or whatever other browser syntax. You just need to learn the sarissa functions and how to use them to perform your transformations. Most often than not, once your script works on one browser, it automatically works on the others! I cannot stress enough how much of a head ache you will avoid by pursing this route instead. Good Luck.
![]() |
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: soap security
- Next Thread: Trying to add a Form in XML to my website.
Views: 3127 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for RSS, Web Services and SOAP
.htaccess 301 accept access alltop api authentication binarysecuritytoken blog card collaboration credit data development ebay email evernote flash google government highrise htaccess intel internet legal live netbeans patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server service soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xerces xml xslt y!os yahoo ydn





