Mega Code Archive

 
Categories / XML Tutorial / Introduction
 

CDATA sections can tell the XML parser not to parse the text

CDATA sections look like  this:  <comparison><![CDATA[6 is < 7 & 7 > 6]]></comparison>  Everything starting after the <![CDATA[ and ending at the ]]> is ignored by the parser.  The following example uses a CDATA section to keep an XML parser from parsing a section of JavaScript:  <script language='JavaScript'><![CDATA[  function myFunc()  {      if(0 < 1 && 1 < 2)          alert("Hello");  }  ]]></script>