Java XML JAXB Unmarshaller getUnmarshaller()

Here you can find the source of getUnmarshaller()

Description

get Unmarshaller

License

Open Source License

Declaration

public static Unmarshaller getUnmarshaller() throws JAXBException 

Method Source Code


//package com.java2s;
/*/*from   w  ww . ja  v a 2s .com*/
 * ====================================================================
 *
 * This code is subject to the freebxml License, Version 1.1
 *
 * Copyright (c) 2001 - 2003 freebxml.org.  All rights reserved.
 *
 * $Header: /cvs/hyperjaxb3/samples/po-ws/src/main/java/org/jvnet/hyperjaxb3/samples/pows/common/BindingUtility.java,v 1.1 2007/05/31 01:23:31 najmi Exp $
 * ====================================================================
 */

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;

public class Main {
    public static JAXBContext jaxbContext;

    public static Unmarshaller getUnmarshaller() throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

        //unmarshaller.setValidating(true);
        unmarshaller.setEventHandler(new ValidationEventHandler() {
            public boolean handleEvent(ValidationEvent event) {
                boolean keepOn = false;

                return keepOn;
            }
        });

        return unmarshaller;
    }
}

Related

  1. createUnmarshaller(Class clazz)
  2. createUnmarshaller(Class clazz)
  3. createUnmarshaller(Class clazz)
  4. createUnmarshaller(Object object)
  5. getUnmarshaller()
  6. getUnmarshaller()
  7. getUnmarshaller(Class jaxbClass)
  8. marshallUnmarshall(T inObj)
  9. unmarshal(Class beanClass, InputStream is)