}
//---- parse "datatype"
Element datatypeElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "datatype");
if (datatypeElement != null) {
Datatype datatype = datatypeManager.createDatatype(datatypeElement, isArrayType);
// ---- parse "initial-value"
Object initialValue = null;
Element initialValueElement = DomHelper.getChildElement(widgetElement, FormsConstants.DEFINITION_NS, "initial-value", false);
if (initialValueElement != null) {
String localeValue = DomHelper.getAttribute(initialValueElement, "locale", null);
Locale locale = localeValue == null ? Locale.getDefault() : I18nUtils.parseLocale(localeValue);
String value = DomHelper.getElementText(initialValueElement);
ConversionResult result = datatype.convertFromString(value, locale);
if (!result.isSuccessful()) {
throw new FormsException("Cannot parse initial value '" + value + "'.",
DomHelper.getLocationObject(initialValueElement));
}
initialValue = result.getResult();