final String name = attr.value();
final String value = subst.replace(event, getAttrValue(name, aliases, attrs));
sb.append(name).append("=\"").append(value).append("\"");
parms[index] = value;
} else if (a instanceof PluginElement) {
final PluginElement elem = (PluginElement) a;
final String name = elem.value();
if (parmClasses[index].isArray()) {
final Class<?> parmClass = parmClasses[index].getComponentType();
final List<Object> list = new ArrayList<Object>();
sb.append(name).append("={");
boolean first = true;
for (final Node child : children) {
final PluginType<?> childType = child.getType();
if (elem.value().equalsIgnoreCase(childType.getElementName()) ||
parmClass.isAssignableFrom(childType.getPluginClass())) {
used.add(child);
if (!first) {
sb.append(", ");
}
first = false;
final Object obj = child.getObject();
if (obj == null) {
LOGGER.error("Null object returned for " + child.getName() + " in " +
node.getName());
continue;
}
if (obj.getClass().isArray()) {
printArray(sb, (Object[]) obj);
parms[index] = obj;
break;
}
sb.append(child.toString());
list.add(obj);
}
}
sb.append("}");
if (parms[index] != null) {
break;
}
if (list.size() > 0 && !parmClass.isAssignableFrom(list.get(0).getClass())) {
LOGGER.error("Attempted to assign List containing class " +
list.get(0).getClass().getName() + " to array of type " + parmClass +
" for attribute " + name);
break;
}
final Object[] array = (Object[]) Array.newInstance(parmClass, list.size());
int i = 0;
for (final Object obj : list) {
array[i] = obj;
++i;
}
parms[index] = array;
} else {
final Class<?> parmClass = parmClasses[index];
boolean present = false;
for (final Node child : children) {
final PluginType<?> childType = child.getType();
if (elem.value().equals(childType.getElementName()) ||
parmClass.isAssignableFrom(childType.getPluginClass())) {
sb.append(child.getName()).append("(").append(child.toString()).append(")");
present = true;
used.add(child);
parms[index] = child.getObject();