Code Index

Namespaces

Classes


Class CKFinder.xml

Class Summary
Constructor Attributes Constructor Name and Description
 
CKFinder.xml(xmlObjectOrData)
Represents a loaded XML document.
Field Summary
Field Attributes Field Name and Description
 
The native XML (DOM document) used by the class instance.
Method Summary
Method Attributes Method Name and Description
 
Checks whether server response contained an error code indicating that there was an error when executing a command.
 
Returns a custom error message returned by the server connector (only available when error code = 1),
 
Returns an error number returned by the server connector.
 
getInnerXml(xpath, contextNode)
Gets the string representation of the inner contents of a XML node, based on a XPath query.
 
selectNodes(xpath, contextNode)
Gets a list node from the XML document, based on a XPath query.
 
selectSingleNode(xpath, contextNode)
Get a single node from the XML document, based on a XPath query.
Class Detail
CKFinder.xml(xmlObjectOrData)
Since: 2.0
Represents a loaded XML document.
Note: this class is not directly accessible (CKFinder.xml is undefined).
CKFinder.xml object is passed to selected callback functions, for example in CKFinder.dataTypes.Connector#sendCommand.
Parameters:
{object|string} xmlObjectOrData
A native XML (DOM document) object or a string containing the XML definition to be loaded.
Field Detail
{object} baseXml
Since: 2.0
The native XML (DOM document) used by the class instance.
Method Detail
{Boolean} checkError()
Since: 2.0
Checks whether server response contained an error code indicating that there was an error when executing a command.
var file = api.getSelectedFile();
api.connector.sendCommand( "ImageResizeInfo", {
		fileName : file.name
	},
	function( xml ) {
		if ( xml.checkError() )
			return;
		var width = xml.selectSingleNode( 'Connector/ImageInfo/@width' ),
			height = xml.selectSingleNode( 'Connector/ImageInfo/@height' );

		if ( width && height )
			updateImgDimension( width.value, height.value );
	},
	file.folder.type,
	file.folder
);
Returns:
{Boolean} Returns true if an error occurred.

{String} getErrorMessage()
Since: 2.0
Returns a custom error message returned by the server connector (only available when error code = 1),
var customError = xml.getErrorMessage();
Returns:
{String} Error message.
See:
CKFinder.xml.checkError

{Integer} getErrorNumber()
Since: 2.0
Returns an error number returned by the server connector. Available error codes:
0 : No errors.
1 : Custom error - check @link CKFinder.xml.getErrorMessage
10 : Invalid command.
11 : The resource type was not specified in the request.
12 : The requested resource type is not valid.
102 : Invalid file or folder name.
103 : It was not possible to complete the request due to authorization restrictions.
104 : It was not possible to complete the request due to file system permission restrictions.
105 : Invalid file extension.
109 : Invalid request.
110 : Unknown error. (Usually returned when an unexpected exception occurred.)
115 : A file or folder with the same name already exists.
116 : Folder not found. Please refresh and try again.
117 : File not found. Please refresh the files list and try again.
118 : Source and target paths are equal.
201 : A file with the same name is already available. The uploaded file has been renamed.
202 : Invalid file
203 : Invalid file. The file size is too big.
204 : The uploaded file is corrupt.
205 : No temporary folder is available for upload in the server.
206 : Upload cancelled for security reasons. The file contains HTML like data.
207 : The uploaded file has been renamed.
300 : Moving file(s) failed.
301 : Copying file(s) failed.
500 : The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.
501 : The thumbnails support is disabled.
var errorNumber = xml.getErrorNumber();
Returns:
{Integer} Error code.
See:
CKFinder.xml.checkError

{String} getInnerXml(xpath, contextNode)
Since: 2.0
Gets the string representation of the inner contents of a XML node, based on a XPath query.
// Initial XML document:
// <list><item id="test1" /><item id="test2" /></list>

// Alert "<item id="test1" /><item id="test2" />".
alert( xml.getInnerXml( 'list' ) );
Parameters:
{String} xpath
The XPath query to execute.
{Object} contextNode Optional
The XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns:
{String} The textual representation of the inner contents of the node or null if the query has no results.

{ArrayLike} selectNodes(xpath, contextNode)
Since: 2.0
Gets a list node from the XML document, based on a XPath query.
// Initial XML document:
// <list><item id="test1" /><item id="test2" /></list>

// Get the first <item> node.
var itemNodes = xml.selectNodes( 'list/item' );
// Alert "item" twice, one for each .
for ( var i = 0 ; i < itemNodes.length ; i++ )
    alert( itemNodes[i].nodeName );
Parameters:
{String} xpath
The XPath query to execute.
{Object} contextNode Optional
The XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns:
{ArrayLike} An array containing all matched nodes. The array will be empty if the query has no results.

{Object} selectSingleNode(xpath, contextNode)
Since: 2.0
Get a single node from the XML document, based on a XPath query.
// Initial XML document:
// <list><item id="test1" /><item id="test2" /></list>

// Get the first <item> node.
var itemNode = xml.selectSingleNode( 'list/item' );
// Alert "item".
alert( itemNode.nodeName );
Parameters:
{String} xpath
The XPath query to execute.
{Object} contextNode Optional
The XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns:
{Object} A XML node element or null if the query has no results.

Copyright © 2007-2015, CKSource - Frederico Knabben. All rights reserved.