<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://docs-old.ckeditor.com/index.php?action=history&amp;feed=atom&amp;title=CKEditor_3.x%2FDevelopers_Guide%2FData_Processor</id>
		<title>CKEditor 3.x/Developers Guide/Data Processor - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://docs-old.ckeditor.com/index.php?action=history&amp;feed=atom&amp;title=CKEditor_3.x%2FDevelopers_Guide%2FData_Processor"/>
		<link rel="alternate" type="text/html" href="https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;action=history"/>
		<updated>2026-05-16T21:57:37Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.29.1</generator>

	<entry>
		<id>https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4436&amp;oldid=prev</id>
		<title>Fredck: /* HTML Parser Filters */</title>
		<link rel="alternate" type="text/html" href="https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4436&amp;oldid=prev"/>
				<updated>2010-10-20T15:32:39Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;HTML Parser Filters&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:32, 20 October 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l51&quot; &gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; if ( !element.attributes.alt )&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; if ( !element.attributes.alt )&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;elements&lt;/del&gt;.attributes.alt = 'An image';&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;element&lt;/ins&gt;.attributes.alt = 'An image';&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key ckeditor_docsold:diff:version:1.11a:oldid:4435:newid:4436 --&gt;
&lt;/table&gt;</summary>
		<author><name>Fredck</name></author>	</entry>

	<entry>
		<id>https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4435&amp;oldid=prev</id>
		<title>Fredck at 15:24, 20 October 2010</title>
		<link rel="alternate" type="text/html" href="https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4435&amp;oldid=prev"/>
				<updated>2010-10-20T15:24:40Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:24, 20 October 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CKEditor is a '''browser based''' editor. It means it uses the browser infrastructure to create its editing environment. Because of this the editing area in the editor is simply an HTML page that's manipulated by the user by typing or by using the editor features. Technically speaking, CKEditor is performing [http://en.wikipedia.org/wiki/Document_Object_Model DOM] manipulation on the page contents.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;{{#CUSTOMTITLE:Data Processor: Data Input and Output Manipulation}}&lt;/ins&gt;CKEditor is a '''browser based''' editor. It means it uses the browser infrastructure to create its editing environment. Because of this the editing area in the editor is simply an HTML page that's manipulated by the user by typing or by using the editor features. Technically speaking, CKEditor is performing [http://en.wikipedia.org/wiki/Document_Object_Model DOM] manipulation on the page contents.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Even if CKEditor uses HTML and the browser DOM as its base for editing, it is possible to input and output any kind of data on it. This data transformation is handled by the so called &amp;quot;Data Processor&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Even if CKEditor uses HTML and the browser DOM as its base for editing, it is possible to input and output any kind of data on it. This data transformation is handled by the so called &amp;quot;Data Processor&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key ckeditor_docsold:diff:version:1.11a:oldid:4434:newid:4435 --&gt;
&lt;/table&gt;</summary>
		<author><name>Fredck</name></author>	</entry>

	<entry>
		<id>https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4434&amp;oldid=prev</id>
		<title>Fredck: Created page with 'CKEditor is a '''browser based''' editor. It means it uses the browser infrastructure to create its editing environment. Because of this the editing area in the editor is simply …'</title>
		<link rel="alternate" type="text/html" href="https://docs-old.ckeditor.com/index.php?title=CKEditor_3.x/Developers_Guide/Data_Processor&amp;diff=4434&amp;oldid=prev"/>
				<updated>2010-10-20T15:23:30Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;CKEditor is a &amp;#039;&amp;#039;&amp;#039;browser based&amp;#039;&amp;#039;&amp;#039; editor. It means it uses the browser infrastructure to create its editing environment. Because of this the editing area in the editor is simply …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;CKEditor is a '''browser based''' editor. It means it uses the browser infrastructure to create its editing environment. Because of this the editing area in the editor is simply an HTML page that's manipulated by the user by typing or by using the editor features. Technically speaking, CKEditor is performing [http://en.wikipedia.org/wiki/Document_Object_Model DOM] manipulation on the page contents.&lt;br /&gt;
&lt;br /&gt;
Even if CKEditor uses HTML and the browser DOM as its base for editing, it is possible to input and output any kind of data on it. This data transformation is handled by the so called &amp;quot;Data Processor&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== The Data Processor ==&lt;br /&gt;
&lt;br /&gt;
The Data Processor is an object, in the JavaScript point of view, which transforms the input data into HTML, and back to the output data format later. This transformation is provided by the [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dataProcessor.html#toHtml toHtml] and [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dataProcessor.html#toDataFormat toDataFormat] functions, respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:CKEditor_Data_Processor.png]]&lt;br /&gt;
&lt;br /&gt;
== The Default Data Processor: XHTML ==&lt;br /&gt;
&lt;br /&gt;
CKEditor is distributed with an XHTML Data Processor. This may sound strange, but it transforms the (X)HTML data inputted in the editor into &amp;quot;good&amp;quot; HTML. In this process it also makes some transformations required by some of the editor features. &lt;br /&gt;
&lt;br /&gt;
The XHTML Data Processor is quite a complex, and flexible, piece of program. It's composed by several parts:&lt;br /&gt;
&lt;br /&gt;
[[File:CKEditor_XHTML_Data_Processor.png]]&lt;br /&gt;
&lt;br /&gt;
* HTML Parser: reads the HTML inputted in the editor, transforming it into &amp;quot;good&amp;quot; html. It also transforms the HTML string into a JavaScript object tree, to be manipulated by &amp;quot;filters&amp;quot;. See [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.htmlParser.html CKEDITOR.htmlParser].&lt;br /&gt;
&lt;br /&gt;
* HTML Writer: outputs strings in HTML format based on the object tree representation of the data.&lt;br /&gt;
Note that the HTML Parser is used on output as well, when retrieving the HTML from the browser. This is needed because browsers, especially IE, may produce bad quality code.&lt;br /&gt;
&lt;br /&gt;
The default Data Processor can be retrieved and manipulated by the [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#dataProcessor editor.dataProcessor] property.&lt;br /&gt;
&lt;br /&gt;
== HTML Parser Filters ==&lt;br /&gt;
&lt;br /&gt;
Filters are one of the powerful features available on the HTML Parser. They're applied to the object representation of the parsed HTML data when transforming it back to strings. &lt;br /&gt;
&lt;br /&gt;
Some of the application of filters are:&lt;br /&gt;
&lt;br /&gt;
* Remove attributes from elements.&lt;br /&gt;
* Rewrite elements attributes values.&lt;br /&gt;
* Rename element names or attributes.&lt;br /&gt;
* Add missing attributes to elements.&lt;br /&gt;
* Etc...&lt;br /&gt;
&lt;br /&gt;
The default XHTML Data Processor already applies several filters either on input and on output of data. You can extend it by adding custom filter rules (calling addRules()) to the following objects:&lt;br /&gt;
&lt;br /&gt;
* editor.dataProcessor.dataFilter: filter applied to the input data when transforming it to HTML to be loaded into the editor (&amp;quot;on input&amp;quot;).&lt;br /&gt;
* editor.dataProcessor.htmlFilter: filter applied to the HTML available in the editor when transforming it on the XHTML outputted by the editor (&amp;quot;on output&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
For example, the following code will ensure that &amp;amp;lt;img&amp;amp;gt; elements will have their &amp;quot;alt&amp;quot; attribute filled:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
editor.dataProcessor.htmlFilter.addRules(&lt;br /&gt;
    {&lt;br /&gt;
        elements :&lt;br /&gt;
        {&lt;br /&gt;
            img : function( element )&lt;br /&gt;
            {&lt;br /&gt;
                if ( !element.attributes.alt )&lt;br /&gt;
                    elements.attributes.alt = 'An image';&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Custom Data Processors ==&lt;br /&gt;
&lt;br /&gt;
Plugin implementers can create data processors, which can transform custom non HTML data formats to be loaded and outputted by the editor. For example, there could be data processors for [http://en.wikipedia.org/wiki/BBCode BBCode], [http://en.wikipedia.org/wiki/Wiki_markup Wiki markup], or any other kind of structured data markup. Even server side transformation could be considered, by executing [http://en.wikipedia.org/wiki/XMLHttpRequest Ajax style calls] from the data processor code.&lt;br /&gt;
&lt;br /&gt;
To make the editor use a custom data processor, it's enough to set [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#dataProcessor editor.dataProcessor] to an object implementing the [http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dataProcessor.html data processor interface], replacing the default XHTML Data Processor.&lt;br /&gt;
&lt;br /&gt;
Custom data processors may use parts of the default XHTML Data Processor code, including the HTML Parser or even the HTML Writer. It's recommended checking the [http://dev.ckeditor.com/browser/CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js htmldataprocessor plugin code] for reference and ideas.&lt;/div&gt;</summary>
		<author><name>Fredck</name></author>	</entry>

	</feed>