[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/editor/_source/classes/ -> fckxml_gecko.js (source)

   1  /*
   2   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
   3   * Copyright (C) 2003-2007 Frederico Caldeira Knabben
   4   * 
   5   * == BEGIN LICENSE ==
   6   * 
   7   * Licensed under the terms of any of the following licenses at your
   8   * choice:
   9   * 
  10   *  - GNU General Public License Version 2 or later (the "GPL")
  11   *    http://www.gnu.org/licenses/gpl.html
  12   * 
  13   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  14   *    http://www.gnu.org/licenses/lgpl.html
  15   * 
  16   *  - Mozilla Public License Version 1.1 or later (the "MPL")
  17   *    http://www.mozilla.org/MPL/MPL-1.1.html
  18   * 
  19   * == END LICENSE ==
  20   * 
  21   * File Name: fckxml_gecko.js
  22   *     FCKXml Class: class to load and manipulate XML files.
  23   * 
  24   * File Authors:
  25   *         Frederico Caldeira Knabben (www.fckeditor.net)
  26   */
  27  
  28  var FCKXml = function()
  29  {}
  30  
  31  FCKXml.prototype.LoadUrl = function( urlToCall )
  32  {
  33      this.Error = false ;
  34      var oFCKXml = this ;
  35  
  36      var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
  37      oXmlHttp.open( "GET", urlToCall, false ) ;
  38      oXmlHttp.send( null ) ;
  39      
  40      if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
  41          this.DOMDocument = oXmlHttp.responseXML ;
  42      else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
  43          this.DOMDocument = oXmlHttp.responseXML ;
  44      else
  45          this.DOMDocument = null ;
  46  
  47      if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
  48      {
  49          this.Error = true ;
  50          if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
  51              alert( 'URL requested: "' + urlToCall + '"\r\n' +
  52                          'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
  53                          'Response text:\r\n' + oXmlHttp.responseText ) ;
  54  
  55      }
  56  }
  57  
  58  FCKXml.prototype.SelectNodes = function( xpath, contextNode )
  59  {
  60      if ( this.Error )
  61          return new Array() ;
  62  
  63      var aNodeArray = new Array();
  64  
  65      var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument, 
  66              this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
  67      if ( xPathResult ) 
  68      {
  69          var oNode = xPathResult.iterateNext() ;
  70          while( oNode )
  71          {
  72              aNodeArray[aNodeArray.length] = oNode ;
  73              oNode = xPathResult.iterateNext();
  74          }
  75      } 
  76      return aNodeArray ;
  77  }
  78  
  79  FCKXml.prototype.SelectSingleNode = function( xpath, contextNode ) 
  80  {
  81      if ( this.Error )
  82          return null ;
  83  
  84      var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
  85              this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
  86  
  87      if ( xPathResult && xPathResult.singleNodeValue )
  88          return xPathResult.singleNodeValue ;
  89      else    
  90          return null ;
  91  }


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7