Hi, I am using Aspose for java. While parsing document I encountered some character in a run.
Can you please tell me if this is valid character. If it is, what is its purpose and how can I handle it.
I am writing doc -> xml conversion and parser throws exception because of it.
Here is my quick code how to reach this character:
public void test() throws Exception {
InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream("aspose/words/chapt_3_one_page.doc");
Document document = new Document(inputStream);
List commentList = getComments(document);
Comment comment = commentList.get(1);
NodeCollection nodeCollection = comment.getChildNodes();
Paragraph paragraph = (Paragraph) nodeCollection.get(0);
NodeCollection paragraphChildes = paragraph.getChildNodes();
Run run = (Run) paragraphChildes.get(1);
System.out.print(run.getText()); // it is in this run
}
private List getComments(Document document) {
final List commentList = new ArrayList();
try {
document.accept(new DocumentVisitor() {
@Override
public int visitCommentStart(Comment arg0) throws Exception {
commentList.add(arg0);
return super.visitCommentStart(arg0);
}
});
} catch (Exception e) {
throw new RuntimeException();
}
return commentList;
}
Thanks, Ivica