Element datatypeElement = DomHelper.getChildElement(widgetElement, Constants.WD_NS, "datatype");
if (datatypeElement == null)
throw new Exception("A nested datatype element is required for the widget specified at " + DomHelper.getLocation(widgetElement));
Datatype datatype = datatypeManager.createDatatype(datatypeElement, true);
if (datatype.getSelectionList() == null)
throw new Exception("Error: multivaluefields always require a selectionlist at " + DomHelper.getLocation(datatypeElement));
definition.setDatatype(datatype);
boolean required = DomHelper.getAttributeAsBoolean(widgetElement, "required", false);
definition.setRequired(required);