CDATA Section

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

Java APIs for XML Kick Start
By Aoyon Chowdhury, Parag Choudhary

Table of Contents
Appendix B.  XML: A Quick Tour


In the discussion about predefined entities you learned how to escape markup characters by using predefined entities. This solution works when there are small numbers of such characters to be escaped, although it becomes tedious when there are a large number of such characters that need to be escaped. Other than this, there might also be times when you want the XML parser to output the text exactly as it appears in the XML document. Such a need often arises when you want to send the output of one XML document as an input to another application.

To handle such a situation, XML provides the CDATA section. The XML parser will not treat any text that appears between these two entries as markup. The way to provide information in a CDATA section is as follows:

<![CDATA[text to be kept as is]]> 

The CDATA section begins with <![CDATA[ and ends with ]] >. In our example, the CDATA is used in the forCDATA element (as shown in the next section) to avoid escaping the huge number of >, <, and other markup characters.


printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
Top

[0672324342/app02lev1sec11]

 
 


JavaT APIs for XML Kick Start
JAX: Java APIs for XML Kick Start
ISBN: 0672324342
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net