ELEMENT - Element Declaration Statement

This section describes syntax formats of the ELEMENT statement, which is used to declare an element in this document type. The ELEMENT statement specifies what is the name of the element, and what is structure of its content.

ELEMENT: is a DTD statement that defines an XML element. The ELEMENT statement specifies what is the name of the element, and what is structure of its content.

The syntax for ELEMENT statement is:

<!ELEMENT element_name content_expression>

"content_expression" is made of key words, element names, expressional symbols, and grouping parentheses. Elements can be declared as one of the following 5 content modes:

1. Empty Content: No text or child element is allowed in the content.

<!ELEMENT element_name EMPTY>

2. Parsed Text Content: Only parsed text is allowed in the content. Parsed text is a string of regular characters and XML entities. No child element is allowed in the content.

<!ELEMENT element_name (#PCDATA)>

3. Element Sequence Content: Only one or more named elements are allowed in the content. The named elements must appear in the same sequence as they are specified in the declaration statement. No text is allowed in the content. Element sequence content is declared by a sequence of child element names, expressional symbols and grouping parentheses. Examples of element sequence content are:

<!ELEMENT element_name (e) >
<!ELEMENT element_name (e?) >
<!ELEMENT element_name (e+) >
<!ELEMENT element_name (e*) >
<!ELEMENT element_name (e,f) >
<!ELEMENT element_name (e,f)? >
<!ELEMENT element_name (e,f)+ >
<!ELEMENT element_name (e|f)* >
<!ELEMENT element_name (e,(f|g)) >

where:

4. Mixed Content: Parsed text and named elements are allowed in the content. Mixed content must be declared in the following syntax:

<!ELEMENT element_name (#PCDATA | e | f | ...)* >

5. Any Content: Parsed text and any elements are allowed in the content. Any content is declared by key word, ANY:

<!ELEMENT element_name ANY>

Note that:

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

 References

 PDF Printing Version