* all extracted information about the parsed document
*/
public Document[] parse(final MultiProtocolURI location, final String mimeType, final String charset, final InputStream source)
throws Parser.Failure, InterruptedException {
Document theDoc = null;
try {
String contents = "";
SummaryInformation summary = null;
try {
final VisioTextExtractor extractor = new VisioTextExtractor(source);
contents = extractor.getText();
summary = extractor.getSummaryInformation();
} catch (Exception e) {
Log.logWarning("vsdParser", e.getMessage());
}
String author = null;
String[] keywords = null;
String title = null;
if (summary != null) {
author = summary.getAuthor();
if (summary.getKeywords() != null) {
keywords = summary.getKeywords().split("[ ,;]");
}
title = summary.getTitle();
}
String abstrct = null;
abstrct = ((contents.length() > 80)? contents.substring(0, 80) : contents.trim()).
replaceAll("\r\n"," ").
replaceAll("\n"," ").
replaceAll("\r"," ").
replaceAll("\t"," ");
if (title == null) {
title = abstrct;
}
// As the result of parsing this function must return a plasmaParserDocument object
return new Document[]{new Document(
location, // url of the source document
mimeType, // the documents mime type
"UTF-8", // charset of the document text
this,
null, // language