org.w3c.dom
Interface CDATASection

All Superinterfaces:
CharacterData sample code for org.w3c.dom.CharacterData definition code for org.w3c.dom.CharacterData , Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node , Text sample code for org.w3c.dom.Text definition code for org.w3c.dom.Text

public interface CDATASection
extends Text sample code for org.w3c.dom.Text definition code for org.w3c.dom.Text

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

The CharacterData.data attribute holds the text that is contained by the CDATA section. Note that this may contain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

The CDATASection interface inherits from the CharacterData interface through the Text interface. Adjacent CDATASection nodes are not merged by use of the normalize method of the Node interface.

No lexical check is done on the content of a CDATA section and it is therefore possible to have the character sequence "]]>" in the content, which is illegal in a CDATA section per section 2.7 of [XML 1.0]. The presence of this character sequence must generate a fatal error during serialization or the cdata section must be splitted before the serialization (see also the parameter "split-cdata-sections" in the DOMConfiguration interface).

Note: Because no markup is recognized within a CDATASection, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing a CDATASection with a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.

Note: One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.

See also the Document Object Model (DOM) Level 3 Core Specification.


Field Summary
 
Fields inherited from interface org.w3c.dom.Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node
ATTRIBUTE_NODE sample code for org.w3c.dom.Node.ATTRIBUTE_NODE definition code for org.w3c.dom.Node.ATTRIBUTE_NODE , CDATA_SECTION_NODE sample code for org.w3c.dom.Node.CDATA_SECTION_NODE definition code for org.w3c.dom.Node.CDATA_SECTION_NODE , COMMENT_NODE sample code for org.w3c.dom.Node.COMMENT_NODE definition code for org.w3c.dom.Node.COMMENT_NODE , DOCUMENT_FRAGMENT_NODE sample code for org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE definition code for org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE , DOCUMENT_NODE sample code for org.w3c.dom.Node.DOCUMENT_NODE definition code for org.w3c.dom.Node.DOCUMENT_NODE , DOCUMENT_POSITION_CONTAINED_BY sample code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY definition code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY , DOCUMENT_POSITION_CONTAINS sample code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS definition code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS , DOCUMENT_POSITION_DISCONNECTED sample code for org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED definition code for org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED , DOCUMENT_POSITION_FOLLOWING sample code for org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING definition code for org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING , DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC sample code for org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC definition code for org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC , DOCUMENT_POSITION_PRECEDING sample code for org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING definition code for org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING , DOCUMENT_TYPE_NODE sample code for org.w3c.dom.Node.DOCUMENT_TYPE_NODE definition code for org.w3c.dom.Node.DOCUMENT_TYPE_NODE , ELEMENT_NODE sample code for org.w3c.dom.Node.ELEMENT_NODE definition code for org.w3c.dom.Node.ELEMENT_NODE , ENTITY_NODE sample code for org.w3c.dom.Node.ENTITY_NODE definition code for org.w3c.dom.Node.ENTITY_NODE , ENTITY_REFERENCE_NODE sample code for org.w3c.dom.Node.ENTITY_REFERENCE_NODE definition code for org.w3c.dom.Node.ENTITY_REFERENCE_NODE , NOTATION_NODE sample code for org.w3c.dom.Node.NOTATION_NODE definition code for org.w3c.dom.Node.NOTATION_NODE , PROCESSING_INSTRUCTION_NODE sample code for org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE definition code for org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE , TEXT_NODE sample code for org.w3c.dom.Node.TEXT_NODE definition code for org.w3c.dom.Node.TEXT_NODE
 
Method Summary
 
Methods inherited from interface org.w3c.dom.Text sample code for org.w3c.dom.Text definition code for org.w3c.dom.Text
getWholeText sample code for org.w3c.dom.Text.getWholeText() definition code for org.w3c.dom.Text.getWholeText() , isElementContentWhitespace sample code for org.w3c.dom.Text.isElementContentWhitespace() definition code for org.w3c.dom.Text.isElementContentWhitespace() , replaceWholeText sample code for org.w3c.dom.Text.replaceWholeText(java.lang.String) definition code for org.w3c.dom.Text.replaceWholeText(java.lang.String) , splitText sample code for org.w3c.dom.Text.splitText(int) definition code for org.w3c.dom.Text.splitText(int)
 
Methods inherited from interface org.w3c.dom.CharacterData sample code for org.w3c.dom.CharacterData definition code for org.w3c.dom.CharacterData
appendData sample code for org.w3c.dom.CharacterData.appendData(java.lang.String) definition code for org.w3c.dom.CharacterData.appendData(java.lang.String) , deleteData sample code for org.w3c.dom.CharacterData.deleteData(int, int) definition code for org.w3c.dom.CharacterData.deleteData(int, int) , getData sample code for org.w3c.dom.CharacterData.getData() definition code for org.w3c.dom.CharacterData.getData() , getLength sample code for org.w3c.dom.CharacterData.getLength() definition code for org.w3c.dom.CharacterData.getLength() , insertData sample code for org.w3c.dom.CharacterData.insertData(int, java.lang.String) definition code for org.w3c.dom.CharacterData.insertData(int, java.lang.String) , replaceData sample code for org.w3c.dom.CharacterData.replaceData(int, int, java.lang.String) definition code for org.w3c.dom.CharacterData.replaceData(int, int, java.lang.String) , setData sample code for org.w3c.dom.CharacterData.setData(java.lang.String) definition code for org.w3c.dom.CharacterData.setData(java.lang.String) , substringData sample code for org.w3c.dom.CharacterData.substringData(int, int) definition code for org.w3c.dom.CharacterData.substringData(int, int)
 
Methods inherited from interface org.w3c.dom.Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node
appendChild sample code for org.w3c.dom.Node.appendChild(org.w3c.dom.Node) definition code for org.w3c.dom.Node.appendChild(org.w3c.dom.Node) , cloneNode sample code for org.w3c.dom.Node.cloneNode(boolean) definition code for org.w3c.dom.Node.cloneNode(boolean) , compareDocumentPosition sample code for org.w3c.dom.Node.compareDocumentPosition(org.w3c.dom.Node) definition code for org.w3c.dom.Node.compareDocumentPosition(org.w3c.dom.Node) , getAttributes sample code for org.w3c.dom.Node.getAttributes() definition code for org.w3c.dom.Node.getAttributes() , getBaseURI sample code for org.w3c.dom.Node.getBaseURI() definition code for org.w3c.dom.Node.getBaseURI() , getChildNodes sample code for org.w3c.dom.Node.getChildNodes() definition code for org.w3c.dom.Node.getChildNodes() , getFeature sample code for org.w3c.dom.Node.getFeature(java.lang.String, java.lang.String) definition code for org.w3c.dom.Node.getFeature(java.lang.String, java.lang.String) , getFirstChild sample code for org.w3c.dom.Node.getFirstChild() definition code for org.w3c.dom.Node.getFirstChild() , getLastChild sample code for org.w3c.dom.Node.getLastChild() definition code for org.w3c.dom.Node.getLastChild() , getLocalName sample code for org.w3c.dom.Node.getLocalName() definition code for org.w3c.dom.Node.getLocalName() , getNamespaceURI sample code for org.w3c.dom.Node.getNamespaceURI() definition code for org.w3c.dom.Node.getNamespaceURI() , getNextSibling sample code for org.w3c.dom.Node.getNextSibling() definition code for org.w3c.dom.Node.getNextSibling() , getNodeName sample code for org.w3c.dom.Node.getNodeName() definition code for org.w3c.dom.Node.getNodeName() , getNodeType sample code for org.w3c.dom.Node.getNodeType() definition code for org.w3c.dom.Node.getNodeType() , getNodeValue sample code for org.w3c.dom.Node.getNodeValue() definition code for org.w3c.dom.Node.getNodeValue() , getOwnerDocument sample code for org.w3c.dom.Node.getOwnerDocument() definition code for org.w3c.dom.Node.getOwnerDocument() , getParentNode sample code for org.w3c.dom.Node.getParentNode() definition code for org.w3c.dom.Node.getParentNode() , getPrefix sample code for org.w3c.dom.Node.getPrefix() definition code for org.w3c.dom.Node.getPrefix() , getPreviousSibling sample code for org.w3c.dom.Node.getPreviousSibling() definition code for org.w3c.dom.Node.getPreviousSibling() , getTextContent sample code for org.w3c.dom.Node.getTextContent() definition code for org.w3c.dom.Node.getTextContent() , getUserData sample code for org.w3c.dom.Node.getUserData(java.lang.String) definition code for org.w3c.dom.Node.getUserData(java.lang.String) , hasAttributes sample code for org.w3c.dom.Node.hasAttributes() definition code for org.w3c.dom.Node.hasAttributes() , hasChildNodes sample code for org.w3c.dom.Node.hasChildNodes() definition code for org.w3c.dom.Node.hasChildNodes() , insertBefore sample code for org.w3c.dom.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) definition code for org.w3c.dom.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) , isDefaultNamespace sample code for org.w3c.dom.Node.isDefaultNamespace(java.lang.String) definition code for org.w3c.dom.Node.isDefaultNamespace(java.lang.String) , isEqualNode sample code for org.w3c.dom.Node.isEqualNode(org.w3c.dom.Node) definition code for org.w3c.dom.Node.isEqualNode(org.w3c.dom.Node) , isSameNode sample code for org.w3c.dom.Node.isSameNode(org.w3c.dom.Node) definition code for org.w3c.dom.Node.isSameNode(org.w3c.dom.Node) , isSupported sample code for org.w3c.dom.Node.isSupported(java.lang.String, java.lang.String) definition code for org.w3c.dom.Node.isSupported(java.lang.String, java.lang.String) , lookupNamespaceURI sample code for org.w3c.dom.Node.lookupNamespaceURI(java.lang.String) definition code for org.w3c.dom.Node.lookupNamespaceURI(java.lang.String) , lookupPrefix sample code for org.w3c.dom.Node.lookupPrefix(java.lang.String) definition code for org.w3c.dom.Node.lookupPrefix(java.lang.String) , normalize sample code for org.w3c.dom.Node.normalize() definition code for org.w3c.dom.Node.normalize() , removeChild sample code for org.w3c.dom.Node.removeChild(org.w3c.dom.Node) definition code for org.w3c.dom.Node.removeChild(org.w3c.dom.Node) , replaceChild sample code for org.w3c.dom.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) definition code for org.w3c.dom.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) , setNodeValue sample code for org.w3c.dom.Node.setNodeValue(java.lang.String) definition code for org.w3c.dom.Node.setNodeValue(java.lang.String) , setPrefix sample code for org.w3c.dom.Node.setPrefix(java.lang.String) definition code for org.w3c.dom.Node.setPrefix(java.lang.String) , setTextContent sample code for org.w3c.dom.Node.setTextContent(java.lang.String) definition code for org.w3c.dom.Node.setTextContent(java.lang.String) , setUserData sample code for org.w3c.dom.Node.setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler) definition code for org.w3c.dom.Node.setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler)