GNU Classpath (0.95) | |
Frames | No Frames |
1: /* 2: * Copyright (c) 2004 World Wide Web Consortium, 3: * 4: * (Massachusetts Institute of Technology, European Research Consortium for 5: * Informatics and Mathematics, Keio University). All Rights Reserved. This 6: * work is distributed under the W3C(r) Software License [1] in the hope that 7: * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9: * 10: * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11: */ 12: 13: package org.w3c.dom; 14: 15: /** 16: * CDATA sections are used to escape blocks of text containing characters that 17: * would otherwise be regarded as markup. The only delimiter that is 18: * recognized in a CDATA section is the "]]>" string that ends the CDATA 19: * section. CDATA sections cannot be nested. Their primary purpose is for 20: * including material such as XML fragments, without needing to escape all 21: * the delimiters. 22: * <p>The <code>CharacterData.data</code> attribute holds the text that is 23: * contained by the CDATA section. Note that this <em>may</em> contain characters that need to be escaped outside of CDATA sections and 24: * that, depending on the character encoding ("charset") chosen for 25: * serialization, it may be impossible to write out some characters as part 26: * of a CDATA section. 27: * <p>The <code>CDATASection</code> interface inherits from the 28: * <code>CharacterData</code> interface through the <code>Text</code> 29: * interface. Adjacent <code>CDATASection</code> nodes are not merged by use 30: * of the <code>normalize</code> method of the <code>Node</code> interface. 31: * <p> No lexical check is done on the content of a CDATA section and it is 32: * therefore possible to have the character sequence <code>"]]>"</code> 33: * in the content, which is illegal in a CDATA section per section 2.7 of [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. The 34: * presence of this character sequence must generate a fatal error during 35: * serialization or the cdata section must be splitted before the 36: * serialization (see also the parameter <code>"split-cdata-sections"</code> 37: * in the <code>DOMConfiguration</code> interface). 38: * <p ><b>Note:</b> Because no markup is recognized within a 39: * <code>CDATASection</code>, character numeric references cannot be used as 40: * an escape mechanism when serializing. Therefore, action needs to be taken 41: * when serializing a <code>CDATASection</code> with a character encoding 42: * where some of the contained characters cannot be represented. Failure to 43: * do so would not produce well-formed XML. 44: * <p ><b>Note:</b> One potential solution in the serialization process is to 45: * end the CDATA section before the character, output the character using a 46: * character reference or entity reference, and open a new CDATA section for 47: * any further characters in the text node. Note, however, that some code 48: * conversion libraries at the time of writing do not return an error or 49: * exception when a character is missing from the encoding, making the task 50: * of ensuring that data is not corrupted on serialization more difficult. 51: * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>. 52: */ 53: public interface CDATASection extends Text { 54: }
GNU Classpath (0.95) |