Dom 简明教程
DOM - CDATASection Object
在本章中,我们将学习 XML DOM CDATASection 对象。XML 文档中的文本是已解析或未解析的,具体取决于声明方式。如果文本被声明为已解析的字符数据 (PCDATA),则它将由解析器解析,以将 XML 文档转换为 XML DOM 对象。另一方面,如果文本被声明为未解析字符数据 (CDATA),则 XML 解析器不会解析其中的文本。这些不被视为标记,也绝不会展开实体。
In this chapter, we will study about the XML DOM CDATASection Object. The text present within an XML document is parsed or unparsed depending on what it is declared. If the text is declared as Parse Character Data (PCDATA), it is parsed by the parser to convert an XML document into an XML DOM Object. On the other hand, if the text is declared as the unparsed Character Data (CDATA) the text within is not parsed by the XML parser. These are not considered as the markup and will not expand the entities.
使用 CDATASection 对象的目的是转义包含字符的文本块,其他情况下这些字符将被视为标记。 "]]>" ,这是在终止 CDATA 部分的 CDATA 部分中识别的唯一分隔符。
The purpose of using the CDATASection object is to escape the blocks of text containing characters that would otherwise be regarded as markup. "]]>", this is the only delimiter recognized in a CDATA section that ends the CDATA section.
CharacterData.data 属性保存由 CDATA 部分包含的文本。此接口通过 Text 接口继承 CharacterData 接口。
The CharacterData.data attribute holds the text that is contained by the CDATA section. This interface inherits the CharatcterData interface through the Text interface.