int changes = boundary.getChange().size();
String[] changeKeys = new String[changes];
String[] oldValues = new String[changes];
String[] newValues = new String[changes];
for (int i = 0; i < changes; i++) {
KeyValueUpdate kvu = boundary.getChange(i);
changeKeys[i] = kvu.getKey();
oldValues[i] = kvu.hasOldValue() ? kvu.getOldValue() : null;
newValues[i] = kvu.hasNewValue() ? kvu.getNewValue() : null;
}
output.annotationBoundary(new AnnotationBoundaryMapImpl(ends, changeKeys, oldValues,
newValues));
}
} else if (c.hasCharacters()) {
output.characters(c.getCharacters());
} else if (c.hasElementStart()) {
output.elementStart(c.getElementStart().getType(), new AttributesImpl(deserialize(c
.getElementStart().getAttribute())));
} else if (c.hasElementEnd()) {
output.elementEnd();
} else if (c.hasRetainItemCount()) {
output.retain(c.getRetainItemCount());
} else if (c.hasDeleteCharacters()) {
output.deleteCharacters(c.getDeleteCharacters());
} else if (c.hasDeleteElementStart()) {
output.deleteElementStart(c.getDeleteElementStart().getType(), new AttributesImpl(
deserialize(c.getDeleteElementStart().getAttribute())));
} else if (c.hasDeleteElementEnd()) {
output.deleteElementEnd();
} else if (c.hasReplaceAttributes()) {
ReplaceAttributes r = c.getReplaceAttributes();
if (r.getEmpty()) {
output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
} else {
output.replaceAttributes(new AttributesImpl(deserialize(r.getOldAttribute())),
new AttributesImpl(deserialize(r.getNewAttribute())));
}
} else if (c.hasUpdateAttributes()) {
UpdateAttributes u = c.getUpdateAttributes();
if (u.getEmpty()) {
output.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
} else {
String[] triplets = new String[u.getAttributeUpdate().size() * 3];
int i = 0;
for (KeyValueUpdate kvu : u.getAttributeUpdate()) {
triplets[i++] = kvu.getKey();
triplets[i++] = kvu.hasOldValue() ? kvu.getOldValue() : null;
triplets[i++] = kvu.hasNewValue() ? kvu.getNewValue() : null;
}
output.updateAttributes(new AttributesUpdateImpl(triplets));
}
} else {
// throw new