Search in sources :

Example 1 with ValidationEventLocator

use of javax.xml.bind.ValidationEventLocator in project hibernate-orm by hibernate.

the class ContextProvidingValidationEventHandler method handleEvent.

@Override
public boolean handleEvent(ValidationEvent validationEvent) {
    ValidationEventLocator locator = validationEvent.getLocator();
    lineNumber = locator.getLineNumber();
    columnNumber = locator.getColumnNumber();
    message = validationEvent.getMessage();
    return false;
}
Also used : ValidationEventLocator(javax.xml.bind.ValidationEventLocator)

Example 2 with ValidationEventLocator

use of javax.xml.bind.ValidationEventLocator in project OpenAM by OpenRock.

the class ErrorHandlerAdaptor method propagateEvent.

private void propagateEvent(int severity, SAXParseException saxException) throws SAXException {
    // get location info:
    //     sax locators simply use the location info embedded in the 
    //     sax exception, dom locators keep a reference to their DOMScanner
    //     and call back to figure out where the error occurred.
    ValidationEventLocator vel = locator.getLocation(saxException);
    ValidationEventImpl ve = new ValidationEventImpl(severity, saxException.getMessage(), vel);
    Exception e = saxException.getException();
    if (e != null) {
        ve.setLinkedException(e);
    } else {
        ve.setLinkedException(saxException);
    }
    // call the client's event handler.
    host.handleEvent(ve, severity != ValidationEvent.FATAL_ERROR);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEventLocator(javax.xml.bind.ValidationEventLocator) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Example 3 with ValidationEventLocator

use of javax.xml.bind.ValidationEventLocator in project OpenAM by OpenRock.

the class ErrorHandlerAdaptor method propagateEvent.

private void propagateEvent(int severity, SAXParseException saxException) throws SAXException {
    // get location info:
    //     sax locators simply use the location info embedded in the 
    //     sax exception, dom locators keep a reference to their DOMScanner
    //     and call back to figure out where the error occurred.
    ValidationEventLocator vel = locator.getLocation(saxException);
    ValidationEventImpl ve = new ValidationEventImpl(severity, saxException.getMessage(), vel);
    Exception e = saxException.getException();
    if (e != null) {
        ve.setLinkedException(e);
    } else {
        ve.setLinkedException(saxException);
    }
    // call the client's event handler.
    host.handleEvent(ve, severity != ValidationEvent.FATAL_ERROR);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEventLocator(javax.xml.bind.ValidationEventLocator) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Example 4 with ValidationEventLocator

use of javax.xml.bind.ValidationEventLocator in project hibernate-orm by hibernate.

the class ContextProvidingValidationEventHandler method handleEvent.

@Override
public boolean handleEvent(ValidationEvent validationEvent) {
    ValidationEventLocator locator = validationEvent.getLocator();
    lineNumber = locator.getLineNumber();
    columnNumber = locator.getColumnNumber();
    message = validationEvent.getMessage();
    return false;
}
Also used : ValidationEventLocator(javax.xml.bind.ValidationEventLocator)

Example 5 with ValidationEventLocator

use of javax.xml.bind.ValidationEventLocator in project Payara by payara.

the class ErrorHandlerAdaptor method propagateEvent.

private void propagateEvent(int severity, SAXParseException saxException) throws SAXException {
    // get location info:
    // sax locators simply use the location info embedded in the
    // sax exception, dom locators keep a reference to their DOMScanner
    // and call back to figure out where the error occurred.
    ValidationEventLocator vel = locator.getLocation(saxException);
    ValidationEventImpl ve = new ValidationEventImpl(severity, saxException.getMessage(), vel);
    Exception e = saxException.getException();
    if (e != null) {
        ve.setLinkedException(e);
    } else {
        ve.setLinkedException(saxException);
    }
    // call the client's event handler.
    host.handleEvent(ve, severity != ValidationEvent.FATAL_ERROR);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEventLocator(javax.xml.bind.ValidationEventLocator) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Aggregations

ValidationEventLocator (javax.xml.bind.ValidationEventLocator)9 SAXException (org.xml.sax.SAXException)6 ValidationEventImpl (javax.xml.bind.helpers.ValidationEventImpl)5 SAXParseException (org.xml.sax.SAXParseException)5 URL (java.net.URL)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 JAXBContext (javax.xml.bind.JAXBContext)1 JAXBException (javax.xml.bind.JAXBException)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 ValidationEvent (javax.xml.bind.ValidationEvent)1 ValidationEventCollector (javax.xml.bind.util.ValidationEventCollector)1 Schema (javax.xml.validation.Schema)1 SchemaFactory (javax.xml.validation.SchemaFactory)1 Node (org.w3c.dom.Node)1