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_gecko.js
|
---|
14 | * FCKXml Class: class to load and manipulate XML files.
|
---|
15 | *
|
---|
16 | * File Authors:
|
---|
17 | * Frederico Caldeira Knabben (fredck@fckeditor.net)
|
---|
18 | */
|
---|
19 |
|
---|
20 | var FCKXml = function()
|
---|
21 | {}
|
---|
22 |
|
---|
23 | FCKXml.prototype.LoadUrl = function( urlToCall )
|
---|
24 | {
|
---|
25 | var oFCKXml = this ;
|
---|
26 |
|
---|
27 | var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
|
---|
28 | oXmlHttp.open( "GET", urlToCall, false ) ;
|
---|
29 | oXmlHttp.send( null ) ;
|
---|
30 |
|
---|
31 | if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
|
---|
32 | this.DOMDocument = oXmlHttp.responseXML ;
|
---|
33 | else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
|
---|
34 | this.DOMDocument = oXmlHttp.responseXML ;
|
---|
35 | else
|
---|
36 | alert( 'Error loading "' + urlToCall + '"' ) ;
|
---|
37 | }
|
---|
38 |
|
---|
39 | FCKXml.prototype.SelectNodes = function( xpath, contextNode )
|
---|
40 | {
|
---|
41 | var aNodeArray = new Array();
|
---|
42 |
|
---|
43 | var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
|
---|
44 | this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
|
---|
45 | if ( xPathResult )
|
---|
46 | {
|
---|
47 | var oNode = xPathResult.iterateNext() ;
|
---|
48 | while( oNode )
|
---|
49 | {
|
---|
50 | aNodeArray[aNodeArray.length] = oNode ;
|
---|
51 | oNode = xPathResult.iterateNext();
|
---|
52 | }
|
---|
53 | }
|
---|
54 | return aNodeArray ;
|
---|
55 | }
|
---|
56 |
|
---|
57 | FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
|
---|
58 | {
|
---|
59 | var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
|
---|
60 | this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
|
---|
61 |
|
---|
62 | if ( xPathResult && xPathResult.singleNodeValue )
|
---|
63 | return xPathResult.singleNodeValue ;
|
---|
64 | else
|
---|
65 | return null ;
|
---|
66 | } |
---|