<![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 關注
- 3241 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消