Example usage for javax.xml.bind Binder unmarshal

List of usage examples for javax.xml.bind Binder unmarshal

Introduction

In this page you can find the example usage for javax.xml.bind Binder unmarshal.

Prototype

public abstract Object unmarshal(XmlNode xmlNode) throws JAXBException;

Source Link

Document

Unmarshal XML infoset view to a JAXB object tree.

Usage

From source file:org.apache.camel.blueprint.handler.CamelNamespaceHandler.java

protected Object parseUsingJaxb(Element element, ParserContext parserContext, Binder<Node> binder) {
    try {//from  w w w  .j  a va2  s.  c o  m
        return binder.unmarshal(element);
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to parse JAXB element: " + e, e);
    }
}

From source file:org.apache.camel.spring.handler.CamelNamespaceHandler.java

protected Object parseUsingJaxb(Element element, ParserContext parserContext, Binder<Node> binder) {
    try {// w  w w . ja v a2 s  . co  m
        return binder.unmarshal(element);
    } catch (JAXBException e) {
        throw new BeanDefinitionStoreException("Failed to parse JAXB element", e);
    }
}

From source file:org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware.java

private void unwrapUsually(Binder<Node> binder, Node doc) throws JAXBException {

    jaxbElement = (E) XmlUtils.unwrap(binder.unmarshal(doc));
    // Unwrap, so we have eg CTEndnotes, not JAXBElement

    // .. but we do need to leave it wrapped, 
    // if there is not @XmlRootElement annotation 
    if (jaxbElement instanceof org.docx4j.dml.chartDrawing.CTDrawing) {
        // Check it
        Object tmp = binder.unmarshal(doc);
        if (tmp instanceof javax.xml.bind.JAXBElement) {
            QName qname = ((javax.xml.bind.JAXBElement) tmp).getName();
            if (qname.equals(org.docx4j.dml.chart.ObjectFactory._UserShapes_QNAME)) {
                jaxbElement = (E) tmp;//from ww w.j a  v  a  2 s.  co  m
            }
        }
    }

}