Map<String, String> attributesMap = Maps.newHashMap();
for (ProtocolDocumentOperation.Component.KeyValuePair pair :
c.getElementStart().getAttributeList()) {
attributesMap.put(pair.getKey(), pair.getValue());
}
output.elementStart(c.getElementStart().getType(), new AttributesImpl(attributesMap));
} 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()) {
Map<String, String> attributesMap = Maps.newHashMap();
for (ProtocolDocumentOperation.Component.KeyValuePair pair :
c.getDeleteElementStart().getAttributeList()) {
attributesMap.put(pair.getKey(), pair.getValue());
}
output.deleteElementStart(c.getDeleteElementStart().getType(),
new AttributesImpl(attributesMap));
} else if (c.hasDeleteElementEnd()) {
output.deleteElementEnd();
} else if (c.hasReplaceAttributes()) {
if (c.getReplaceAttributes().getEmpty()) {
output.replaceAttributes(AttributesImpl.EMPTY_MAP, AttributesImpl.EMPTY_MAP);
} else {
Map<String, String> oldAttributesMap = Maps.newHashMap();
Map<String, String> newAttributesMap = Maps.newHashMap();
for (ProtocolDocumentOperation.Component.KeyValuePair pair :
c.getReplaceAttributes().getOldAttributeList()) {
oldAttributesMap.put(pair.getKey(), pair.getValue());
}
for (ProtocolDocumentOperation.Component.KeyValuePair pair :
c.getReplaceAttributes().getNewAttributeList()) {
newAttributesMap.put(pair.getKey(), pair.getValue());
}
output.replaceAttributes(new AttributesImpl(oldAttributesMap),
new AttributesImpl(newAttributesMap));
}
} else if (c.hasUpdateAttributes()) {
if (c.getUpdateAttributes().getEmpty()) {
output.updateAttributes(AttributesUpdateImpl.EMPTY_MAP);
} else {