Search in sources :

Example 1 with XmlInstanceValidator

use of eu.esdihumboldt.hale.io.xml.validator.XmlInstanceValidator in project hale by halestudio.

the class StreamGmlWriterTest method validate.

/**
 * Validate an XML file against the given schemas.
 *
 * @param xmlLocation the location of the XML file
 * @param validationSchemas schemas needed for validation
 * @return the validation report
 * @throws IOProviderConfigurationException if the validator is not
 *             configured correctly
 * @throws IOException if I/O operations fail
 */
public static IOReport validate(URI xmlLocation, List<? extends Locatable> validationSchemas) throws IOProviderConfigurationException, IOException {
    XmlInstanceValidator validator = new XmlInstanceValidator();
    validator.setSchemas(validationSchemas.toArray(new Locatable[validationSchemas.size()]));
    validator.setSource(new DefaultInputSupplier(xmlLocation));
    return validator.execute(null);
}
Also used : XmlInstanceValidator(eu.esdihumboldt.hale.io.xml.validator.XmlInstanceValidator) DefaultInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier) Locatable(eu.esdihumboldt.hale.common.core.io.supplier.Locatable)

Aggregations

DefaultInputSupplier (eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier)1 Locatable (eu.esdihumboldt.hale.common.core.io.supplier.Locatable)1 XmlInstanceValidator (eu.esdihumboldt.hale.io.xml.validator.XmlInstanceValidator)1