CDATA Segments #PCDATA CDATA Types in XML

Source: Internet
Author: User
Tags cdata xml parser
CDATA Segments #PCDATA  CDATA Types in XML  
because CDATA paragraphs and #pcdata,cdata are similar in character, for the sake of understanding, a little summary. A
CDATA segment in 1.XML that resembles the Heredoc in PHP.
all text in an XML document is parsed by the parser, and the entity reference is ignored by the parser in all tags in the tag cdata. And the XML handler treats
its syntax as <![as character data  . CDATA [  ]]> sample of content that needs to be ignored by the parser

<?xml version= "1.0" encoding= "Utf-8"?>
<people>
<![ cdata[<!--。 And [Don't have blank-->
	<teacher>
	<name>Androidyue</name>
	<sex>Boy</sex>
	<age>22</age>
	<add>&address;</add>	
</techer>
]]>
</people>

When using CDATA segments, be aware of a few CDATA letters that are larger and cannot be nested, and that the text content of a CDATA segment cannot appear with the "]]>" string, "<! [cdata[""! " and "[" can not have white space, the end "]]>" can not have blank or newline
2. #PCDATA在元素类型声明中, declaring the type of the element as #pcdata means that the content of the element is resolvable character data and cannot contain subclasses under that element, such as <! ELEMENT name (#PCDATA) > Note that there must be a space between the name and the "(") <br/>
 3. #CDATA类型CDATA是最普通的属性类型, indicating that the property can be any text string, but does not include less than "<" and double quotes ">", and if you want to use both symbols you can use the entity reference "&lt;" and "&quot;", whose syntax is as follows <! Attlist element Name Property name CDATA attribute type > such as <! ATTLIST student name CDATA #REQUIRED > Summary: A CDATA Segment can be understood as a character area whose inner content XML parser is a string, #PCDATA is the type used to declare an element, and CDATA is a type that represents an attribute <br /> 

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.