Cdata in XML


When creating XML documents, sometimes there are blocks of text that contain characters that may prove to be a problem when trying to validate the document. An example of this would be if the XML data contains a programming script, many of which contain characters such as >, <, &, etc, which will likely cause problems for the XML processor.  To avoid this, CDATA can be used to eliminate the need to go through the entire script.  During validation, the XML processor skips all data between the CDATA tags.  The syntax for CDATA is shown in the example below:

Example: <root_element>



Text and script that should be skipped




This entry was posted in XML Tutorial. Bookmark the permalink.

Leave a Reply

Your email address will not be published.