", and nested CDATA parts are not allowed; 2. The "]]>" marking the end of the CDATA part cannot contain spaces or line breaks."> How to use cdata tags-XML/RSS Tutorial-php.cn

How to use cdata tags

coldplay.xixi
Release: 2020-10-29 16:16:46
Original
6049 people have browsed it

Methods for using cdata tags: 1. The CDATA part cannot contain the string "]]>", and nested CDATA parts are not allowed; 2. "]]>" that marks the end of the CDATA part cannot Contains spaces or line breaks.

How to use cdata tags

Methods used with cdata tags:

CDATA

The term CDATA refers to the Text data parsed by the XML parser (Unparsed Character Data).

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

"<" will generate an error because the parser will interpret this character as the beginning of a new element.

"&" will also generate an error because the parser will interpret this character as the beginning of a character entity.

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

Everything within the CDATA section will be ignored by the parser.

The CDATA part starts with "" and ends with "":

Copy after login

In the above example, the parser will Ignore everything in the CDATA section.

Notes on the CDATA part:

  • The CDATA part cannot contain the string "]]>". Nested CDATA sections are also not allowed.

  • The "]]>" marking the end of the CDATA section cannot contain spaces or line breaks.

The above is the detailed content of How to use cdata tags. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!