Skip to main content

CDATA vs PCDATA

CDATA

CDATA (Unparsed Character data) is text which is not parsed further in an XML document.

Tags inside the CDATA text are not treated as markup and entities will not be expanded.

<![CDATA[
...
]]>

PCDATA

PCDATA (Parsed Character Data) is text that will be parsed by the XML parser.

Tags inside the PCDATA will be treated as markup and entities will be expanded.

note

XML parser examines the data and ensures that it doesn't contain entity. If an entity is found, it will be expanded.

book.dtd
<!DOCTYPE book [  
<!ELEMENT book (title,author,publisher)>
<!ELEMENT title(#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher(#PCDATA)>
]>

Table of Contents