use of com.helger.phive.engine.xsd.ValidationExecutorXSD in project phive by phax.
the class VOM1Converter method _createExecutorXSD.
@Nonnull
private ValidationExecutorXSD _createExecutorXSD(@Nonnull final VOMXSDType aXsd) {
final ValidationExecutorXSD ret;
final String sBuiltIn = aXsd.getBuiltIn();
if (StringHelper.hasText(sBuiltIn)) {
LOGGER.info("Trying to resolve built-in XSD artifact '" + sBuiltIn + "'");
final Schema aSchema = m_aXmlSchemaResolver.getXmlSchemaOfID(sBuiltIn);
if (aSchema == null)
throw new IllegalStateException("Failed to resolve built-in XSD artifact '" + sBuiltIn + "'");
ret = new ValidationExecutorXSD(new ValidationArtefact(EValidationType.XSD, new ReadableResourceByteArray("built-in-" + sBuiltIn, ArrayHelper.EMPTY_BYTE_ARRAY)), () -> aSchema);
} else {
// External resource
final VESID aVESID = _createVESID(aXsd.getResource());
LOGGER.info("Trying to resolve XSD artifact with ID '" + aVESID.getAsSingleID() + "'");
final IReadableResource aRes = m_aArtifactResolver.getArtifactOfID(aVESID);
if (aRes == null)
throw new IllegalStateException("Failed to resolve XSD artifact with ID '" + aVESID.getAsSingleID() + "'");
ret = ValidationExecutorXSD.create(aRes);
}
if (aXsd.hasOptionEntries())
LOGGER.warn("Ignoring all XSD options");
return ret;
}
Aggregations