if (_initialValue != null && _initialValue.indexOf("<") != -1) {
try {
SAXBuilder builder = new SAXBuilder();
builder.build(new StringReader("<bla>" + _initialValue + "</bla>"));
} catch (Exception e) {
messages.add(new YVerificationMessage(
this,
"Problem with InitialValue [" + _initialValue +
"] of " + this +
" " + e.getMessage(),
YVerificationMessage.ERROR_STATUS));
}
}
XMLToolsForYAWL xty = _parentDecomposition.getSpecification().getToolsForYAWL();
//check schema contains type with typename.
if (null != _name) {
boolean isSchemForSchemType =
xty.getSchema4SchemaNameSpace().equals(_namespaceURI);
if (true == _isUntyped) {
if (null != _dataTypeName) {
//todo [in future - if we ever disallow untyped elements]
//todo we may want to catch this and _report it.
}
} else if (!xty.isValidType(_dataTypeName, isSchemForSchemType)) {
messages.add(new YVerificationMessage(
this,
"The type library (Schema) in specification contains no " +
"type definition with name [" + _dataTypeName + "]. " +
"Therefore the decomposition " + _parentDecomposition +
" cannot create this variable.",
YVerificationMessage.ERROR_STATUS));
}
} else if (null != _elementName) {
boolean schemaContainsElement =
xty.getPrimarySchemaElementNames().contains(_elementName);
if (!schemaContainsElement) {
messages.add(new YVerificationMessage(
this,
"The type library (Schema) in specification contains no " +
"element definition with name [" + _elementName + "]. " +
"\n Therefore the decomposition " + _parentDecomposition +
" cannot create this variable.",
YVerificationMessage.ERROR_STATUS));
}
} else if (null != _name) {
if (null != _elementName) {
messages.add(new YVerificationMessage(
this,
"name xor element name must be set, not both",
YVerificationMessage.ERROR_STATUS));
}
} else {
messages.add(new YVerificationMessage(
this,
"name or element name must be set",
YVerificationMessage.ERROR_STATUS));
}
//todo check initial value is of data-type