handler.endElement("", "span", "span");
conflictStarted = false;
}
generateOutput(((TagNode) child));
} else if (child instanceof TextNode) {
TextNode textChild = (TextNode) child;
Modification mod = textChild.getModification();
if (newStarted
&& (mod.getOutputType() != ModificationType.ADDED || mod
.isFirstOfID())) {
handler.endElement("", "span", "span");
newStarted = false;
} else if (changeStarted
&& (mod.getOutputType() != ModificationType.CHANGED
|| !mod.getChanges().equals(changeTXT) || mod
.isFirstOfID())) {
handler.endElement("", "span", "span");
changeStarted = false;
} else if (remStarted
&& (mod.getOutputType() != ModificationType.REMOVED || mod
.isFirstOfID())) {
handler.endElement("", "span", "span");
remStarted = false;
} else if (conflictStarted
&& (!mod.getOutputType().isConflict() || mod
.isFirstOfID())) {
handler.endElement("", "span", "span");
conflictStarted = false;
}
// no else because a removed part can just be closed and a new
// part can start
if (!newStarted
&& mod.getOutputType() == ModificationType.ADDED) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "class", "class", "CDATA",
"diff-html-added");
addAttributes(mod, attrs);
handler.startElement("", "span", "span", attrs);
newStarted = true;
} else if (!changeStarted
&& mod.getOutputType() == ModificationType.CHANGED) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "class", "class", "CDATA",
"diff-html-changed");
addAttributes(mod, attrs);
handler.startElement("", "span", "span", attrs);
changeStarted = true;
changeTXT = mod.getChanges();
} else if (!remStarted
&& mod.getOutputType() == ModificationType.REMOVED) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "class", "class", "CDATA",
"diff-html-removed");
addAttributes(mod, attrs);
handler.startElement("", "span", "span", attrs);
remStarted = true;
} else if (!conflictStarted
&& mod.getOutputType().isConflict()) {
AttributesImpl attrs = new AttributesImpl();
String yoursOrTheirs = mod.getOutputType() == ModificationType.CONFLICT_YOURS ? "yours" : "theirs";
attrs.addAttribute("", "class", "class", "CDATA",
"diff-html-conflict-" + yoursOrTheirs);
addAttributes(mod, attrs);
handler.startElement("", "span", "span", attrs);
conflictStarted = true;
}
char[] chars = textChild.getText().toCharArray();
if (textChild instanceof ImageNode) {
writeImage((ImageNode) textChild);
} else {
handler.characters(chars, 0, chars.length);