Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 399449 of CDATASection

  • Revision slug: Web/API/CDATASection
  • Revision title: CDATASection
  • Revision id: 399449
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment DOM/CDATASection Web/API/CDATASection

Revision Content

A CDATA Section can be used within XML to include extended portions of unescaped text, such that the symbols < and & do not need escaping as they normally do within XML when used as text.

It takes the form:

<![CDATA[  ... ]]>

For example:

<foo>Here is a CDATA section: <![CDATA[  < > & ]]> with all kinds of unescaped text. </foo>

The only sequence which is not allowed within a CDATA section is the closing sequence of a CDATA section itself:

<![CDATA[  ]]> will cause an error   ]]>

Note that CDATA sections should not be used (without hiding) within HTML.

As a CDATASection has no properties or methods unique to itself and only directly implements the Text interface, one can refer to {{domxref("Text")}} to find its properties and methods.

Specification

Revision Source

<p>A CDATA Section can be used within XML to include extended portions of unescaped text, such that the symbols &lt; and &amp; do not need escaping as they normally do within XML when used as text.</p>
<p>It takes the form:</p>

<pre class="syntaxbox">
&lt;![CDATA[  ... ]]&gt;
</pre>

<p>For example:</p>

<pre class="brush:xml">
&lt;foo&gt;Here is a CDATA section: &lt;![CDATA[  &lt; &gt; &amp; ]]&gt; with all kinds of unescaped text. &lt;/foo&gt;
</pre>

<p>The only sequence which is not allowed within a CDATA section is the closing sequence of a CDATA section itself:</p>

<pre class="brush:xml">
&lt;![CDATA[  ]]&gt; will cause an error   ]]&gt;
</pre>

<p>Note that CDATA sections should not be used (without hiding) within HTML.</p>
<p>As a CDATASection has no properties or methods unique to itself and only directly implements the Text interface, one can refer to {{domxref("Text")}} to find its properties and methods.</p>

<h2 id="Specification">Specification</h2>
<ul>
  <li><a class="external" href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-667469212" rel="freelink">https://www.w3.org/TR/DOM-Level-3-Cor...l#ID-667469212</a></li>
</ul>
Revert to this revision