<![CDATA[]>在XML中意味着什么?我经常觉得这很奇怪CDATA标记入XML档案:<![CDATA[some stuff]]>我注意到CDATA标签总是出现在开头,然后跟着一些东西。但有时它被使用,有时却不是。我想是为了标记some stuff是在之后插入的“数据”。但是什么样的数据是some stuff?我用XML标记写的东西难道不是某种数据吗?
3 回答
慕村225694
TA贡献1880条经验 获得超4个赞
<!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 CEND I must escape one of the brackets or the greater-than sign using concatenated CDATA sections. ]]>
<description>An example of escaped CENDs</description><!-- This text contains a CEND ]]> --><!-- In this first case we put the ]] at the end of the first CDATA block and the > in the second CDATA block --><data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data><!-- In this second case we put a ] at the end of the first CDATA block and the ]> in the second CDATA block --><alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative>
开心每一天1111
TA贡献1836条经验 获得超13个赞
<example-code>while (x < len && !done) { print( "Still working, 'zzz'." ); ++x; }</example-code>
<example-code><![CDATA[ while (x < len && !done) { print( "Still working, 'zzzz'." ); ++x; } ]]></example-code>
- 3 回答
- 0 关注
- 3144 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消