The CDATA segment # pcdata CDATA type in XML is similar in text because of the CDATA segment and # pcdata, CDATA. To make it easy for everyone to understand, let's take a look at it. 1. the CDATA segment in XML is similar to the heredoc concept in PHP. All the text in XML documents will be parsed by the parser. entity references will be ignored by the parser only when all the tags in CDATA are marked, when the XML processing program treats it as character data, its syntax is <! [CDATA [content to be ignored by the parser]> example<? XML version = "1.0" encoding = "UTF-8"?> <People> <! [CDATA [<! --! And [do not have blank between --> <teacher> <Name> androidyue </Name> <sex> boy </sex> <age> 22 </age> <add> & Address; </Add> </techer>]> </People>
When using CDATA segments, note that the numbers of CDATA letters must be larger and cannot be nested. The text content of CDATA segments cannot contain "]>" string, "<! [CDATA ["medium "! "And" ["cannot have blank, end"]> "cannot have blank or line feed
2. # In the element type declaration, pcdata declares the element type as # pcdata, indicating that the content of this element is parsed character data and cannot contain subclasses under this element, as shown in <! Element name (# pcdata)> note that there must be more than one space between the name and (") <br/>
3. # The CDATA type CDATA is the most common attribute type, indicating that the attribute can be any text string, but does not include "<" and double quotation marks "> ", to use these two symbols, you can use the entity reference "& lt;" and "& quot;". The syntax is as follows <! ATTLIST element name attribute name CDATA attribute type> As shown in <! ATTLIST Student name CDATA # required> conclusion: The CDATA segment can be understood as a character area, and its internal content XML parser is treated as a string. # pcdata is used to declare the element type, CDATA indicates the property type. <br/>