XML - Entity (Physical Storage)

> Markup Language (ML) > Extensible Markup Language (XML)

1 - About

An XML document may consist of one or many physical units (storage) that are called entities.

Advertising

3 - Parsed/Unparsed

Entities may be either parsed or unparsed.

3.1 - Parsed

A parsed entity contains text, a sequence of characters, which may represent:

3.2 - Unparsed

An unparsed entity is a resource whose contents may or may not be text, and if text, may be other than XML.

4 - Identification

They all have content and are all (except for the document entity and the external DTD subset) identified by entity name.

5 - Type Entity

5.1 - Document

A document begins in a “root” or document entity.

Each XML document has one entity called the document entity or root, which serves as the starting point for the XML processor and may contain the whole document.

The document entity serves as the root of the entity tree and a starting-point for an XML processor.

Unlike other entities, the document entity has no name and might well appear on a processor input stream without any identification at all.

Advertising

5.2 - Declaration

Entity declaration are used in the DTD.

5.3 - Parameter

Parameter entities are parsed entities for use within the DTD.

Example of a parameter-entity reference:

<!-- declare the parameter entity "ISOLat2"... -->
<!ENTITY % ISOLat2  SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
<!-- ... now reference it. -->
%ISOLat2;

5.4 - Reference

Special characters have a meaning in XML. If you place them like “<” inside an XML element, it will generate an error because the parser interprets it as the start of a element.

There are 5 predefined entity references in XML:

&lt; < less than
&gt; > greater than
&amp; & ampersand
&apos; ' apostrophe
&quot; quotation mark

An entity reference refers to the content of a named entity.

Syntax:

&Name

Examples:

This document was prepared on &docdate; and
is classified &security-level;.
Advertising