Technical Training
XML TutorialsTable of Contents
XML - Elements in Document Type Definitions (DTD)
XML - Elements in Document Type Definitions (DTD) - Page 2
XML - Elements in Document Type Definitions (DTD) - Page 3XML - Elements in Document Type Definitions (DTD) Page - 2
XML - Elements in Document Type Definitions (DTD)
.
.
DECLARING ELEMENTS WITH MIXED CONTENT
At times it is required to declare elements with mixed content i.e. both data and other elements. In such situations the pipe symbol (|) is used.
SYNTAX < !ELEMENT parent (#CDATA or #PCDATA,child1,child2, . . . , childN) >
Example:
< bank >
This account is Active
< account >123456< /account >
This account is Closed
< account >423578< /account >
< /bank >
DECLARING ELEMENTS WITH ANY CONTENT
In Real world scenarios, the developer is many a times not sure about the exact document structure while creating the DTD. At such times, ANY keyword comes handy. An element declared as ANY can
- Contain child elements
- Contain character data
- Contain mixed content
SYNTAX: < !ELEMENT element_name ANY >
DECLARING ELEMENTS WITH NO CONTENT
Sometimes it is required that an elements has only attributes but no data. In such scenarios the EMPTY keyword is used.
SYNTAX : < !ELEMENT element_name EMPTY >
ELEMENT ORDER INDICATORS AND QUALIFIERS
The various order and qualification governing symbols are listed in the table append below
|
TYPE |
VALUE |
CONTEXT |
DESCRIPTION |
|
| |
Choice |
Either one child element or another can occur |
|
|
() |
Group |
Groups related elements together |
|
|
, |
Sequence |
Element must follow another element |
|
|
? |
Optional |
Elements appear once or not at all |
|
|
* |
Optional and Repeatable |
Elements appear zero or more times |
|
|
+ |
Required and Repeatable |
Elements appear one or more times |
EXAMPLES:
The pipe symbol (|) specifies choice. So occurrence of either of the chiold element is considered valid by the parser.
Following declaration specifies that name must contain either first_name or last_name
< !ELEMENT name (fist_name | last_name) >
Thus,
< name >
< first_name >Nick< /first_name >
< /name >
as well as
< name >
< last_name >Price< /last_name >
< /name >
are valid.
XML Tutorials
- Working with XML in C
- Working with XML in Perl
- Working with XML in Python
- Working with XML in Flash
- Working with XML in Oracle
- Working with XML in Visual Basic
- Using XML with Microsoft Excel
- XML Spy
- XML and Service Oriented Architecture
- XML SQL Server
- XML Security
- XML Remote Calling Procedure
- XML Processing
- XML Parsing
- XML Web Services
- XML Disadvantages
- XML Advantages
- XML - Elements in Document Type Definitions (DTD)
- XML - Document Type Definitions (DTD)
- XML - Elements, Attributes, Entities
- XML Introduction







