为什么在这个 <![CDATA[]]> 中包含 XML 标记数据? [英] Why XML tag data inside this <![CDATA[]]>
问题描述
我在很多 XML 文件中看到过这个 <![CDATA[ ]]>
里面的数据.这有什么用?
I have seen in many XML file has the data inside this <![CDATA[ ]]>
. What is the use of this?
推荐答案
来自维基百科
CDATA 部分以下列顺序开始:
A CDATA section starts with the following sequence:
<![CDATA[
并以第一次出现的序列结束:
and ends with the first occurrence of the sequence:
]]>
这两个序列之间包含的所有字符都被解释为字符,而不是标记或实体引用.例如,在这样的一行中:
All characters enclosed between these two sequences are interpreted as characters, not markup or entity references. For example, in a line like this:
<sender>John Smith</sender>
开始和结束sender"标签被解释为标记.但是,如果这样写:
the opening and closing "sender" tags are interpreted as markup. However, if written like this:
<![CDATA[<sender>John Smith</sender>]]>
然后代码被解释为就像它是这样写的一样:
then the code is interpreted the same as if it had been written like this:
<sender>John Smith</sender>
查看维基页面了解更多详情.
Check out the Wiki page for more details.
这篇关于为什么在这个 <![CDATA[]]> 中包含 XML 标记数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!