Example usage for javax.xml.validation Validator getClass

List of usage examples for javax.xml.validation Validator getClass

Introduction

In this page you can find the example usage for javax.xml.validation Validator getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:de.fzi.ALERT.actor.MessageObserver.ComplexEventObserver.JMSMessageParser.java

public void validateXml(Schema schema, org.w3c.dom.Document doc) {
    try {/*from   www.j  a v  a  2s  . c  o  m*/
        // creating a Validator instance
        Validator validator = schema.newValidator();
        System.out.println();
        System.out.println("Validator Class: " + validator.getClass().getName());

        // setting my own error handler
        validator.setErrorHandler(new MyErrorHandler());

        // validating the document against the schema
        validator.validate(new DOMSource(doc));
        System.out.println();
        if (errorCount > 0) {
            System.out.println("Failed with errors: " + errorCount);
        } else {
            System.out.println("Passed.");
        }

    } catch (Exception e) {
        // catching all validation exceptions
        System.out.println();
        System.out.println(e.toString());
    }
}