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);
}
}
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);
}
}
Aggregations