Preconditions.checkNotNull(keyAttributeName, "Null keyAttributeName");
Preconditions.checkNotNull(valueAttributeName, "Null valueAttributeName");
Map<String, String> out = Maps.newHashMap();
for (Component component : doc.getComponentList()) {
if (component.hasElementStart()) {
ElementStart start = component.getElementStart();
Assert.check(elementType.equals(start.getType()), "Unexpected element type: %s", doc);
Map<String, String> attrs = Maps.newHashMap();
for (KeyValuePair attr : start.getAttributeList()) {
attrs.put(attr.getKey(), attr.getValue());
}
Assert.check(attrs.size() == 2, "Need two attrs: %s", doc);
String key = attrs.get(keyAttributeName);
String value = attrs.get(valueAttributeName);