Thursday, January 13, 2011

XML reserved characters


Reserved characters in XML

XML reserves certain characters, including less-than (<), greater than (>), and ampersand (&).
To express these characters in your document data, use the equivalent character entity:

less-than (<) &lt;
greater than (>) &gt;
ampersand (&) &amp;

Here is an XML document fragment that uses character entities:


<equation> x &lt; 2 </equation>
      <rhyme> Jack &amp; Jill </rhyme>




Alternatively, data can be protected from the XML parser in a CDATA section.
Use a CDATA section to escape text that would otherwise be recognized as markup.

<comedians>
  <comedian>
    <![CDATA[Abbott & Costello]]>
  </comedian>
 
  <comedian>
    <![CDATA[Laurel & Hardy]]>
  </comedian>
 
  <comedian>
    <![CDATA[Amos & Andy]]>
  </comedian>
</comedians>



Source:
https://studio.tellme.com/general/xmlprimer.html

No comments:

Post a Comment