吃知柏地黄丸有什么副作用| 芝麻开花节节高是什么意思| 黄精和什么煲汤好| 三个龙念什么| 骨头受伤了吃什么恢复的快| 为什么青蛙跳的比树高| 穿刺是什么| 抑郁状态和抑郁症有什么区别| 沙和尚是什么动物变的| 压抑什么意思| 戒指戴左手中指是什么意思| 多囊为什么要吃避孕药| 垂体泌乳素高是什么原因| 景色奇异的异是什么意思| 美国为什么不打朝鲜| 公务员是干什么工作的| 女性尿路感染挂什么科| 宋朝之前是什么朝代| 来年是什么意思| 交织是什么意思| 12月2号什么星座| 内疚是什么意思| 三点水的字有什么| 藏茶属于什么茶| 夏天种什么水果| 入幕之宾是什么意思| 为什么经常刷牙还牙黄| 榴莲为什么是苦的| 龙冲什么生肖| 蝙蝠粪便是什么中药| 吃完狗肉不能吃什么| 检查是否怀孕挂什么科| 哀大莫过于心死是什么意思| 女生为什么会痛经| 舌头溃疡是什么原因造成的| 一面之词是什么意思| 丈夫早亡的女人什么命| 澳门什么时候回归的| 乐意是什么意思| 心慌胸闷是什么原因| 8月8号什么星座| 五什么十什么成语| 变白吃什么| 煮黑豆吃有什么功效| 下午三点多是什么时辰| 区教育局局长是什么级别| 过房是什么意思| 柠檬不能和什么一起吃| 宴字五行属什么| 宫颈转化区三型是什么意思| 吃什么降火| 心脏传导阻滞是什么意思| 门头是什么意思| 双喜临门指什么生肖| 强的松又叫什么名字| 妇科假丝酵母菌是什么病| 高铁和地铁有什么区别| 42天产后检查都检查什么项目| 减肥为什么要多喝水| 逆天是什么意思| 无稽之谈是什么意思| borel手表是什么牌子| 忽悠什么意思| 鼻涕臭是什么原因| 1920年属什么生肖| 田五行属性是什么| 沉肩是什么意思| 什么是心衰| 肚子胀气吃什么食物| 报工伤需要什么材料| 荞头是什么| xn是什么意思| 咳嗽有痰吃什么药好得最快最有效| 胆囊炎属于什么科| nylon是什么面料成分| 为什么会有脚气| 骨折喝酒有什么影响吗| tj是什么意思| 股票pe是什么意思| 肾在五行中属什么| 王字旁加己念什么| 润月是什么意思| 咳嗽想吐是什么原因| 琪是什么意思| 尿酸高吃什么好| 骨加客念什么| 猪润是什么| 激光脱毛有什么副作用| 什么狗不咬人| 开宠物医院需要什么条件| 林是什么生肖| 字母圈是什么意思| act什么意思| 全身发热是什么原因| 高血压为什么不能献血| 3月18号是什么星座| 生气容易得什么病| 阴虚吃什么好| rsp是什么意思| 科技布是什么材质| 空心人是什么意思| 梦到自己杀人是什么意思| 大姨妈吃什么水果最好| 上海是什么省| 六尘不染的生肖是什么| u盾是什么| 什么样的伤口需要打破伤风针| 薪字五行属什么| 离家出走需要准备什么| 迁坟有什么讲究和忌讳| 为什么要小心吉普赛人| 猫离家出走预示着什么| 吃中药忌口都忌什么| 迷津是什么意思| 水瓶座的幸运色是什么| 胳膊上种花是什么疫苗| 整装待发是什么意思| 榴莲有什么功效| 中午12点到1点是什么时辰| 五脏六腑是指什么| 喝完酒头疼是什么原因| 移植后要注意什么| 脚围指的是什么| 布病什么症状| 人为什么会觉得累| 左后背疼是什么原因| 7月29号是什么日子| 四面八方指什么生肖| 千秋无绝色悦目是佳人什么意思| 桃子有什么功效| 流口水是什么原因| 吃饭快了有什么坏处| 毕业花束选什么花| 天行健下一句是什么| 鳄梨是什么水果| 猫可以吃什么水果| 甲减不能吃什么| 最近老做噩梦是什么原因| 什么是冬虫夏草| 男大女6岁有什么说法| 女性阴道长什么样| 头皮疼是什么原因| 藿香正气水有什么功效| 抽血能检查出什么| 91年是什么命| 中位数是什么意思| 清明节一般开什么生肖| 婶婶是什么意思| 阴虚内热吃什么药好| 哺乳期感冒吃什么药| 汤姆是什么品种的猫| 男性疝气是什么病| 9月26号是什么星座| 额头上长痘是什么原因| 什么的足迹| 周边什么意思| 东星斑为什么这么贵| 随笔是什么意思| 坐骨神经痛是什么原因引起的| 城镇户口是什么意思| 舌苔发黑是什么原因引起的| 子宫肌瘤有什么症状| mirage轮胎什么牌子| 肝内高回声是什么意思| 甘油三酯高是什么意思| 半边脸疼是什么原因| 克罗心是什么牌子| 娇喘什么意思| pc是什么材料| 囊性灶是什么意思| 孕妇梦见猪是什么意思| 什么是备皮| 世风日下什么意思| 下肢静脉曲张是什么原因引起的| 中国肤药膏有什么功效| 狮子座与什么星座最配| 仲夏是什么意思| 吃什么东西对心脏好| 鹦鹉什么时候下蛋| 患难见真情的上一句是什么| 梦见西红柿是什么预兆| 长针眼是什么原因| 吃维生素b2有什么好处和副作用| 栩是什么意思| 5.13是什么星座| 肋间神经痛挂什么科| 贫血用什么药补血最快| 营养包是什么| 驾校教练需要什么条件| 肾上腺素有什么用| 身上长黑痣是什么原因| 什么什么不舍| 落班是什么意思| 脾阳虚吃什么药| 子宫内膜厚有什么影响| 什么是牙槽骨突出图片| 处女座属于什么星象| 第三代身份证什么时候开始办理| maxco是什么牌子| 长命百岁的动物是什么| 扁桃体肥大吃什么药好得快| 2月2号什么星座| 女人梦见鱼是什么意思| 丹参有什么作用和功效| 1993属什么生肖| 舌系带挂什么科| 不硬的原因是什么| 女司机为什么开不好车| 血小板低会出现什么症状| 胃炎有什么症状| 右鼻子经常出血是什么原因| 酒精胶是粘什么的| 陈字五行属什么| 尿频是什么原因造成的| 阴虚阳亢吃什么中成药| 抗氧化性是什么意思| 卫冕冠军是什么意思| 4月29号是什么星座的| 二月二是什么节| 什么是不饱和脂肪酸| 姨妈血是黑褐色是什么原因| 红蜘蛛用什么药| 肚子胀气吃什么药好得快| 乳腺癌挂什么科| 树脂是什么材料| 阑尾炎手术后可以吃什么| 以纯属于什么档次| 内热吃什么药清热解毒| b型o型生出来的孩子什么血型| 1887年属什么生肖| 孕妇梦见狗是什么意思| 肾囊肿有什么症状| 梦到知了猴是什么意思| 6月5日是世界什么日| 傻瓜是什么意思| 塞翁失马什么意思| 尿检潜血是什么意思| 什么是高利贷| 损友是什么意思| 吃蝎子有什么好处| 庚辰五行属什么| 掐是什么意思| 了凡四训讲的是什么| hpv吃什么药| 孩子走路晚是什么原因| 别见怪是什么意思| 慢性荨麻疹吃什么药| 炒什么菜好吃又简单| 梦见订婚是什么意思| 青光眼用什么眼药水| 入职体检70元一般检查什么| 什么情况属于诈骗| 什么是超声波| 什么虫子咬了像针扎一样疼| 葡萄打什么药| 楠字五行属什么| 人格分裂什么意思| 脖子粗大是什么病的症状| 男人送女人项链代表什么| 什么茶减肥效果好| 里正相当于现在什么官| 检查妇科清洁度三是什么意思| 水上漂是什么意思| md是什么意思| 百度Jump to content

《中国记者》杂志

From Wikipedia, the free encyclopedia
百度 北京市政协委员王洪涛《人民日报》(2018年03月21日20版)

The term CDATA, meaning character data, is used for distinct, but related, purposes in the markup languages SGML and XML. The term indicates that a certain portion of the document is general character data, rather than non-character data or character data with a more specific, limited structure.

CDATA sections in XML

[edit]

In an XML document or external entity, a CDATA section is a piece of element content that is marked up to be interpreted literally, as textual data, not as marked-up content.[1] A CDATA section is merely an alternative syntax for expressing character data; there is no semantic difference between character data in a CDATA section and character data in standard syntax where, for example, "<" and "&" are represented by "&lt;" and "&amp;", respectively.

Syntax and interpretation

[edit]

A CDATA section starts with the following sequence:

<![CDATA[

and ends with the next occurrence of the sequence:

]]>

All characters enclosed between these two sequences are interpreted as characters, not markup or entity references. Every character is taken literally, the only exception being the ]]> sequence of characters. In:

<sender>John Smith</sender>

the start and end "sender" tags are interpreted as markup. However, the code:

<![CDATA[<sender>John Smith</sender>]]>

is equivalent to:

&lt;sender&gt;John Smith&lt;/sender&gt;

Thus, the "tags" will have exactly the same status as the "John Smith"; they will be treated as text.

Similarly, if the numeric character reference &#240; appears in element content, it will be interpreted as the single Unicode character 00F0 (small letter eth). But if the same appears in a CDATA section, it will be parsed as six characters: ampersand, hash mark, digit 2, digit 4, digit 0, semicolon.

Uses of CDATA sections

[edit]

New authors of XML documents often misunderstand the purpose of a CDATA section, mistakenly believing that its purpose is to "protect" data from being treated as ordinary character data during processing. Some APIs for working with XML documents do offer options for independent access to CDATA sections, but such options exist above and beyond the normal requirements of XML processing systems, and still do not change the implicit meaning of the data. Character data is character data, regardless of whether it is expressed via a CDATA section or ordinary markup. CDATA sections are useful for writing XML code as text data within an XML document. For example, if one wishes to typeset a book with XSL explaining the use of an XML application, the XML markup to appear in the book itself will be written in the source file in a CDATA section.

Nesting

[edit]

A CDATA section cannot contain the string "]]>" and therefore it is not possible for a CDATA section to contain nested CDATA sections. The preferred approach to using CDATA sections for encoding text that contains the triad "]]>" is to use multiple CDATA sections by splitting each occurrence of the triad just before the ">". For example, to encode "]]>" one would write:

<![CDATA[]]]]><![CDATA[>]]>

This means that to encode "]]>" in the middle of a CDATA section, replace all occurrences of "]]>" with the following:

]]]]><![CDATA[>

This effectively stops and restarts the CDATA section.

Issues with encoding

[edit]

In text data, any Unicode character not available in the encoding declared in the <?xml ...?> header can be represented using a &#nnn; numerical character reference. But the text within a CDATA section is strictly limited to the characters available in the encoding.

Because of this, using a CDATA section programmatically to quote data that could potentially contain '&' or '<' characters can cause problems when the data happens to contain characters that cannot be represented in the encoding. Depending on the implementation of the encoder, these characters can get lost, can get converted to the characters of the &#nnn; character reference, or can cause the encoding to fail. But they will not be maintained.

Another issue is that an XML document can be transcoded from one encoding to another during transport. When the XML document is converted to a more limited character set, such as ASCII, characters that can no longer be represented are converted to &#nnn; character references for a lossless conversion. But within a CDATA section, these characters can not be represented at all, and have to be removed or converted to some equivalent, altering the content of the CDATA section.

Use of CDATA in program output

[edit]

CDATA sections in XHTML documents are liable to be parsed differently by web browsers if they render the document as HTML, since HTML parsers do not recognise the CDATA start and end markers, nor do they recognise HTML entity references such as &lt; within <script> tags. This can cause rendering problems in web browsers and can lead to cross-site scripting vulnerabilities if used to display data from untrusted sources, since the two kinds of parser will disagree on where the CDATA section ends.

Since it is useful to be able to use less-than signs (<) and ampersands (&) in web page scripts, and to a lesser extent styles, without having to remember to escape them, it is common to use CDATA markers around the text of inline <script> and <style> elements in XHTML documents. But so that the document can also be parsed by HTML parsers, which do not recognise the CDATA markers, the CDATA markers are usually commented-out, as in this JavaScript example:

<script type="text/javascript">
//<![CDATA[
document.write("<");
//]]>
</script>

or this CSS example:

<style type="text/css">
/*<![CDATA[*/
body { background-image: url("marble.png?width=300&height=300") }     
/*]]>*/
</style>

This technique is only necessary when using inline scripts and stylesheets, and is language-specific. CSS stylesheets, for example, only support the second style of commenting-out (/* … */), but CSS also has less need for the < and & characters than JavaScript and so less need for explicit CDATA markers.

CDATA in DTDs

[edit]

CDATA-type attribute value

[edit]

In Document Type Definition (DTD) files for SGML and XML, an attribute value may be designated as being of type CDATA: arbitrary character data. Within a CDATA-type attribute, character and entity reference markup is allowed and will be processed when the document is read.

For example, if an XML DTD contains

<!ATTLIST foo a CDATA #IMPLIED>

it means that elements named foo may optionally have an attribute named "a" which is of type CDATA. In an XML document that is valid according to this DTD, an element like this might appear:

<foo a="1 &amp; 2 are &lt; &#51; &#x0A;" />

and an XML parser would interpret the "a" attribute's value as being the character data "1 & 2 are < 3".

CDATA-type entity

[edit]

An SGML or XML DTD may also include entity declarations in which the token CDATA is used to indicate that entity consists of character data. The character data may appear within the declaration itself or may be available externally, referenced by a URI. In either case, character reference and parameter entity reference markup is allowed in the entity, and will be processed as such when it is read.

<DISPLAY_NAME Attribute="Y"><![CDATA[PFTEST0__COUNTER_6__:4:199:, PFTEST0__COUNTER_7__:4:199:]]></DISPLAY_NAME>

<SVLOBJECT><LONG name="" val="" INTEGER name="" val="" LONG name="" val=""/></SVLOBJECT>

See also

[edit]

References

[edit]
[edit]
欠缺是什么意思 冠脉cta是什么检查 血色素低是什么原因 硬不起来是什么原因 狸子是什么动物
咳嗽吃什么食物好得最快最有效 属虎的脖子戴什么招财 cba什么意思 心悸是什么意思啊 拔智齿后需要注意什么
送人礼物送什么好 贵阳有什么特产 干什么 肝硬化挂什么科 为什么总是耳鸣
朝鲜和韩国是什么关系 尾巴骨疼是什么原因 世界上最大的鸟是什么鸟 尿蛋白低是什么原因 驾驶证c1和c2有什么区别
什么主食含糖量低hcv9jop4ns0r.cn 蜜枣是什么枣做的hcv8jop8ns3r.cn 狗属于什么类动物hcv9jop5ns4r.cn 招财猫是什么品种hcv7jop7ns1r.cn 智能电视什么品牌好chuanglingweilai.com
ll是什么意思hcv8jop9ns1r.cn 杭州市市长什么级别hcv8jop0ns8r.cn whirlpool是什么牌子hcv8jop0ns9r.cn 阎维文什么军衔hcv9jop0ns1r.cn 子宫内膜息肉有什么症状hcv9jop6ns6r.cn
家的意义是什么hcv9jop0ns3r.cn lhrh是什么激素hcv7jop7ns2r.cn 优点是什么意思xjhesheng.com 幸灾乐祸什么意思hcv9jop4ns3r.cn tao是什么意思hcv7jop9ns3r.cn
这个人就是娘是什么歌hcv9jop4ns0r.cn 大便干结是什么原因hcv7jop7ns0r.cn 荔枝肉是什么菜系mmeoe.com 脾大是怎么回事有什么危害hkuteam.com 争奇斗艳是什么意思shenchushe.com
百度