* @throws InvalidFormatException
*/
private static void handleRels(Differencer pd, MainDocumentPart newMDP) throws InvalidFormatException {
RelationshipsPart rp = newMDP.getRelationshipsPart();
//System.out.println("before: \n" + rp.getXML());
// Since we are going to add rels appropriate to the docs being
// compared, for neatness and to avoid duplication
// (duplication of internal part names is fatal in Word,
// and export xslt makes images internal, though it does avoid duplicating
// a part ),
// remove any existing rels which point to images
List<Relationship> relsToRemove = new ArrayList<Relationship>();
for (Relationship r : rp.getRelationships().getRelationship() ) {
// Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
if (r.getType().equals(Namespaces.IMAGE)) {
relsToRemove.add(r);
}
}
for (Relationship r : relsToRemove) {
rp.removeRelationship(r);
}
// Now add the rels we composed
Map<Relationship, Part> newRels = pd.getComposedRels();
for (Relationship nr : newRels.keySet()) {