The CDATASection Interface

The CDATASection interface, shown in Example 11.11, is a subinterface of Text that specifically represents CDATA sections. It has no unique methods of its own, but when a CDATASection is serialized into a file, the text of the node may be wrapped inside CDATA section markers. As a result, characters such as ampersand and the less-than sign do not need to be escaped as & and <.

Example 11.11. The CDATASection Interface
package org.w3c.dom;

public interface CDATASection extends Text {

}

CDATA sections are convenient syntax sugar for documents that will sometimes be read or authored by human beings in source code form. The source code for this book uses them frequently for examples. Please don't use CDATA sections ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.