Example usage for javax.xml.validation ValidatorHandler setResourceResolver

List of usage examples for javax.xml.validation ValidatorHandler setResourceResolver

Introduction

In this page you can find the example usage for javax.xml.validation ValidatorHandler setResourceResolver.

Prototype

public abstract void setResourceResolver(LSResourceResolver resourceResolver);

Source Link

Document

Sets the LSResourceResolver to customize resource resolution while in a validation episode.

Usage

From source file:jeeves.utils.Xml.java

/**
 * Called by all validation methods to do the real guts of the validation job.
 * @param schema/*  w w w  .ja va  2s . c  o m*/
 * @param xml
 * @param eh
 * @throws Exception
 */
private static void validateRealGuts(Schema schema, Element xml, ErrorHandler eh) throws Exception {

    Resolver resolver = ResolverWrapper.getInstance();

    ValidatorHandler vh = schema.newValidatorHandler();
    vh.setResourceResolver(resolver.getXmlResolver());
    vh.setErrorHandler(eh);

    SAXOutputter so = new SAXOutputter(vh);
    eh.setSo(so);

    so.output(xml);
}