XML CDATA



XML CDATA

  • CDATA means character data.
  • CDATA is defined as blocks of text that are not parsed by the parser. But they are recognized as a markup.
  • The predefined entities such as <, >, and & require typing and they are generally difficult to read in the markup.
  • In such cases, CDATA section can be used. Using CDATA section, user commanding the parser that the particular section of the document contains no markup and should be treated as regular text.
 Example for XML CDATA

Learn XML - XML tutorial - Example for XML CDATA - XML examples - XML programs

Syntax

  • The CDATA syntax contains three sections:
    • CDATA Start section − CDATA begins with the nine-character delimiter <![CDATA[
    • CDATA Content section − This section contain markup characters (<, >, and &), but they are ignored by the XML processor.
    • CDATA End section − CDATA section ends with ]]> delimiter.
     <![CDATA[
	Character that contain markup
	      ]]>

Example for CDATA

 Example for XML CDATA

Learn XML - XML tutorial - Example for XML CDATA - XML examples - XML programs

The output of the above example look like this

 XML CDATA Example

Learn XML - XML tutorial - XML CDATA Example - XML examples - XML programs

CDATA Rules

  • Cdata cannot contain the string “]]>” anywhere in the document
  • Cdata not allowed nesting


Related Searches to XML CDATA