* @param type The type of document type of the document generated.
* @param out The {@link OutputStream} receiving the document.
*/
public static <T> void document(Codec<T> codec, DocumentType type,
OutputStream out) {
WstxOutputFactory documentFactory = new WstxOutputFactory();
XmlWriter writer;
try {
writer = new StreamingXmlWriter(documentFactory
.createXMLStreamWriter(out));
DefaultDocumentBuilder builder = type.createDocumentBuilder(writer);
ArticleDocument document = new DefaultArticleDocument(builder,
codec.getCodecDescriptor().getTitle());
document(codec, document);