[389] | 1 | /* |
---|
| 2 | * FCKeditor - The text editor for internet |
---|
| 3 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
| 4 | * |
---|
| 5 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
| 6 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
| 7 | * |
---|
| 8 | * For further information visit: |
---|
| 9 | * http://www.fckeditor.net/ |
---|
| 10 | * |
---|
| 11 | * "Support Open Source software. What about a donation today?" |
---|
| 12 | * |
---|
| 13 | * File Name: fckxml_ie.js |
---|
| 14 | * FCKXml Class: class to load and manipulate XML files. |
---|
| 15 | * (IE specific implementation) |
---|
| 16 | * |
---|
| 17 | * File Authors: |
---|
| 18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | var FCKXml = function() |
---|
| 22 | { |
---|
| 23 | this.Error = false ; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | FCKXml.prototype.LoadUrl = function( urlToCall ) |
---|
| 27 | { |
---|
| 28 | this.Error = false ; |
---|
| 29 | |
---|
| 30 | var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ; |
---|
| 31 | |
---|
| 32 | if ( !oXmlHttp ) |
---|
| 33 | { |
---|
| 34 | this.Error = true ; |
---|
| 35 | return ; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | oXmlHttp.open( "GET", urlToCall, false ) ; |
---|
| 39 | |
---|
| 40 | oXmlHttp.send( null ) ; |
---|
| 41 | |
---|
| 42 | if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) |
---|
| 43 | this.DOMDocument = oXmlHttp.responseXML ; |
---|
| 44 | else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 ) |
---|
| 45 | { |
---|
| 46 | this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ; |
---|
| 47 | this.DOMDocument.async = false ; |
---|
| 48 | this.DOMDocument.resolveExternals = false ; |
---|
| 49 | this.DOMDocument.loadXML( oXmlHttp.responseText ) ; |
---|
| 50 | } |
---|
| 51 | else |
---|
| 52 | { |
---|
| 53 | this.Error = true ; |
---|
| 54 | alert( 'Error loading "' + urlToCall + '"' ) ; |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | FCKXml.prototype.SelectNodes = function( xpath, contextNode ) |
---|
| 59 | { |
---|
| 60 | if ( this.Error ) |
---|
| 61 | return new Array() ; |
---|
| 62 | |
---|
| 63 | if ( contextNode ) |
---|
| 64 | return contextNode.selectNodes( xpath ) ; |
---|
| 65 | else |
---|
| 66 | return this.DOMDocument.selectNodes( xpath ) ; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | FCKXml.prototype.SelectSingleNode = function( xpath, contextNode ) |
---|
| 70 | { |
---|
| 71 | if ( this.Error ) |
---|
| 72 | return ; |
---|
| 73 | |
---|
| 74 | if ( contextNode ) |
---|
| 75 | return contextNode.selectSingleNode( xpath ) ; |
---|
| 76 | else |
---|
| 77 | return this.DOMDocument.selectSingleNode( xpath ) ; |
---|
| 78 | } |
---|