Pyjong
Pyjong

Reputation: 3207

xml <! > element

is there any connection between notation of CDATA sections and internal DTD definition? i mean both of these things are closed in that <! > element... so i wondered if there is any special meaning for this kind of element or is it just made exception considered as standard for defining CDATA and DTD ?

if you can't understand what's on my mind simply said my question is "what is the function of <! > element in general? (if there is some)"

Upvotes: 1

Views: 191

Answers (3)

Doug Domeny
Doug Domeny

Reputation: 4470

It is a markup declaration. It is meant for the XML parser to interpret rather than be considered as part of the data of the XML document.

Upvotes: 3

Norman Gray
Norman Gray

Reputation: 12514

The <! sequence opens markup declarations. It's distinct from processing instructions, which start with <?.

The XML specification defines a class of 'markup declarations', but doesn't call out the <! syntax specifically (though the SGML spec, which preceded it, named this pair of characters markup declaration open). Those declarations are things you'd find inside a DTD, but the same characters introduce CDATA marked sections and comments.

What unites these is that they're instructions to the XML parser: 'skip this' (a comment), 'don't parse this' (a CDATA section), 'understand this' (a DTD).

That's different from a processing instruction <?, which is an instruction to the application which is ultimately processing the parsed XML. Processing instructions can be just about anything -- they're effectively a 'back door' to the document and are generally application-specific -- but common ones are <?newpage?> or possibly <?issueref "fixed in 123"?>.

Upvotes: 3

ChadNC
ChadNC

Reputation: 2503

Text defined in CDATA section in an xml document is not parsed by the xml processor.

A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements and attributes.

A DTD can be declared inline inside an XML document, or as an external reference.

Upvotes: 0

Related Questions