+++ /dev/null
-/*\r
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
- * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
- *\r
- * == BEGIN LICENSE ==\r
- *\r
- * Licensed under the terms of any of the following licenses at your\r
- * choice:\r
- *\r
- * - GNU General Public License Version 2 or later (the "GPL")\r
- * http://www.gnu.org/licenses/gpl.html\r
- *\r
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
- * http://www.gnu.org/licenses/lgpl.html\r
- *\r
- * - Mozilla Public License Version 1.1 or later (the "MPL")\r
- * http://www.mozilla.org/MPL/MPL-1.1.html\r
- *\r
- * == END LICENSE ==\r
- *\r
- * FCKXml Class: class to load and manipulate XML files.\r
- */\r
-\r
-FCKXml.prototype =\r
-{\r
- LoadUrl : function( urlToCall )\r
- {\r
- this.Error = false ;\r
-\r
- var oXml ;\r
- var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;\r
- oXmlHttp.open( 'GET', urlToCall, false ) ;\r
- oXmlHttp.send( null ) ;\r
-\r
- if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 || ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 ) )\r
- {\r
- oXml = oXmlHttp.responseXML ;\r
- // #1426: Fallback if responseXML isn't set for some\r
- // reason (e.g. improperly configured web server)\r
- if ( !oXml )\r
- oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;\r
- }\r
- else\r
- oXml = null ;\r
-\r
- if ( oXml )\r
- {\r
- // Try to access something on it.\r
- try\r
- {\r
- var test = oXml.firstChild ;\r
- }\r
- catch (e)\r
- {\r
- // If document.domain has been changed (#123), we'll have a security\r
- // error at this point. The workaround here is parsing the responseText:\r
- // http://alexander.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/\r
- oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;\r
- }\r
- }\r
-\r
- if ( !oXml || !oXml.firstChild )\r
- {\r
- this.Error = true ;\r
- if ( window.confirm( 'Error loading "' + urlToCall + '" (HTTP Status: ' + oXmlHttp.status + ').\r\nDo you want to see the server response dump?' ) )\r
- alert( oXmlHttp.responseText ) ;\r
- }\r
-\r
- this.DOMDocument = oXml ;\r
- },\r
-\r
- SelectNodes : function( xpath, contextNode )\r
- {\r
- if ( this.Error )\r
- return new Array() ;\r
-\r
- var aNodeArray = new Array();\r
-\r
- var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,\r
- this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;\r
- if ( xPathResult )\r
- {\r
- var oNode = xPathResult.iterateNext() ;\r
- while( oNode )\r
- {\r
- aNodeArray[aNodeArray.length] = oNode ;\r
- oNode = xPathResult.iterateNext();\r
- }\r
- }\r
- return aNodeArray ;\r
- },\r
-\r
- SelectSingleNode : function( xpath, contextNode )\r
- {\r
- if ( this.Error )\r
- return null ;\r
-\r
- var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,\r
- this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);\r
-\r
- if ( xPathResult && xPathResult.singleNodeValue )\r
- return xPathResult.singleNodeValue ;\r
- else\r
- return null ;\r
- }\r
-} ;\r