- PCDATA is the text that will be parsed. Tags within the text will be treated as markup, and entities will be expanded.
- CDATA is text that is not parsed by the parser. Tags within the text will not be treated as markup, and entities will not expand.
By default, all this is PCDATA. In the following example, the root is ignored, it will be analyzed, and it will have no content except one child.
<?xml version="1.0"?> <foo> <bar><test>content!</test></bar> </foo>
When we want to indicate that the element will contain only text, and not children, we use the PCDATA keyword because this keyword indicates that the element should contain the character data to be analyzed - that is, any text other than characters than (<) , more than (>), ampersand (&), quote (') and double quotation mark (").
In the following example, the panel is CDATA and is not parsed and contains the content "content!".
<?xml version="1.0"?> <foo> <bar><![CDATA[<test>content!</test>]]></bar> </foo>
There are several content models in SGML. The #PCDATA content model says an item can contain plain text. The βdevelopedβ part means that the markup (including PI, comments, and SGML directives) in it is parsed instead of being displayed as source text. It also means that entity references are replaced.
Another type of content model that allows plain text content is CDATA. In XML, the element content model cannot be implicitly installed on CDATA, but in SGML this means that markup and entity references are ignored in the element contents. However, attributes of type CDATA replace entity references.
In XML, #PCDATA is the only text content model. You use it if you want to allow text content in the element at all. The CDATA content model can be used explicitly through the layout of the CDATA block in #PCDATA, but the contents of the element cannot be defined as CDATA by default.
In DTD, the type of attribute that contains the text must be CDATA. The CDATA keyword in an attribute declaration has a different meaning than the CDATA section in an XML document. In the CDATA section, all characters are legal (including <,>, &, and "characters"), except for the tag "]]>" end.
#PCDATA is not suitable for attribute type. It is used for the text type of the sheet.
#PCDATA is added by the hashtag just for historical reasons.