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.


There may a large amount of metadata for a document. If much of this data is required, it could make the document difficult to author and read.


There is a large amount of metadata to be associated with the documents. If the metadata for several documents is the same.


Metadata can add complexity to a document, making it more difficult to author a document. When processing documents, the metadata may not be needed by some programs. Having the metadata in the document can increase processing time.


Place the metadata in the separate document. This document should have its own document type. There is a link placed in the document that refers to the metadata document.

If the metadata for several documents is the same, this can be a very good pattern to use. If, for example, a document requires extensive biographical information about its authors, and several of the documents are by the same author, the single metadata document can be used to minimize replication and ease maintenance.

External parsed entities parsed entities can be used in a similar way, but the document type of the original document does not get simplified.


Here is an example that references author information from an external file.

File: author-info.xml


<Name>Robert Smith</Name>
<Address>123 Maple Street</Address>

File: document.xml

<!ENTITY author-info SYSTEM "author-info.xml">
This is the document.



This pattern makes the separation between the data and the metadata very clear, very little confusion can be made between the data and metadata.

The metadata and data can be defined at different times in the development cycle, allowing for iterative development, or for different authors to work on the data and metadata at the same time.

By having the metadata in a separate document, many documents can include the metadata from the same source. In the Example above, if the address of the author had changed, all of the documents which included this document would be automatically changed as well.

Related Patterns

This is a specialization of both the the Separate Metadata and Data and patterns.

Known Uses


See: The XML & SGML Cookbook page 2-23.