What does <![CDATA[]]> in XML mean?

前端 未结 13 2437
独厮守ぢ
独厮守ぢ 2020-11-21 07:52

I often find this strange CDATA tag in XML files:


I have observed that this CD

13条回答
  •  轮回少年
    2020-11-21 08:01

    CDATA stands for Character Data and it means that the data in between these strings includes data that could be interpreted as XML markup, but should not be.

    The key differences between CDATA and comments are:

    • As Richard points out, CDATA is still part of the document, while a comment is not.
    • In CDATA you cannot include the string ]]> (CDEnd), while in a comment -- is invalid.
    • Parameter Entity references are not recognized inside of comments.

    This means given these four snippets of XML from one well-formed document:

    
    

    
    

    
    

    An example of escaped CENDs
    
    
    ]]>
    
    ]]>
    

提交回复
热议问题