wordMLPackage.getMainDocumentPart().addParagraphOfText("TESTING " + testparagraphs[i]
+ ", " + testparagraphs[j] );
// Test setup
wordMLPackage.getMainDocumentPart().addParagraphOfText("first:");
P pl = Differencer.loadParagraph(BASE_DIR + testparagraphs[i]);
wordMLPackage.getMainDocumentPart().addObject(pl);
wordMLPackage.getMainDocumentPart().addParagraphOfText("second:");
P pr = Differencer.loadParagraph(BASE_DIR + testparagraphs[j]);
wordMLPackage.getMainDocumentPart().addObject(pr);
// Result format
JAXBContext jc = Context.jc;
javax.xml.bind.util.JAXBResult result = new javax.xml.bind.util.JAXBResult(jc );
// Run the diff
Differencer pd = new Differencer();
pd.diff(pl, pr, result, null, null,
null, null);
try {
P markedUpP = (org.docx4j.wml.P)result.getResult();
wordMLPackage.getMainDocumentPart().addParagraphOfText("result:");
wordMLPackage.getMainDocumentPart().addObject(markedUpP);
} catch (RuntimeException e) {
String msg = "failed to apply stylesheet to pre-processed! "
+ testparagraphs[i] + ", " + testparagraphs[j];
System.out.println(msg);
e.printStackTrace();
wordMLPackage.getMainDocumentPart().addParagraphOfText(msg);
StreamResult err = new StreamResult(System.out);
pd.diff(pl, pr, err, null, null,
null, null);
}
// Compare no pre-processor
result = new javax.xml.bind.util.JAXBResult(jc );
pd.diff(pl, pr, result, null, null,
null, null);
try {
P markedUpPsimple = (org.docx4j.wml.P)result.getResult();
wordMLPackage.getMainDocumentPart().addParagraphOfText("no preprocessing:");
wordMLPackage.getMainDocumentPart().addObject(markedUpPsimple);
} catch (RuntimeException e) {
String msg = "failed to apply stylesheet to naive! "
+ testparagraphs[i] + ", " + testparagraphs[j];