data-aggregation-europeana/src/main/java/inescid/oaipmh/harvesters/XmlUtil.java
/**
     * Validates XML on a XMLschema
     * 
     * @param xmlSchema
     * @param sourceXml
     */
Validates XML on a XMLschema

@param xmlSchema
@param sourceXml
Validates XML on a XMLschema @param xmlSchema @param sourceXml
public static void validateXmlOnSchema(File xmlSchema, Source sourceXml) {
        Schema schema = newSchema(xmlSchema);
        try {
            schema.newValidator().validate(sourceXml);
        } catch (Exception e) {
            throw new RuntimeException("Could not validate '" + sourceXml.getSystemId() +
                                       "' with '" + xmlSchema.getName() + "'!", e);
        }
    }
public static void validateXmlOnSchema ( File xmlSchema , Source sourceXml ) { Schema schema = newSchema ( xmlSchema ) ; try { schema . newValidator ( ) . validate ( sourceXml ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not validate '" + sourceXml . getSystemId ( ) + "' with '" + xmlSchema . getName ( ) + "'!" , e ) ; } }
Validates XML on a XMLschema
Validates XML on a XMLschema