private Field parseGroupField(final NodeList nodeList, final int nodeIndex) throws XPathExpressionException
{
final String dimensionTypeName = getAttributeValue(nodeList.item(nodeIndex), "dimensionType", "groupSizeEncoding");
Type dimensionType = typeByNameMap.get(dimensionTypeName);
if (dimensionType == null)
{
handleError(nodeList.item(nodeIndex), "could not find dimensionType: " + dimensionTypeName);
}
else if (!(dimensionType instanceof CompositeType))
{
handleError(nodeList.item(nodeIndex), "dimensionType should be a composite type: " + dimensionTypeName);
dimensionType = null;
}
else
{
((CompositeType)dimensionType).checkForWellFormedGroupSizeEncoding(nodeList.item(nodeIndex));
}
final Field field = new Field.Builder()
.name(getAttributeValue(nodeList.item(nodeIndex), "name"))
.description(getAttributeValueOrNull(nodeList.item(nodeIndex), "description"))
.id(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "id")))
.blockLength(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "blockLength", "0")))
.sinceVersion(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "sinceVersion", "0")))
.dimensionType((CompositeType)dimensionType)
.build();
XmlSchemaParser.checkForValidName(nodeList.item(nodeIndex), field.name());
field.groupFields(parseFieldsAndGroups(nodeList.item(nodeIndex)));
return field;
}