During validation the CDATA XML Sections are ignored by the XML parser, so that you can place your code with special characters or non valid html inside that section.
Parsed Data
When an XML element is parsed the Contains which is inside that is also parsed.
<message>This text is also parsed</message>
The parser parsed the whole contains because XML elements can contain other elements, as in this example, where the element contains two other elements (first and last):
Illegal XML characters are replaced by entity references.
If you want to place a character like < OR > inside an XML element, it will generate an error because the parser interprets it as the start of a new element & end of element.
You cannot write something like this:
<message>if age < 70 then</message>
To avoid this, you have to replace the "<" character with an entity reference, like this:
<message>if age < 70 then</message>
XML have 5 predefined entity references:
<
<
less than
>
>
greater than
&
&
ampersand
'
'
class="normalText"apostrophe
"
"
quotation mark
Note: Only characters like "<" and "&"
are strictly illegal in XML. Apostrophes,
quotation marks and greater than signs are
optional, but it is a good habit to replace them.
CDATA Sections
CDATA Sections are basically used for escaping blocks of text containing characters which would otherwise be recognized as markup. XML Processor ignored all tags and entity references and treats them just like any character data. CDATA section blocks have been a convenience way when you want to include large blocks of special characters as character data, but you do not want to have to use entity references all the time.
A CDATA section always starts with "<![CDATA["
and ends with "]]>":
<xmlElement>
<![CDATA[
I am > the rules!
]]>
</xmlElement>
Notes :-
Make sure that you don't have a CDATA[ or a ]]> inside your CDATA,because CDATA section's cannot be nested.
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
class="keywords">
Keywords: cdata section, xml document, xml parser, xml processor