XML CDATA section.

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>"

 

 

Ebook Download
View all
Learn
View all
F11Research & Development, LLC