Search in sources :

Example 1 with DocumentSerializer

use of de.catma.serialization.DocumentSerializer in project catma by forTEXT.

the class TeiSourceDocumentInfoSerializationHandler method serialize.

public void serialize(SourceDocument sourceDocument, OutputStream outputStream) throws IOException {
    try {
        TeiDocumentFactory factory = new TeiDocumentFactory();
        TeiDocument teiDocument = factory.createEmptyDocument(sourceDocument.getUuid());
        SourceDocumentInfo sourceDocumentInfo = sourceDocument.getSourceContentHandler().getSourceDocumentInfo();
        teiDocument.getTeiHeader().setValues(sourceDocumentInfo.getContentInfoSet(), sourceDocumentInfo.getTechInfoSet(), sourceDocumentInfo.getIndexInfoSet());
        DocumentSerializer serializer = new DocumentSerializer();
        serializer.serialize(teiDocument.getDocument(), outputStream);
    } catch (Exception exc) {
        throw new IOException(exc);
    }
}
Also used : SourceDocumentInfo(de.catma.document.source.SourceDocumentInfo) DocumentSerializer(de.catma.serialization.DocumentSerializer) IOException(java.io.IOException) IOException(java.io.IOException)

Example 2 with DocumentSerializer

use of de.catma.serialization.DocumentSerializer in project catma by forTEXT.

the class TeiUserMarkupCollectionSerializationHandler method serialize.

public void serialize(AnnotationCollection userMarkupCollection, SourceDocument sourceDocument, OutputStream outputStream) throws IOException {
    try {
        TeiDocumentFactory factory = new TeiDocumentFactory();
        TeiDocument teiDocument = factory.createEmptyDocument(userMarkupCollection.getId());
        teiDocument.getTeiHeader().setValues(userMarkupCollection.getContentInfoSet());
        new TeiTagLibrarySerializationHandler(teiDocument, tagManager).serialize(userMarkupCollection.getTagLibrary());
        new TeiUserMarkupCollectionSerializer(teiDocument, withText).serialize(userMarkupCollection, sourceDocument);
        new DocumentSerializer().serialize(teiDocument.getDocument(), outputStream);
    } catch (Exception exc) {
        throw new IOException(exc);
    }
}
Also used : DocumentSerializer(de.catma.serialization.DocumentSerializer) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

DocumentSerializer (de.catma.serialization.DocumentSerializer)2 IOException (java.io.IOException)2 SourceDocumentInfo (de.catma.document.source.SourceDocumentInfo)1