Blog

XML CDATA section.

Posted by Nipun Tomar Blogs | XML May 12, 2011
The term CDATA is used about text data that should not be parsed by the XML parser.

The term CDATA is used about text data that should not be parsed by the XML parser. In other words All data is normally parsed in XML but if you want to exclude some elements you will need to put those elements in CDATA. Characters like "<" and "&" are illegal in XML elements. A CDATA section starts with "<![CDATA[" and ends with "]]>":

In the example below everything inside the CDATA section is ignored by the parser.<script>
<![CDATA[
function matchwo(a,b)
{
if (a < b && a < 0) then
  {
  return 1;
  }
else
  {
  return 0;
  }
}
]]>
</script>

Another example, the following Cdata section:

    <![CDATA[<greeting>Hello, world!</greeting>]]>

is represented by a CDataSection element with a string value of:

    "<greeting>Hello, world!</greeting>"

 

 

post comment
     
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.