第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

<![CDATA[]>在XML中意味著什么?

<![CDATA[]>在XML中意味著什么?

繁花不似錦 2019-06-03 16:58:58
<![CDATA[]>在XML中意味著什么?我經(jīng)常覺得這很奇怪CDATA標(biāo)記入XML檔案:<![CDATA[some stuff]]>我注意到CDATA標(biāo)簽總是出現(xiàn)在開頭,然后跟著一些東西。但有時(shí)它被使用,有時(shí)卻不是。我想是為了標(biāo)記some stuff是在之后插入的“數(shù)據(jù)”。但是什么樣的數(shù)據(jù)是some stuff?我用XML標(biāo)記寫的東西難道不是某種數(shù)據(jù)嗎?
查看完整描述

3 回答

?
慕村225694

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊

CDATA代表字符數(shù)據(jù)這意味著這些字符串之間的數(shù)據(jù)包括被解釋為XML標(biāo)記,但不應(yīng)該解釋為XML標(biāo)記。

CDATA與評論之間的主要區(qū)別是:

這意味著從一個(gè)格式良好的文檔中獲得這三個(gè)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 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>


查看完整回答
反對 回復(fù) 2019-06-03
?
開心每一天1111

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊

一個(gè)很大的用例:您的XML包含一個(gè)程序,作為數(shù)據(jù)(例如,Java的網(wǎng)頁教程)。在這種情況下,您的數(shù)據(jù)包含大量字符,其中包括‘&’和‘<’,但是這些字符不應(yīng)該是XML。

比較:

<example-code>while (x &lt; len &amp;&amp; !done) {
    print( &quot;Still working, &apos;zzz&apos;.&quot; );
    ++x;
    }</example-code>

帶著

<example-code><![CDATA[
while (x < len && !done) {
    print( "Still working, 'zzzz'." );
    ++x;
    }
]]></example-code>

特別是如果您正在從文件中復(fù)制/粘貼這段代碼(或者將其包括在預(yù)處理器中),那么在XML文件中只包含您想要的字符是很好的,w/o將它們與XML標(biāo)記/屬性混為一談。正如@paary所提到的,其他常見用途包括嵌入包含符號的URL時(shí)。最后,即使數(shù)據(jù)只包含幾個(gè)特殊字符,但數(shù)據(jù)很長(比如說,一章的文本),在編輯XML文件時(shí)不必對這幾個(gè)實(shí)體進(jìn)行編碼也很好。

(我懷疑所有與評論的比較都有點(diǎn)誤導(dǎo)/毫無幫助。)


查看完整回答
反對 回復(fù) 2019-06-03
  • 3 回答
  • 0 關(guān)注
  • 3208 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號