use of nu.validator.xml.dataattributes.DataAttributeDroppingSchemaWrapper in project validator by validator.
the class ValidationWorker method main.
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "utf-8"));
PrintWriter out = new PrintWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(args[1])), "utf-8"), true);
File rootDir = new File(args[2]);
Set<Schema> schemas = new HashSet<Schema>();
schemas.add(CheckerSchema.ASSERTION_SCH);
schemas.add(CheckerSchema.NORMALIZATION_CHECKER);
schemas.add(CheckerSchema.TABLE_CHECKER);
schemas.add(CheckerSchema.TEXT_CONTENT_CHECKER);
schemas.add(CheckerSchema.USEMAP_CHECKER);
InputSource is = new InputSource((new File(args[3])).toURL().toExternalForm());
SchemaReader sr = CompactSchemaReader.getInstance();
schemas.add(new XmlLangAttributeDroppingSchemaWrapper(new DataAttributeDroppingSchemaWrapper(sr.createSchema(is, PropertyMap.EMPTY))));
CountingReadLine countingReadLine = new CountingReadLine(in);
for (int i = 0; i < 4; i++) {
(new Thread(new ValidationWorker(countingReadLine, out, rootDir, schemas))).start();
}
}
use of nu.validator.xml.dataattributes.DataAttributeDroppingSchemaWrapper 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