Package javax.xml.bind

Examples of javax.xml.bind.ValidationException


       
            //ValidatableObject vo = Util.toValidatableObject(o);
            ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( nested != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here


        }

        try {
            return xmlValidator.validateRoot(rootObject);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validate(object);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

       
            //ValidatableObject vo = Util.toValidatableObject(o);
            ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( nested != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

  /** <p>Returns a new JMValidator.</p>
   */
  public JMValidator getJMValidator() throws ValidationException {
    Class c = getJMValidatorClass();
    if (c == null) {
      throw new ValidationException("A JMValidator class is not set.");
    }
    try {
      return (JMValidator) c.newInstance();
    } catch (Exception e) {
      throw new ValidationException("Failed to instantiate JMValidator class " + c, e);
    }
  }
View Full Code Here

       
            //ValidatableObject vo = Util.toValidatableObject(o);
            ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( nested != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

        throws ValidationException {
           
        try {
       
            if(!(o instanceof ValidatableObject))
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
            ValidatableObject vo = (ValidatableObject)o;
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // TODO exception handling.
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( e != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

       
            //ValidatableObject vo = Util.toValidatableObject(o);
            ValidatableObject vo = jaxbContext.getGrammarInfo().castToValidatableObject(o);
           
            if(vo==null)
                throw new ValidationException(
                    Messages.format( Messages.NOT_VALIDATABLE ) );
       
            EventInterceptor ei = new EventInterceptor(eventHandler);
            ValidationContext context = new ValidationContext(jaxbContext,ei,validateId);
            context.validate(vo);
            context.reconcileIDs();
           
            return !ei.hadError();
        } catch( SAXException e ) {
            // we need a consistent mechanism to convert SAXException into JAXBException
            Exception nested = e.getException();
            if( nested != null ) {
                throw new ValidationException( nested );
            } else {
                throw new ValidationException( e );
            }
            //return false;
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validateRoot(rootObject);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

        }

        try {
            return xmlValidator.validate(object);
        } catch (Exception e) {
            throw new ValidationException(e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.ValidationException

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.