jcas = jcaz.getView(inputViewName);
} else {
jcas = jcaz;
}
} catch (CASException e1) {
throw new AnalysisEngineProcessException(e1.getCause());
}
// init:
String documentText = jcas.getDocumentText();
String splitSeq = documentText.contains("\r\n") ? "\r\n" : "\n";
map = new int[documentText.length() + 1];
JCas modview = null;
try {
// check if view already exists:
Iterator<JCas> viewIterator = jcas.getViewIterator();
while (viewIterator.hasNext()) {
JCas jCas2 = (JCas) viewIterator.next();
if (jCas2.getViewName().equals(modifiedViewName)) {
modview = jCas2;
getContext().getLogger().log(Level.WARNING,
"view with name \"" + modifiedViewName + "\" already exists.");
}
}
if (modview == null) {
modview = jcas.createView(modifiedViewName);
}
} catch (CASException e) {
e.printStackTrace();
return;
}
SortedSet<HtmlConverterPSpan> visibleSpansSoFar = new TreeSet<HtmlConverterPSpan>();
SortedSet<HtmlConverterPSpan> linebreaksFromHtmlTags = new TreeSet<HtmlConverterPSpan>();
// process
try {
Parser parser = new Parser(documentText);
NodeList list = parser.parse(null);
HtmlConverterVisitor visitor = new HtmlConverterVisitor(newlineInducingTags, skipWhitespaces);
list.visitAllNodesWith(visitor);
visibleSpansSoFar = visitor.getTextSpans();
linebreaksFromHtmlTags = visitor.getLinebreaksFromHtmlTags();
} catch (ParserException e) {
throw new AnalysisEngineProcessException(e);
}
if (replaceLinebreaks) {
visibleSpansSoFar = this.handleLinebreaksInDocumentText(visibleSpansSoFar, splitSeq);
}
if (conversionPolicy == StringConversionPolicy.HEURISTIC) {