Categorized XML Design Patterns

This page lists names and abstracts of all XML structural design patterns on this site listed by category. Click on the names to see the full pattern.

Document Roots

Document Roots
Patterns about how to determine what the root element(s) should be.

Multi Root Document Types

A single document type with multiple root elements is used to handle varying documents that may exist within a system.

Multiple Document Types

When a system needs to represent a range of different document types, each document type can be represented by a completely separate declarations.

Universal Root

Provide a single root element that contains an option of multiple elements. Often used for different transaction types within a single document type.

How to include metadata in documents.


When a large amount of metadata needs to be included in an element the designer may create two children for the element, one for the metadata and one for the body of the document.

Metadata First

Metadata should appear in a document before the data which it is about.

Metadata in Separate Document

When there is a large amount of metadata for a document it can make sense to separate this into a different document altogether, with its own document type.

Separate Metadata and Data

When documents contain content and data about the content, the two types of data should be clearly separated.

What abstractions to create in the document type.

Choice Reducing Container

When creating large DTDs, authors are required to learn a large number of attributes and elements, and where they can be positioned in order to know how to use the DTD. By reducing the number of choices that the author has to make at any point in the DTD by group related elements beneath newly introduced elements, the learning requirements of the author can be reduced.

Collection Element

Create a new element whose content model allows only instances of a single element type.

Container Element

A container has multiple elements as child elements. A new element type is created to group related elements. This is a very general pattern and many other patterns specialize this one.

Domain Element

A concept from domain analysis is made into an element.

Optional Container Element

When creating large DTDs with many logical units authors might be required to learn a large number of these logical units to know how to use the DTD. By hiding the details of optional parts of the DTD beneath optional elements, some of this complexity can be reduced.

How to organize the structure of documents.

Declare Before First Use

Elements which are referenced by another part of a document should be found earlier in the document than the first place they are referenced.


Provide a document type which is defined to be a holder for other, arbitrary XML data.


If the same information is included at many different points in a document the information can be placed in just one place, and shared from each place in the document that needs to refer to it.


Instead of organizing objects in a hierarchical fashion, objects are organized in a linear way, with signs on each object to indicate its classifications.

Referenced Note

When an area in text needs to refer to a note that will be placed in a different part of the document, a reference is made to a separate entity using an IDREF.

Ways to add or reduce the flexibility of documents.

Catch-All Element

A container element for dealing with unknown elements within the document.

Extensible Content Model

Provide a mechanism which allows additional elements to be added into existing content models.

Generic Element

To provide flexibility to users of the document, designers can provide an element type that is very generic. The use of the generic element is not well specified by the documents type. This allows for authors to use the document type in ways that may not have been foreseen.

Role Attribute

Sometimes the designer of a DTD can not foresee all of the needs that the author of a document will have. In order to give the author flexibility an attribute that specifies a role can be included on some of the elements.

How to create consistent markup.

Common Attributes

Provide a set of attributes that can be placed on all, or most, elements in the document type.

Consistent Element Set

Provide a set of elements which is consistently grouped together as the content models of a number of other elements.

Parallel Design

Creating structures that for different elements that are very similar to one another makes DTD easier to use and understand.

These just don't fit anywhere else.

Content Type Label

Parameter entities are created to represent different types of values within a DTD.

Reuse Document Types

If document types already exist for the job at hand, they can be reused completely or parts of them can be reused.

Short Understandable Names

Names of elements and attributes should short and understandable by authors and developers of processing software.


XML technology can be used to represent structured information. This pattern helps determine when XML is an appropriate solution.

Visit our sponsors: (Interested in advertising on XMLPatterns.com?)