Brief Explanation of CDATA

Source: Internet
Author: User
Tags cdata xml parser

The following code is often seen in the source code of the webpage:

<! [CDATA [other content]>. Other content is generally a script.

Why use this label?

This label indicates character-data, that is, character data.

Purpose: Tell the XML Parser not to parse this section. If the script in other content contains a <B, the <number is recognized as part of the XML tag. Because no> is found or the end mark of the symmetric pair, the XML parser will parse the error. Therefore, you need to tell the XML Parser not to parse this section.

 

PS: Likewise <! -- Other content --> is to tell the server to try the engine not to parse "other content", because they are comments

@ * Other content * @ is to tell the razor of MVC to try the engine not to parse "other content", because they are comments

And so on

The <> & symbol in the XML fragment is invalid.

There are 5 predefined entity references in XML:
& Lt; < Yu no.
& Gt; > Yu no.
& Amp; & And (and) No.
& Apos; ' Single quotes
& Quot; " Double quotation marks

& Why is it invalid? Because the Escape Character of the <> number must be used &

Brief Explanation of CDATA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.