Search in sources :

Example 1 with JAXPValidator

use of org.xmlunit.validation.JAXPValidator in project syndesis by syndesisio.

the class UnifiedXmlDataShapeGeneratorShapeValidityTest method createValidator.

public static Validator createValidator() {
    final SchemaFactory schemaFactory = SchemaFactory.newInstance(Languages.W3C_XML_SCHEMA_NS_URI);
    final Schema schema;
    try {
        schema = schemaFactory.newSchema(UnifiedXmlDataShapeGenerator.class.getResource("/swagger/atlas-xml-schemaset-model-v2.xsd"));
    } catch (final SAXException e) {
        throw new ExceptionInInitializerError(e);
    }
    final Validator validator = new JAXPValidator(Languages.W3C_XML_SCHEMA_NS_URI, new FixedSchemaValidator(schema));
    validator.setSchemaSource(CACHED_SCHEMA);
    return validator;
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) JAXPValidator(org.xmlunit.validation.JAXPValidator) Schema(javax.xml.validation.Schema) JAXPValidator(org.xmlunit.validation.JAXPValidator) Validator(org.xmlunit.validation.Validator) SAXException(org.xml.sax.SAXException)

Aggregations

Schema (javax.xml.validation.Schema)1 SchemaFactory (javax.xml.validation.SchemaFactory)1 SAXException (org.xml.sax.SAXException)1 JAXPValidator (org.xmlunit.validation.JAXPValidator)1 Validator (org.xmlunit.validation.Validator)1