Processor proc = new Processor(true); SchemaManager sm = proc.getSchemaManager(); sm.load(new StreamSource(new StringReader(sch1))); System.err.println("Schema 1 OK"); sm.newSchemaValidator().validate(new StreamSource(new StringReader(doc1))); System.err.println("Doc 1 OK"); sm.load(new StreamSource(new StringReader(sch2))); System.err.println("Schema 2 OK"); sm.newSchemaValidator().validate(new StreamSource(new StringReader(doc2))); System.err.println("Doc 2 OK");
Processor proc = new Processor(true); SchemaManager sm = proc.getSchemaManager(); sm.load(new StreamSource(new File("data/books.xsd"))); try { SchemaValidator sv = sm.newSchemaValidator(); sv.validate(new StreamSource(new File("data/books.xml"))); System.out.println("First schema validation succeeded (as planned)"); } catch (SaxonApiException err) { System.out.println("First schema validation failed"); }
sm.load(new StreamSource(new File("data/books.xsd"))); SchemaValidator sv = sm.newSchemaValidator(); sv.setLax(false);
schemaManager.load( schema );
isLoaded = schemaManager.load( schemaName );