XML Introduction

A XML (short for Extensible Markup Language) document consists of:

  • the prolog (optional)
  • the document type definition (DTD, optional)
  • the root element (which furthermore consists of more elements, tree structure)

Comments and processing instructions can be defined outside of tags.


The basic prolog looks like this: <?xml version="1.0" ?> An extended version: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>

Attributes explained:

  • version: XML version
  • encoding: Character set, defaults to UTF-8
  • standalone: define if extern entities or DTDs are being referenced in this document

Document Type Definition

The DTD defines structure validation rules for our documents. We fundamentally construct elements with their respective type (analogous to the database schema).

Reasons to use DTD: