Provide a document type which is defined to be a holder for other, arbitrary XML data.
Different sets of data need to be delivered to a system in a consistent way.
This pattern applies when different sets of data need to be used in some system. The structure of the data itself varies, or is not known at the time the system is being built.
This pattern allows for Flexibility by allowing elements from other documents to be embedded into a consistent holder.
This pattern allows for a separation of concerns between different document types. Mixing issues such as transport with document data is usually not a good idea.
Create a document type which will act as a holder for the varying set of data.
This example shows a very simple envelope which consists of sender and a receiver children elements. Note the use of two different namespaces to allow an XML parser to read the document, which contains elements from both the Envelope (envelope.dtd) and the embedded data (my-stuff.dtd)
This is my message
The Envelope is used as a delivery mechanism for XML data. Document types created for holding domain data should not be responsible, for defining transport ways to do deal with things such as transport, security, delivery and packaging. The envelope provide for a clear separation between these things and the data itself.
This is similar to the
, except that the the document type of the Envelope pattern exists solely as an holder for other data and, the
is for embedding new elements within exsisting data.
SOAP (Simple Object Access Protocol)
is an Envelope for doing remote transport of messages.