Skip to content

CDATA vs PCDATA

Understand the key differences between CDATA (unparsed character data) and PCDATA (parsed character data) in XML, including when to use each for handling markup and entity expansion.

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.

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