ENTITY - Entity Declaration Statement

This section describes syntax formats of the ENTITY statement, which is used to declare an XML entity. The ENTITY statement specifies what is the name of the entity and what is the replacement value.

ENTITY: is a DTD statement that defines an XML entity, and associates a value with the entity.

The syntax of ENTITY statement is:

<!ENTITY entity_name "entity_value">

Examples of ENTITY statements:

<!ENTITY author "Herong Yang">
<!ENTITY copyright "&#169;">

Once an entity is defined, it can be used in any parsed text in the following form:


When an XML entity is encountered, the XML parser will replace it with its value defined in the ENTITY statement.

Note that XML language has 5 pre-defined entities, which can be used without declaring them in the document type:

Entity   Character

&amp;    &
&apos;   '
&gt;     >
&lt;     <
&quote;  "

Last update: 2014.

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

Syntaxes of DTD Statements

 DOCTYPE - Document Type Declaration Statement

 ELEMENT - Element Declaration Statement

 ATTLIST - Attribute List Declaration Statement

ENTITY - Entity Declaration Statement

 dictionary_dtd.xml - XML DTD Document Type Example

 Validating an XML Document against the Specified DTD Document Type

 XSD (XML Schema Definition) Introduction

 Syntaxes of XSD Statements

 Validating XML Documents Against Specified XML Schemas

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 XML Notepad - XML Editor

 XML Tools Plugin for Notepad++

 XML 1.1 Changes and Parsing Examples

 Outdated Tutorials


 PDF Printing Version