CKEDITOR.xml
Represents a loaded XML document.
var xml = new CKEDITOR.xml( '<books><book title="My Book" /></books>' );
Filtering
Properties
-
baseXml : ObjectCKEDITOR.xml#baseXmlThe native XML (DOM document) used by the class instance.
Methods
-
constructor( xmlObjectOrData ) → xmlCKEDITOR.xml#constructorCreates xml class instance.
Parameters
xmlObjectOrData : Object | StringA native XML (DOM document) object or a string containing the XML definition to be loaded.
Returns
xml
-
getInnerXml( xpath, [ contextNode ] ) → StringCKEDITOR.xml#getInnerXmlGets 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 : StringThe XPath query to execute.
[ contextNode ] : ObjectThe XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns
StringThe textual representation of the inner contents of the node or null if the query has no results.
-
selectNodes( xpath, [ contextNode ] ) → ArrayCKEDITOR.xml#selectNodesGets 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 : StringThe XPath query to execute.
[ contextNode ] : ObjectThe XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns
ArrayAn array containing all matched nodes. The array will be empty if the query has no results.
-
selectSingleNode( xpath, [ contextNode ] ) → ObjectCKEDITOR.xml#selectSingleNodeGet 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 : StringThe XPath query to execute.
[ contextNode ] : ObjectThe XML DOM node to be used as the context for the XPath query. The document root is used by default.
Returns
ObjectA XML node element or null if the query has no results.