3. Document Object Model (XML) Level 1


3.5 Descriptions of objects related to Entities

XML contains the notion of "entities" that are declared in the DTD, defined in either internally in a document or in an external file, and referenced one or more places in the document. In any event, entities allow an abstract reference to some arbitrarily large or complex piece of text and markup.

Interface EntityDeclaration

IDL Definition

interface EntityDeclaration {
  attribute wstring        replacementString;
  attribute DocumentFragment replacementSubtree;
};

Attribute replacementString

The string that a reference to this entity is replaced with. It may contain markup and entity references. It does not apply to un-parsed entities.

Attribute replacementSubtree

The parsed subtree that references to this entity would logically point to. All markup in the replacement string is represented as sub-trees, and entity references are expanded.

Interface EntityReference

EntityReference objects are inserted into the initial structure model by the XML processor. XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or that are declared in external parameter entities. This means that parsed entitiesthat are declared in the external subset need not be expanded by some classes of applications.

XML contains the notion of " parsed entities" that are declared in the DTD, defined in either internally in a document or in an external file, and referenced one or more places in the document. In any event, parsed entities allow an abstract reference to some arbitrarily large or complex piece of text and markup. Parsed entities are one type of general entity. The other type of general entity that XML defines is the unparsed entity, used for embedding data that is not in XML format in an XML document. it is commonly used for images.

Parameter entities are used in DTDs for similar purposes as parsed entities in document instances; namely they allow an abstract reference to some part of the DTD. XML defines a number of rules about the allowed content of a parameter entity; the reader is referred to the XML specification for details.

IDL Definition

interface EntityReference {
  attribute boolean        isExpanded;
  void                expand(in  );
};

Attribute isExpanded

The default view of entities is to be expanded.

Method expand()


Parameters


Return Values
void


Exceptions
This method throws no exceptions.