Package javax.xml.bind

Examples of javax.xml.bind.ValidationEventHandler


        factory.setValidating(false);
        SAXParser parser = factory.newSAXParser();

        JAXBContext ctx = getContext(type);
        Unmarshaller unmarshaller = ctx.createUnmarshaller();
        unmarshaller.setEventHandler(new ValidationEventHandler(){
            public boolean handleEvent(ValidationEvent validationEvent) {
//                System.out.println(validationEvent);
                return false;
            }
        });
View Full Code Here


        try {
            parser = factory.newSAXParser();
       

        Unmarshaller unmarshaller = FEATURES_CONTEXT.createUnmarshaller();
        unmarshaller.setEventHandler(new ValidationEventHandler() {
            public boolean handleEvent(ValidationEvent validationEvent) {
                System.out.println(validationEvent);
                return false;
            }
        });
View Full Code Here

                unmarshaller.setSchema(schema);

                unmarshaller.setEventHandler(

                new ValidationEventHandler()
                {
                    public boolean handleEvent(ValidationEvent ve)
                    {
                        if (ve.getSeverity() != ValidationEvent.WARNING)
                        {
View Full Code Here

            SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
            try {
                Schema schema = sf.newSchema(new File("po.xsd"));
                u.setSchema(schema);
                u.setEventHandler(
                    new ValidationEventHandler() {
                        // allow unmarshalling to continue even if there are errors
                        public boolean handleEvent(ValidationEvent ve) {
                            // ignore warnings
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
View Full Code Here

               
                u.setSchema(schema);
               
                u.setEventHandler(
                   
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent ve) {
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
                                System.out.println("Line:Col[" + vel.getLineNumber() +
                                    ":" + vel.getColumnNumber() +
View Full Code Here

               
                u.setSchema(schema);
               
                u.setEventHandler(
                   
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent ve) {
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
                                System.out.println("Line:Col[" + vel.getLineNumber() +
                                    ":" + vel.getColumnNumber() +
View Full Code Here

               
                u.setSchema(schema);
               
                u.setEventHandler(
                   
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent ve) {
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
                                System.out.println("Line:Col[" + vel.getLineNumber() +
                                    ":" + vel.getColumnNumber() +
View Full Code Here

               
                u.setSchema(schema);
               
                u.setEventHandler(
                   
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent ve) {
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
                                System.out.println("Line:Col[" + vel.getLineNumber() +
                                    ":" + vel.getColumnNumber() +
View Full Code Here

               
                u.setSchema(schema);
               
                u.setEventHandler(
                   
                    new ValidationEventHandler() {
                        public boolean handleEvent(ValidationEvent ve) {
                            if (ve.getSeverity() != ValidationEvent.WARNING) {
                                ValidationEventLocator vel = ve.getLocator();
                                System.out.println("Line:Col[" + vel.getLineNumber() +
                                    ":" + vel.getColumnNumber() +
View Full Code Here

//
    private final UnmarshallerImpl parent;
    private boolean aborted = false;
   
    public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
        ValidationEventHandler eventHandler;
        try {
            eventHandler = parent.getEventHandler();
        } catch( JAXBException e ) {
            // impossible.
            throw new JAXBAssertionError();
        }

        boolean recover = eventHandler.handleEvent(event);
       
        // if the handler says "abort", we will not return the object
        // from the unmarshaller.getResult()
        if(!recover)    aborted = true;
       
View Full Code Here

TOP

Related Classes of javax.xml.bind.ValidationEventHandler

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.