/** * Asserts that the given xhtml matches the schema. * * @param xhtml the xhtmlto validate. * * @throws SAXException if there is a parsing error */ public void assertSchemaMatch(final String xhtml) throws SAXException { // Load the schema. Object schema = getClass().getResource("/schema/ui/v1/schema.xsd").toString(); // Validate the xhtml. Validator validator; StringReader reader = new StringReader(xhtml); validator = new Validator(reader); validator.useXMLSchema(true); validator.setJAXP12SchemaSource(schema); validator.assertIsValid(); }
/** * Asserts that the given xhtml matches the schema. * * @param xhtml the xhtml to validate. * * @throws IOException if there is an I/O error * @throws SAXException if there is a parsing error */ public void assertSchemaMatch(final String xhtml) throws IOException, SAXException { Validator validator = getSchemaValidator(xhtml); validator.assertIsValid(); }
validator.assertIsValid();