Ftp web hosting - CHAPTER 8 SCRIPTING IN THE BROWSER 245
Wednesday, October 31st, 2007CHAPTER 8 SCRIPTING IN THE BROWSER 245 The Moz_Document_load() overrides the Mozilla load() method. This allows the wrapper to include code for firing the MSXML equivalent events: function _Moz_Document_load(strURL) { this.parseError = 0; updateReadyState(this, 1); try { this.__load__(strURL); } catch (oException) { this.parseError = -1; } updateReadyState(this, 4); } The updateReadyState() function is a helper method that sets the readyState property and fires the necessary events: function updateReadyState(oDOMDocument, intReadyState) { oDOMDocument.readyState = intReadyState; if (oDOMDocument.onreadystatechange != null && . typeof DOMDocument.onreadystatechange == “function”) oDOMDocument.onreadystatechange(); } The two functions that deal with XSLT are very similar. The only difference is that one of them serializes the result to a string, and the other returns the processed result as a DOMDocument object. Both functions allow the Mozilla XSLTProcessor object to mimic XSLT transformations in MSXML: function _Moz_node_transformNode(oStylesheetDOM) { var oXSLTProcessor = new XSLTProcessor(); var oOutDOM = document.implementation.createDocument(”",”",null); oXSLTProcessor.transformDocument( this, oStylesheetDOM, oOutDOM, null); return (new XMLSerializer()).serializeToString(oOutDOM); } Some of the extra functions in the wrapper aren t included in this brief walkthrough. You can look through the code if you want to explore further. WHY EXTEND MOZILLA? Given that the Mozilla implementation is more standards-compliant, you may be wondering why you re using a JavaScript wrapper that makes Mozilla work like IE. MSXML is a separate library from IE, so it s not possible to extend it with JavaScript prototypes. IE was the first browser to support XML and is still the most popular web browser. By replicating the behavior of IE, you can use the large number of IE-specific examples available on the Internet in your own projects more easily.
Check Tomcat Web Hosting services for best quality webspace to host your web application.