GetWiki
CDATA
ARTICLE SUBJECTS
being →
database →
ethics →
fiction →
history →
internet →
language →
linux →
logic →
method →
news →
policy →
purpose →
religion →
science →
software →
truth →
unix →
wiki →
ARTICLE TYPES
essay →
feed →
help →
system →
wiki →
ARTICLE ORIGINS
critical →
forked →
imported →
original →
CDATA
please note:
- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
{{Short description|Section delimiter in the markup languages SGML and XML}}{{refimprove|date=December 2021}}The term CDATA, meaning character data, is used for distinct, but related, purposes in the markup languages SGML and (XML]]. The term indicates that a certain portion of the document is general character data, rather than non-character data or character data with a more specific, limited structure.- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
CDATA sections in XML
In an XML document or external entity, a CDATA section is a piece of element content that is marked up to be interpreted literally, as textual data, not as marked-up content.CDATA Sections A CDATA section is merely an alternative syntax for expressing character data; there is no semantic difference between character data in a CDATA section and character data in standard syntax where, for example, "<" and "&" are represented by "<" and "&", respectively.Syntax and interpretation
A CDATA section starts with the following sequence:and ends with the next occurrence of the sequence:)(>All characters enclosed between these two sequences are interpreted as characters, not markup or entity references. Every character is taken literally, the only exception being the ]]> sequence of characters. In:John Smiththe start and end "sender" tags are interpreted as markup. However, the code:John Smith)>is equivalent to:Uses of CDATA sections
New authors of XML documents often misunderstand the purpose of a CDATA section, mistakenly believing that its purpose is to "protect" data from being treated as ordinary character data during processing. Some APIs for working with XML documents do offer options for independent access to CDATA sections, but such options exist above and beyond the normal requirements of XML processing systems, and still do not change the implicit meaning of the data. Character data is character data, regardless of whether it is expressed via a CDATA section or ordinary markup. CDATA sections are useful for writing XML code as text data within an XML document. For example, if one wishes to typeset a book with (Extensible Stylesheet Language|XSL]] explaining the use of an XML application, the XML markup to appear in the book itself will be written in the source file in a CDATA section.Nesting
A CDATA section cannot contain the string "]]>" and therefore it is not possible for a CDATA section to contain nested CDATA sections. The preferred approach to using CDATA sections for encoding text that contains the triad "]]>" is to use multiple CDATA sections by splitting each occurrence of the triad just before the ">". For example, to encode "]]>" one would write:)>This means that to encode "]]>" in the middle of a CDATA section, replace all occurrences of "]]>" with the following:]] ]]>