CDATA Label Usage

Source: Internet
Author: User

The use of CDATA tags is seen in the XML file today,

Here's the answer: CDATA

The term CDATA refers to textual data (unparsed Character data) that should not be parsed by the XML parser.

In XML elements, "<" and "&" are illegal.

"<" generates an error because the parser interprets the character as the beginning of the new element.

"&" also generates an error because the parser interprets the character as the beginning of the character entity.

Some text, such as JavaScript code, contains a large number of "<" or "&" characters. To avoid errors, you can define the script code as CDATA.

All content in the CDATA section is ignored by the parser.

CDATA part by "<![ cdata["Start, End with"]]>":

<script><! [Cdata[function Matchwo (b) {if (a < b && a < 0) then  {  return 1;  } else  {  return 0;  }]] ></script>

In the example above, the parser ignores all the content in the CDATA section.

Comments about the CDATA section:

CDATA sections cannot contain the string "]]>". Also, nested CDATA sections are not allowed.

"]]>" that marks the end of a CDATA section cannot contain spaces or lines.

CDATA Label Usage

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.