Search in sources :

Example 1 with Nodes

use of nu.xom.Nodes in project CoreNLP by stanfordnlp.

the class CoreNLPServlet method outputPretty.

public void outputPretty(PrintWriter out, Annotation annotation) throws ServletException {
    try {
        Document input = XMLOutputter.annotationToDoc(annotation, pipeline);
        Nodes output = corenlpTransformer.transform(input);
        for (int i = 0; i < output.size(); i++) {
            out.print(output.get(i).toXML());
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new ServletException(e);
    }
}
Also used : ServletException(javax.servlet.ServletException) Document(nu.xom.Document) Nodes(nu.xom.Nodes) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) RuntimeIOException(edu.stanford.nlp.io.RuntimeIOException)

Aggregations

RuntimeIOException (edu.stanford.nlp.io.RuntimeIOException)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 Document (nu.xom.Document)1 Nodes (nu.xom.Nodes)1