2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* Defines the FCKXml object that is used for XML data calls
24
* This script is shared by almost all pages that compose the
25
* File Browser frameset.
28
var FCKXml = function()
31
FCKXml.prototype.GetHttpRequest = function()
34
if ( typeof(XMLHttpRequest) != 'undefined' )
35
return new XMLHttpRequest() ;
38
try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; }
42
try { return new ActiveXObject( 'Microsoft.XMLHTTP' ) ; }
48
FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer )
52
var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ;
54
var oXmlHttp = this.GetHttpRequest() ;
56
oXmlHttp.open( "GET", urlToCall, bAsync ) ;
60
oXmlHttp.onreadystatechange = function()
62
if ( oXmlHttp.readyState == 4 )
64
if ( ( oXmlHttp.status != 200 && oXmlHttp.status != 304 ) || oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null )
66
alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
67
'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
68
'Requested URL:\n' + urlToCall + '\n\n' +
69
'Response text:\n' + oXmlHttp.responseText ) ;
73
oFCKXml.DOMDocument = oXmlHttp.responseXML ;
74
asyncFunctionPointer( oFCKXml ) ;
79
oXmlHttp.send( null ) ;
83
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
84
this.DOMDocument = oXmlHttp.responseXML ;
87
alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ;
92
FCKXml.prototype.SelectNodes = function( xpath )
94
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
95
return this.DOMDocument.selectNodes( xpath ) ;
98
var aNodeArray = new Array();
100
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
101
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
104
var oNode = xPathResult.iterateNext() ;
107
aNodeArray[aNodeArray.length] = oNode ;
108
oNode = xPathResult.iterateNext();
115
FCKXml.prototype.SelectSingleNode = function( xpath )
117
if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE
118
return this.DOMDocument.selectSingleNode( xpath ) ;
121
var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument,
122
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
124
if ( xPathResult && xPathResult.singleNodeValue )
125
return xPathResult.singleNodeValue ;