added XML exports

This commit is contained in:
s5260822 2025-03-23 00:57:29 +01:00
parent 85ea3dd5f5
commit ab37c00ea9
15 changed files with 479 additions and 6 deletions

View file

@ -6,6 +6,7 @@ import org.texttechnologylab.project.gruppe_05_1.database.MongoOperations;
import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Membership;
import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Speaker;
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
import org.w3c.dom.Element;
import java.io.File;
import java.io.FileOutputStream;
@ -151,4 +152,36 @@ public class Speaker_MongoDB_Impl extends Speaker implements MongoOperations<Spe
tex.append("\\end{minipage}\n");
return tex.toString();
}
public Element toXML(org.w3c.dom.Document doc) {
Element speakerElement = doc.createElement("speaker");
speakerElement.setAttribute("id", this.getId());
speakerElement.setAttribute("name", this.getName());
speakerElement.setAttribute("firstName", this.getFirstName());
speakerElement.setAttribute("title", this.getTitle() != null ? this.getTitle() : "");
speakerElement.setAttribute("geburtsdatum", this.getGeburtsdatum() != null ? this.getGeburtsdatum().toString() : "");
speakerElement.setAttribute("geburtsort", this.getGeburtsort());
speakerElement.setAttribute("sterbedatum", this.getSterbedatum() != null ? this.getSterbedatum().toString() : "");
speakerElement.setAttribute("geschlecht", this.getGeschlecht());
speakerElement.setAttribute("beruf", this.getBeruf());
speakerElement.setAttribute("akademischertitel", this.getAkademischertitel());
speakerElement.setAttribute("familienstand", this.getFamilienstand());
speakerElement.setAttribute("religion", this.getReligion() != null ? this.getReligion() : "");
speakerElement.setAttribute("vita", this.getVita());
speakerElement.setAttribute("party", this.getParty());
List<Membership> memberships = this.getMemberships();
for (Membership membership : memberships) {
Element membershipElement = doc.createElement("membership");
membershipElement.setAttribute("role", membership.getRole());
membershipElement.setAttribute("member", membership.getMember());
membershipElement.setAttribute("begin", membership.getBegin() != null ? membership.getBegin().toString() : "");
membershipElement.setAttribute("end", membership.getEnd() != null ? membership.getEnd().toString() : "");
membershipElement.setAttribute("label", membership.getLabel());
membershipElement.setAttribute("wp", String.valueOf(membership.getWp()));
speakerElement.appendChild(membershipElement);
}
return speakerElement;
}
}

View file

@ -11,6 +11,7 @@ import org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.speechl
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls.Speech_File_Impl;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
import org.w3c.dom.Element;
import java.util.List;
@ -115,4 +116,20 @@ public class Speech_MongoDB_Impl extends Speech_File_Impl implements Speech {
return tex.toString();
}
public Element toXML(org.w3c.dom.Document doc) {
Element speech = doc.createElement("speech");
speech.setAttribute("sessionId", String.valueOf(this.getSessionId()));
speech.setAttribute("agendaItemId", String.valueOf(this.getAgendaItemId()));
speech.setAttribute("speechId", String.valueOf(this.getSpeechId()));
speech.setAttribute("speakerId", String.valueOf(this.getSpeakerId()));
speech.setAttribute("speakerName", this.getSpeakerName());
speech.setAttribute("fraction", this.getFraction());
speech.setAttribute("speechKey", this.getSpeechKey());
for (Content content: this.getSpeechContents()) {
speech.appendChild(content.toXML(doc));
}
return speech;
}
}

View file

@ -3,6 +3,7 @@ package org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.speech
import org.bson.Document;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls.Comment_File_Impl;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Comment;
import org.w3c.dom.Element;
public class Comment_MongoDB_Impl extends Comment_File_Impl implements Comment {
@ -18,4 +19,13 @@ public class Comment_MongoDB_Impl extends Comment_File_Impl implements Comment {
public String toTeX() {
return "\\textcolor{blue}{Kommentar}: " + this.getComment() + "\\\\\n";
}
public Element toXML(org.w3c.dom.Document doc) {
Element comment = doc.createElement("comment");
comment.setAttribute("contentId", String.valueOf(this.getContentId()));
comment.setAttribute("speechId", String.valueOf(this.getSpeechId()));
comment.setAttribute("commentatorName", this.getCommentatorName());
comment.setTextContent(this.getComment());
return comment;
}
}

View file

@ -3,6 +3,7 @@ package org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.speech
import org.bson.Document;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls.Line_File_Impl;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Line;
import org.w3c.dom.Element;
public class Line_MongoDB_Impl extends Line_File_Impl implements Line {
@ -16,4 +17,12 @@ public class Line_MongoDB_Impl extends Line_File_Impl implements Line {
public String toTeX() {
return this.getContent() + "\\\\\n";
}
public Element toXML(org.w3c.dom.Document doc) {
Element line = doc.createElement("line");
line.setAttribute("contentId", String.valueOf(this.getContentId()));
line.setAttribute("speechId", String.valueOf(this.getSpeechId()));
line.setTextContent(this.getContent());
return line;
}
}

View file

@ -3,6 +3,7 @@ package org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.speech
import org.bson.Document;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls.Speaker_File_Impl;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speaker;
import org.w3c.dom.Element;
public class Speaker_MongoDB_Impl extends Speaker_File_Impl implements Speaker {
public Speaker_MongoDB_Impl(Document mongoDocument) {
@ -17,4 +18,14 @@ public class Speaker_MongoDB_Impl extends Speaker_File_Impl implements Speaker {
public String toTeX() {
return "\\textcolor{darkgreen}{Redner/Rednerin}: " + this.getSpeakerName() + "\\\\\n";
}
public Element toXML(org.w3c.dom.Document doc) {
Element speaker = doc.createElement("speaker");
speaker.setAttribute("contentId", String.valueOf(this.getContentId()));
speaker.setAttribute("speechId", String.valueOf(this.getSpeechId()));
speaker.setAttribute("speakerId", String.valueOf(this.getSpeakerId()));
speaker.setAttribute("speakerName", this.getSpeakerName());
speaker.setAttribute("fraction", this.getFraction());
return speaker;
}
}

View file

@ -0,0 +1,137 @@
package org.texttechnologylab.project.gruppe_05_1.export;
import org.eclipse.jetty.xml.XmlParser;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Node;
import org.texttechnologylab.project.gruppe_05_1.database.domainimpl.mdb.Speaker_MongoDB_Impl;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;
import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import static org.texttechnologylab.project.gruppe_05_1.database.MongoPprUtils.*;
public class XMLUtil {
public static String documentToString(Document doc) {
try {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
// Writer to store the XML string
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
// Perform transformation
transformer.transform(source, result);
return writer.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Document createXmlDocument() throws ParserConfigurationException {
// create new doc
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document doc = factory.newDocumentBuilder().newDocument();
Element speechesElement = doc.createElement("speeches");
doc.appendChild(speechesElement);
return doc;
}
public static void addSpeechById(Document doc, String speechId) {
// get speeches element
Element speechesElement = (Element) doc.getElementsByTagName("speeches").item(0);
// create new speech element
Element speechElement = doc.createElement("speech");
speechesElement.appendChild(speechElement);
Speech speech = getSpeechByKey(speechId);
Speaker_MongoDB_Impl speaker = getSpeakerById(String.valueOf(speech.getSpeakerId()));
speechElement.appendChild(speaker.toXML(doc));
speechElement.appendChild(speech.toXML(doc));
}
public static void addSpeechBySpeech(Document doc, Speech speech) {
// get speeches element
Element speechesElement = (Element) doc.getElementsByTagName("speeches").item(0);
// create new speech element
Element speechElement = doc.createElement("speech");
speechesElement.appendChild(speechElement);
Speaker_MongoDB_Impl speaker = getSpeakerById(String.valueOf(speech.getSpeakerId()));
speechElement.appendChild(speaker.toXML(doc));
speechElement.appendChild(speech.toXML(doc));
}
public static String getExportedSpeechById(String speechId) throws ParserConfigurationException {
Document doc = createXmlDocument();
addSpeechById(doc, speechId);
return documentToString(doc);
}
public static String getExportedSpeechesFromSpeakerById(String speakerId) throws ParserConfigurationException {
Document doc = createXmlDocument();
List<Speech> speeches = getSpeechesBySpeakerId(speakerId);
for (Speech speech : speeches) {
addSpeechBySpeech(doc, speech);
}
return documentToString(doc);
}
public static String getExportedAllSpeeches() throws ParserConfigurationException {
Document doc = createXmlDocument();
List<Speech> speeches = getAllSpeeches();
for (Speech speech : speeches) {
addSpeechBySpeech(doc, speech);
}
return documentToString(doc);
}
public static String getExportedSpeechesWhithTopic(String topic) throws ParserConfigurationException {
Document doc = createXmlDocument();
List<Speech> speeches = getAllSpeechesWithTopic(topic);
for (Speech speech : speeches) {
addSpeechBySpeech(doc, speech);
}
return documentToString(doc);
}
public static String getExportedSpeechesbyIds(List<String> speechIds) throws ParserConfigurationException {
Document doc = createXmlDocument();
for (String speechId : speechIds) {
addSpeechById(doc, speechId);
}
return documentToString(doc);
}
}

View file

@ -66,10 +66,16 @@ public class RESTHandler {
app.get("/reden", SpeechController::listAllSpeeches); // zeige alle Reden an (Filtern möglich)
app.get("/export/pdf/speech/{id}", SpeechesExportController::exportSpeech); // exportiere eine Rede als PDF
app.get("/export/pdf/speaker/{id}", SpeechesExportController::exportSpeechesFromSpeaker); // exportiere alle Reden eines Parlamentariers als PDF
app.get("/export/pdf/topic/{topic}", SpeechesExportController::exportSpeechesWithTopic); // exportiere alle Reden zu einem Thema als PDF
app.get("/export/pdf/all", SpeechesExportController::exportAllSpeeches); // exportiere alle Reden als PDF CAUTION!!!: This will take forever but is required in the exercise
app.get("/export/pdf/speeches/{speechIds}", SpeechesExportController::exportSpeeches); // exportiere eine Liste von Reden als PDF
app.get("/export/pdf/speech/{id}", SpeechesLatexExportController::exportSpeech); // exportiere eine Rede als PDF
app.get("/export/pdf/speaker/{id}", SpeechesLatexExportController::exportSpeechesFromSpeaker); // exportiere alle Reden eines Parlamentariers als PDF
app.get("/export/pdf/topic/{topic}", SpeechesLatexExportController::exportSpeechesWithTopic); // exportiere alle Reden zu einem Thema als PDF
app.get("/export/pdf/all", SpeechesLatexExportController::exportAllSpeeches); // exportiere alle Reden als PDF CAUTION!!!: This will take forever but is required in the exercise
app.get("/export/pdf/speeches/{speechIds}", SpeechesLatexExportController::exportSpeeches); // exportiere eine Liste von Reden als PDF
app.get("/export/xml/speech/{id}", SpeechesXMLExportController::exportSpeech); // exportiere eine Rede als XML
app.get("/export/xml/speaker/{id}", SpeechesXMLExportController::exportSpeechesFromSpeaker); // exportiere alle Reden eines Parlamentariers als XML
app.get("/export/xml/topic/{topic}", SpeechesXMLExportController::exportSpeechesWithTopic); // exportiere alle Reden zu einem Thema als XML
app.get("/export/xml/all", SpeechesXMLExportController::exportAllSpeeches); // exportiere alle Reden als XML
app.get("/export/xml/speeches/{speechIds}", SpeechesXMLExportController::exportSpeeches); // exportiere eine Liste von Reden als XML
}
}

View file

@ -14,7 +14,7 @@ import java.util.List;
import static org.texttechnologylab.project.gruppe_05_1.export.TeXUtil.*;
public class SpeechesExportController {
public class SpeechesLatexExportController {
@OpenApi(
summary = "Get a speech as a PDF",
description = "Returns a LaTeX generated pdf of a selected speech",

View file

@ -0,0 +1,181 @@
package org.texttechnologylab.project.gruppe_05_1.rest;
import io.javalin.http.Context;
import io.javalin.openapi.HttpMethod;
import io.javalin.openapi.OpenApi;
import io.javalin.openapi.OpenApiResponse;
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import static org.texttechnologylab.project.gruppe_05_1.export.XMLUtil.*;
import static org.texttechnologylab.project.gruppe_05_1.export.TeXUtil.*;
public class SpeechesXMLExportController {
@OpenApi(
summary = "Get a speech as XML",
description = "Returns an XML file of a selected speech",
operationId = "getSpeechExport",
path = "/export/xml/speech/{id}",
methods = HttpMethod.GET,
tags = {"Export", "Speeches", "XML"},
responses = {
@OpenApiResponse(status = "200")
})
public static void exportSpeech(Context ctx) {
String xmlContent;
try {
xmlContent = getExportedSpeechById(ctx.pathParam("id"));
ByteArrayInputStream stream = new ByteArrayInputStream(xmlContent.getBytes());
if (stream.available() == 0) {
Logger.error("XML stream is empty.");
ctx.result("Internal Server Error");
ctx.status(500);
return;
}
ctx.contentType("application/xml");
ctx.result(stream);
} catch (Exception e) {
Logger.error("Failed to generate Export of Speech with ID " + ctx.pathParam("id"));
Logger.error(e.getMessage());
Logger.debug(Arrays.toString(e.getStackTrace()));
ctx.result("Internal Server Error");
ctx.status(500);
}
}
@OpenApi(
summary = "Get all speeches from a speaker as XML",
description = "Returns an XML file of all speeches of a selected speech",
operationId = "getSpeechesFromSpeakerExport",
path = "/export/xml/speaker/{id}",
methods = HttpMethod.GET,
tags = {"Export", "Speeches", "XML"},
responses = {
@OpenApiResponse(status = "200")
})
public static void exportSpeechesFromSpeaker(Context ctx) {
String xmlContent;
try {
xmlContent = getExportedSpeechesFromSpeakerById(ctx.pathParam("id"));
ByteArrayInputStream stream = new ByteArrayInputStream(xmlContent.getBytes());
if (stream.available() == 0) {
Logger.error("XML stream is empty.");
ctx.result("Internal Server Error");
ctx.status(500);
return;
}
ctx.contentType("application/xml");
ctx.result(stream);
} catch (Exception e) {
Logger.error("Failed to generate Export of Speeches from Speaker with ID " + ctx.pathParam("id"));
Logger.error(e.getMessage());
Logger.debug(Arrays.toString(e.getStackTrace()));
ctx.result("Internal Server Error");
ctx.status(500);
}
}
@OpenApi(
summary = "Get all speeches as XML",
description = "Returns an XML file of all speeches",
operationId = "getAllSpeeches",
path = "/export/xml/all",
methods = HttpMethod.GET,
tags = {"Export", "Speeches", "XML"},
responses = {
@OpenApiResponse(status = "200")
})
public static void exportAllSpeeches(Context ctx) {
String xmlContent;
try {
xmlContent = getExportedAllSpeeches();
ByteArrayInputStream stream = new ByteArrayInputStream(xmlContent.getBytes());
if (stream.available() == 0) {
Logger.error("XML stream is empty.");
ctx.result("Internal Server Error");
ctx.status(500);
return;
}
ctx.contentType("application/xml");
ctx.result(stream);
} catch (Exception e) {
Logger.error("Failed to generate Export of all Speeches");
Logger.error(e.getMessage());
Logger.debug(Arrays.toString(e.getStackTrace()));
ctx.result("Internal Server Error");
ctx.status(500);
}
}
@OpenApi(
summary = "Get all speeches with specific topic as XML",
description = "Returns an XML file of all speeches with specific topic",
operationId = "getAllSpeechesWithTopic",
path = "/export/xml/topic/{topic}",
methods = HttpMethod.GET,
tags = {"Export", "Speeches", "XML"},
responses = {
@OpenApiResponse(status = "200")
})
public static void exportSpeechesWithTopic(Context ctx) {
String xmlContent;
try {
xmlContent = getExportedSpeechesWhithTopic(ctx.pathParam("topic"));
ByteArrayInputStream stream = new ByteArrayInputStream(xmlContent.getBytes());
if (stream.available() == 0) {
Logger.error("XML stream is empty.");
ctx.result("Internal Server Error");
ctx.status(500);
return;
}
ctx.contentType("application/xml");
ctx.result(stream);
} catch (Exception e) {
Logger.error("Failed to generate Export of all Speeches");
Logger.error(e.getMessage());
Logger.debug(Arrays.toString(e.getStackTrace()));
ctx.result("Internal Server Error");
ctx.status(500);
}
}
@OpenApi(
summary = "Get speeches by IDs as XML",
description = "Returns an XML file of the speeches specified by their IDs",
operationId = "getSpeechesByIds",
path = "/export/xml/speeches/{speechIds}", // Comma-separated IDs
methods = HttpMethod.GET,
tags = {"Export", "Speeches", "XML"},
responses = {
@OpenApiResponse(status = "200")
})
public static void exportSpeeches(Context ctx) {
String xmlContent;
try {
String speechIdsParam = ctx.pathParam("speechIds");
List<String> speechIds = Arrays.asList(speechIdsParam.split(","));
xmlContent = getExportedSpeechesbyIds(speechIds);
ByteArrayInputStream stream = new ByteArrayInputStream(xmlContent.getBytes());
if (stream.available() == 0) {
Logger.error("XML stream is empty.");
ctx.result("Internal Server Error");
ctx.status(500);
return;
}
ctx.contentType("application/xml");
ctx.result(stream);
} catch (Exception e) {
Logger.error("Failed to generate Export of all Speeches");
Logger.error(e.getMessage());
Logger.debug(Arrays.toString(e.getStackTrace()));
ctx.result("Internal Server Error");
ctx.status(500);
}
}
}

View file

@ -3,6 +3,8 @@ package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Comment;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class Comment_File_Impl implements Content, Comment {
@ -47,4 +49,14 @@ public class Comment_File_Impl implements Content, Comment {
public String toTeX() {
return "\\textcolor{blue}{Kommentar}: " + this.getComment() + "\\\n";
}
@Override
public Element toXML(Document doc) {
Element comment = doc.createElement("comment");
comment.setAttribute("contentId", String.valueOf(this.getContentId()));
comment.setAttribute("speechId", String.valueOf(this.getSpeechId()));
comment.setAttribute("commentatorName", this.getCommentatorName());
comment.setTextContent(this.getComment());
return comment;
}
}

View file

@ -3,6 +3,8 @@ package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Line;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class Line_File_Impl implements Content, Line {
private final int contentId;
@ -39,4 +41,13 @@ public class Line_File_Impl implements Content, Line {
public String toTeX() {
return this.getContent() + "\\\n";
}
@Override
public Element toXML(Document doc) {
Element line = doc.createElement("line");
line.setAttribute("contentId", String.valueOf(this.getContentId()));
line.setAttribute("speechId", String.valueOf(this.getSpeechId()));
line.setTextContent(this.getContent());
return line;
}
}

View file

@ -3,6 +3,8 @@ package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speaker;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class Speaker_File_Impl implements Content, Speaker {
@ -54,4 +56,15 @@ public class Speaker_File_Impl implements Content, Speaker {
public String toTeX() {
return "\\textcolor{blue}{Redner/Rednerin}: " + this.getSpeakerName() + "\\\n";
}
@Override
public Element toXML(Document doc) {
Element speaker = doc.createElement("speaker");
speaker.setAttribute("contentId", String.valueOf(this.getContentId()));
speaker.setAttribute("speechId", String.valueOf(this.getSpeechId()));
speaker.setAttribute("speakerId", String.valueOf(this.getSpeakerId()));
speaker.setAttribute("speakerName", this.getSpeakerName());
speaker.setAttribute("fraction", this.getFraction());
return speaker;
}
}

View file

@ -5,6 +5,8 @@ import org.apache.uima.jcas.JCas;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.ArrayList;
@ -121,4 +123,22 @@ public class Speech_File_Impl implements Speech {
return tex.toString();
}
@Override
public Element toXML(Document doc) {
Element speech = doc.createElement("speech");
speech.setAttribute("sessionId", String.valueOf(this.getSessionId()));
speech.setAttribute("agendaItemId", String.valueOf(this.getAgendaItemId()));
speech.setAttribute("speechId", String.valueOf(this.getSpeechId()));
speech.setAttribute("speakerId", String.valueOf(this.getSpeakerId()));
speech.setAttribute("speakerName", this.getSpeakerName());
speech.setAttribute("fraction", this.getFraction());
speech.setAttribute("speechKey", this.getSpeechKey());
for (Content content: this.getSpeechContents()) {
speech.appendChild(content.toXML(doc));
}
return speech;
}
}

View file

@ -1,6 +1,7 @@
package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Element;
public interface Content {
/**
@ -31,4 +32,12 @@ public interface Content {
* @return The content.
*/
String toTeX();
/**
* Returns the content as XML.
*
* @param doc The XML document.
* @return The content.
*/
Element toXML(org.w3c.dom.Document doc);
}

View file

@ -3,6 +3,8 @@ package org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces;
import org.apache.uima.UIMAException;
import org.apache.uima.jcas.JCas;
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.enums.MongoDBEntryType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.List;
@ -87,4 +89,6 @@ public interface Speech {
JCas toCas() throws UIMAException;
String toTeX();
Element toXML(Document doc);
}