XmlDataProcessor (engine/dataprocessor)
@ckeditor/ckeditor5-engine/src/dataprocessor/xmldataprocessor
The XML data processor class.
This data processor implementation uses XML as input and output data.
This class is needed because unlike HTML, XML allows to use any tag with any value.
For example, <link>Text</link>
is a valid XML but invalid HTML.
Filtering
Properties
-
domConverter : DomConverter
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#domConverter
DOM converter used to convert DOM elements to view elements.
-
domParser : DOMParser
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#domParser
DOM parser instance used to parse an XML string to an XML document.
-
htmlWriter : HtmlWriter
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#htmlWriter
A basic HTML writer instance used to convert DOM elements to an XML string. There is no need to use a dedicated XML writer because the basic HTML writer works well in this case.
-
namespaces : Array.<String>
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#namespaces
A list of namespaces allowed to use in the XML input.
For example, registering namespaces [ 'attribute', 'container' ] allows to use
<attirbute:tagName></attribute:tagName>
and<container:tagName></container:tagName>
input. It is mainly for debugging.
Methods
-
constructor( document, options = { [options.namespaces] } )
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#constructor
Creates a new instance of the XML data processor class.
Parameters
document : Document
The view document instance.
options : Object
Configuration options.
Properties[ options.namespaces ] : Array.<String>
A list of namespaces allowed to use in the XML input.
Defaults to
[]
-
registerRawContentMatcher( pattern )
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#registerRawContentMatcher
Registers a
MatcherPattern
for view elements whose content should be treated as raw data and not processed during the conversion from XML to view elements.The raw data can be later accessed by a custom property of a view element called
"$rawContent"
.Parameters
pattern : MatcherPattern
Pattern matching all view elements whose content should be treated as raw data.
-
toData( viewFragment ) → String
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#toData
Converts the provided document fragment to data format — in this case an XML string.
-
toView( data ) → Node | DocumentFragment | null
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#toView
Converts the provided XML string to a view tree.
Parameters
data : String
An XML string.
Returns
Node | DocumentFragment | null
A converted view element.
-
useFillerType( type )
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#useFillerType
If the processor is set to use marked fillers, it will insert
fillers wrapped in<span>
elements (<span data-cke-filler="true"> </span>
) instead of regular
characters.This mode allows for a more precise handling of block fillers (so they do not leak into editor content) but bloats the editor data with additional markup.
This mode may be required by some features and will be turned on by them automatically.
Parameters
type : 'default' | 'marked'
Whether to use the default or the marked
block fillers.
-
_toDom( data ) → DocumentFragment
module:engine/dataprocessor/xmldataprocessor~XmlDataProcessor#_toDom
private
Converts an XML string to its DOM representation. Returns a document fragment containing nodes parsed from the provided data.
Parameters
data : String
Returns
DocumentFragment
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.