use of nu.validator.xml.templateelement.TemplateElementDroppingSchemaWrapper in project validator by validator.
the class SimpleDocumentValidator method setUpMainSchema.
/* *
* Prepares the main RelaxNG schema to use for document validation, by
* retrieving a serialized schema instance from the copies of known
* http://s.validator.nu/* schemas in the local entity cache packaged with
* the validator code and creating a Schema instance from it. Also checks
* for resolution of secondary schemas.
*
* @param schemaUrl an http://s.validator.nu/* URL
*
* @param errorHandler error handler for schema-error reporting
*
* @throws SchemaReadException if retrieval of any schema fails
*/
public void setUpMainSchema(String schemaUrl, ErrorHandler errorHandler) throws SAXException, Exception, SchemaReadException {
Schema schema = schemaByUrl(schemaUrl, errorHandler);
if (schemaUrl.contains("html5")) {
try {
assertionSchema = CheckerSchema.ASSERTION_SCH;
} catch (Exception e) {
throw new SchemaReadException("Failed to retrieve secondary schema.");
}
schema = new DataAttributeDroppingSchemaWrapper(schema);
schema = new XmlLangAttributeDroppingSchemaWrapper(schema);
schema = new RoleAttributeFilteringSchemaWrapper(schema);
schema = new TemplateElementDroppingSchemaWrapper(schema);
schema = new NamespaceChangingSchemaWrapper(schema);
this.hasHtml5Schema = true;
if ("http://s.validator.nu/html5-all.rnc".equals(schemaUrl)) {
System.setProperty("nu.validator.schema.rdfa-full", "1");
} else {
System.setProperty("nu.validator.schema.rdfa-full", "0");
}
}
this.mainSchemaUrl = schemaUrl;
this.mainSchema = schema;
}
Aggregations