public static void validate(Document document, Schema schema)
throws XcapException
{
try
{
Verifier verifier = schema.newVerifier();
verifier.setErrorHandler(new ErrorHandler()
{
public void error(SAXParseException saxParseEx)
{
log.error("Error during validation.", saxParseEx);
}
public void fatalError(SAXParseException saxParseEx)
{
log.fatal("Fatal error during validation.", saxParseEx);
}
public void warning(SAXParseException saxParseEx)
{
log.warn(saxParseEx);
}
});
VerifierHandler handler = verifier.getVerifierHandler();
verifier.verify(document);
if (!handler.isValid())
{
XcapException e1 = new XcapException(
"Unable to validate document after insertion",