CKEditor 4 Documentation

CKEDITOR.xml

Files

Represents a loaded XML document.

var xml = new CKEDITOR.xml( '<books><book title="My Book" /></books>' );
Defined By

Properties

CKEDITOR.xml
view source
: Object

The native XML (DOM document) used by the class instance.

The native XML (DOM document) used by the class instance.

Defined By

Methods

CKEDITOR.xml
view source
new( xmlObjectOrData ) : CKEDITOR.xml
Creates xml class instance. ...

Creates xml class instance.

Parameters

  • xmlObjectOrData : Object/String

    A native XML (DOM document) object or a string containing the XML definition to be loaded.

Returns

CKEDITOR.xml
view source
( xpath, [contextNode] ) : String
Gets the string representation of hte inner contents of a XML node, based on a XPath query. ...

Gets the string representation of hte inner contents of a XML node, based on a XPath query.

// Create the XML instance.
var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
// Alert "<item id="test1" /><item id="test2" />".
alert( xml.getInnerXml( 'list' ) );

Parameters

  • xpath : String

    The XPath query to execute.

  • contextNode : Object (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.

CKEDITOR.xml
view source
( xpath, [contextNode] ) : Array
Gets a list node from the XML document, based on a XPath query. ...

Gets a list node from the XML document, based on a XPath query.

// Create the XML instance.
var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
// Get all <item> nodes.
var itemNodes = xml.selectNodes( 'list/item' );
// Alert "item" twice, one for each <item>.
for ( var i = 0; i < itemNodes.length; i++ )
    alert( itemNodes[i].nodeName );

Parameters

  • xpath : String

    The XPath query to execute.

  • contextNode : Object (optional)

    The XML DOM node to be used as the context for the XPath query. The document root is used by default.

Returns

  • Array

    An array containing all matched nodes. The array will be empty if the query has no results.

CKEDITOR.xml
view source
( xpath, [contextNode] ) : Object
Get a single node from the XML document, based on a XPath query. ...

Get a single node from the XML document, based on a XPath query.

// Create the XML instance.
var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
// Get the first <item> node.
var itemNode = <b>xml.selectSingleNode( 'list/item' )</b>;
// Alert "item".
alert( itemNode.nodeName );

Parameters

  • xpath : String

    The XPath query to execute.

  • contextNode : Object (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.