CDATA代表
Character Data,这意味着这些字符串之间的数据包括可以解释为XML标记的数据,但不应该。
原文链接:https://www.f2er.com/xml/294360.htmlCDATA和注释之间的主要区别是:
> As Richard points out,CDATA仍然是文档的一部分,而注释不是。
>在CDATA中,您不能包括字符串]]> (CDEnd
),而在评论--
is invalid。
> Parameter Entity在注释内部无法识别引用。
这意味着从一个格式良好的文档中提供这三个XML片段:
<!ENTITY MyParamEntity "Has been expanded">
<!-- Within this comment I can use ]]> and other reserved characters like < &,',and ",but %MyParamEntity; will not be expanded (if I retrieve the text of this node it will contain %MyParamEntity; and not "Has been expanded") and I can't place two dashes next to each other. -->
<![CDATA[ Within this Character Data block I can use double dashes as much as I want (along with <,&,and ") *and* %MyParamEntity; will be expanded to the text "Has been expanded" ... however,I can't use the CEND sequence (if I need to use it I must escape one of the brackets or the greater-than sign). ]]>