Characters like “<” and “&” are illegal in XML elements. “<” will generate an error because the parser interprets it as the start of a new element. “&” will generate an error because the parser interprets it as the start of an character entity. Some text, like JavaScript code, contains a lot of “<” or “&” characters. To avoid errors, we need to parse the code using CDATA (Character Data) like so:

<!CDATA[
xxxxxxxxxxxxxxx
]]>

This is different from commenting. Commenting skips the whole section entirely, like so:

<!–
xxxxxxxxxx
–>

which is just like HTML comments.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • LinkedIn
  • MySpace
  • Slashdot
  • TwitThis
  • Yahoo! Buzz