Package javax.xml.bind

Examples of javax.xml.bind.ValidationEventLocator


           
        // 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  );
View Full Code Here


  private int columnNumber;
  private String message;

  @Override
  public boolean handleEvent(ValidationEvent validationEvent) {
    ValidationEventLocator locator = validationEvent.getLocator();
    lineNumber = locator.getLineNumber();
    columnNumber = locator.getColumnNumber();
    message = validationEvent.getMessage();
    return false;
  }
View Full Code Here

    u.setEventHandler(
        new ValidationEventHandler() {
          public boolean handleEvent(ValidationEvent ve) {
            // ignore warnings
            if (ve.getSeverity() == ValidationEvent.WARNING) {
              ValidationEventLocator vel = ve.getLocator();
              System.out.println("Warning");
              System.out.println("Line:Col[" + vel.getLineNumber() +
                  ":" + vel.getColumnNumber() +
                  "]:" + ve.getMessage());
            } else {
              // block if fatal error or error
              ValidationEventLocator vel = ve.getLocator();
              System.out.println("ERROR during schema validation");
              System.out.println("Line:Col[" + vel.getLineNumber() +
                  ":" + vel.getColumnNumber() +
                  "]:" + ve.getMessage());
              return false;
            }
            return true;
          }
View Full Code Here

        super();
        eventHandler = validationEventHandler;
    }

    public void warning(SAXParseException exception) throws SAXException {
        ValidationEventLocator eventLocator = new ValidationEventLocatorImpl(exception);
        ValidationEvent event = new ValidationEventImpl(ValidationEvent.WARNING, null, eventLocator, exception);
        if (!eventHandler.handleEvent(event)) {
            throw exception;
        }
    }
View Full Code Here

            throw exception;
        }
    }

    public void error(SAXParseException exception) throws SAXException {
        ValidationEventLocator eventLocator = new ValidationEventLocatorImpl(exception);
        ValidationEvent event = new ValidationEventImpl(ValidationEvent.ERROR, null, eventLocator, exception);
        if (!eventHandler.handleEvent(event)) {
            throw exception;
        }
    }
View Full Code Here

            throw exception;
        }
    }

    public void fatalError(SAXParseException exception) throws SAXException {
        ValidationEventLocator eventLocator = new ValidationEventLocatorImpl(exception);
        ValidationEvent event = new ValidationEventImpl(ValidationEvent.FATAL_ERROR, null, eventLocator, exception);
        if (!eventHandler.handleEvent(event)) {
            throw exception;
        }
    }
View Full Code Here

     *
     */
    private String getLocation(ValidationEvent event) {
        StringBuffer msg = new StringBuffer();
       
        ValidationEventLocator locator = event.getLocator();
       
        if( locator != null ) {
           
            URL url = locator.getURL();
            Object obj = locator.getObject();
            Node node = locator.getNode();
            int line = locator.getLineNumber();
           
            if( url!=null || line!=-1 ) {
                msg.append( "line " + line );
                if( url!=null )
                    msg.append( " of " + url );
View Full Code Here

    private int columnNumber;
    private String message;

    @Override
    public boolean handleEvent(ValidationEvent validationEvent) {
      ValidationEventLocator locator = validationEvent.getLocator();
      lineNumber = locator.getLineNumber();
      columnNumber = locator.getColumnNumber();
      message = validationEvent.getMessage();
      return false;
    }
View Full Code Here

    private int columnNumber;
    private String message;

    @Override
    public boolean handleEvent(ValidationEvent validationEvent) {
      ValidationEventLocator locator = validationEvent.getLocator();
      lineNumber = locator.getLineNumber();
      columnNumber = locator.getColumnNumber();
      message = validationEvent.getMessage();
      return false;
    }
View Full Code Here

     *
     */
    private String getLocation(ValidationEvent event) {
        StringBuffer msg = new StringBuffer();
       
        ValidationEventLocator locator = event.getLocator();
       
        if( locator != null ) {
           
            URL url = locator.getURL();
            Object obj = locator.getObject();
            Node node = locator.getNode();
            int line = locator.getLineNumber();
           
            if( url!=null || line!=-1 ) {
                msg.append( "line " + line );
                if( url!=null )
                    msg.append( " of " + url );
View Full Code Here

TOP

Related Classes of javax.xml.bind.ValidationEventLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.