what is cdata in xml

11 months ago 24
Nature

CDATA stands for Character Data and is used in XML to define blocks of text that should be treated as regular text and not parsed by the parser. CDATA sections are used to include text that contains characters that would otherwise be interpreted as XML markup, such as <, >, and & . By using CDATA sections, you are commanding the parser that the particular section of the document contains no markup and should be treated as regular text.

A CDATA section begins with the nine-character delimiter `<!. The characters between these two enclosures are interpreted as characters, and not as markup. CDATA sections can appear inside element content and allow < and & character literals to appear. CDATA sections cannot be nested.

In summary, CDATA is a way to include text in an XML document that would otherwise be interpreted as markup, and should be used when you want to include text that contains characters that would otherwise be interpreted as XML markup.