throw new Exception("Child " + childName + " of " + parser.getModel().getFieldName() + " is not an ArrayModel");
}
ArrayModel array = (ArrayModel) child;
DataModelEnumeration e = array.getEnumeration();
VariableStore variableStore = parser.getResolver().getVariableStore();
int index = 0;
String oldIndex = variableStore.getValueOf(VariableStore.INDEX);
String oldCount = variableStore.getValueOf(VariableStore.COUNT);
String template = getTemplate();
boolean childIsEditor = parser.isEditor();
Boolean type = getIsEditor();
if (type != null) {
childIsEditor = type.booleanValue();
}
variableStore.setVariable(VariableStore.COUNT, Integer.toString(array.getSize()));
while (e.hasMore()) {
DataModel item = e.next();
variableStore.setVariable(VariableStore.INDEX, Integer.toString(index + 1));
byte result[] = parser.getResolver().resolve(sessionVariable, item, template, childIsEditor);
parser.getOut().write(result);
++index;
}
variableStore.setVariable(VariableStore.COUNT, oldCount);
variableStore.setVariable(VariableStore.INDEX, oldIndex);
}