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.
<Author> <Name>Robert Smith</Name> <BirthDate>21-04-1960</BirthDate> <Address>123 Maple Street</Address> </Author>File: document.xml
<!DOCTYPE DOCUMENT[ <!ENTITY author-info SYSTEM "author-info.xml"> ]> <Document> <Head> &author-info; </Head> <Body> This is the document. </Body> </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.