Using CDATA for Text with Special Characters

XML parsers normally parse all the text in an XML document. When an XML element is parsed, the text between the XML tags is also parsed.

<description>This text is also parsed</description>

XML parsing is hindered when the text contains special characters, such as angle brackets, single quotes, or double quotes.

A CDATA element can be used to assist with this. Everything inside a CDATA section is ignored by the parser.

A CDATA section starts with "<![CDATA[" and ends with "]]>"

<description><![CDATA[ This is someone's complex description that says a < b when c = "foo" ]]></description>

For more information on XML and its formatting, visit one of the many online resources, such as www.xml.com.

See Also

Special Characters in XML

Next

Copyright Notice and Trademarks

Using CDATA for Text with Special Characters