Search in sources :

Example 1 with DOMScanner

use of com.sun.xml.bind.unmarshaller.DOMScanner in project OpenAM by OpenRock.

the class UnmarshallerImpl method unmarshal.

public final Object unmarshal(Node node) throws JAXBException {
    try {
        DOMScanner scanner = new DOMScanner();
        UnmarshallerHandler handler = new InterningUnmarshallerHandler(createUnmarshallerHandler(new DOMLocator(scanner)));
        if (node instanceof Element)
            scanner.parse((Element) node, handler);
        else if (node instanceof Document)
            scanner.parse(((Document) node).getDocumentElement(), handler);
        else
            // no other type of input is supported
            throw new IllegalArgumentException();
        return handler.getResult();
    } catch (SAXException e) {
        throw createUnmarshalException(e);
    }
}
Also used : DOMScanner(com.sun.xml.bind.unmarshaller.DOMScanner) Element(org.w3c.dom.Element) UnmarshallerHandler(javax.xml.bind.UnmarshallerHandler) DOMLocator(com.sun.xml.bind.validator.DOMLocator) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Example 2 with DOMScanner

use of com.sun.xml.bind.unmarshaller.DOMScanner in project OpenAM by OpenRock.

the class UnmarshallerImpl method unmarshal.

public final Object unmarshal(Node node) throws JAXBException {
    try {
        DOMScanner scanner = new DOMScanner();
        UnmarshallerHandler handler = new InterningUnmarshallerHandler(createUnmarshallerHandler(new DOMLocator(scanner)));
        if (node instanceof Element)
            scanner.parse((Element) node, handler);
        else if (node instanceof Document)
            scanner.parse(((Document) node).getDocumentElement(), handler);
        else
            // no other type of input is supported
            throw new IllegalArgumentException();
        return handler.getResult();
    } catch (SAXException e) {
        throw createUnmarshalException(e);
    }
}
Also used : DOMScanner(com.sun.xml.bind.unmarshaller.DOMScanner) Element(org.w3c.dom.Element) UnmarshallerHandler(javax.xml.bind.UnmarshallerHandler) DOMLocator(com.sun.xml.bind.validator.DOMLocator) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Example 3 with DOMScanner

use of com.sun.xml.bind.unmarshaller.DOMScanner in project Payara by payara.

the class UnmarshallerImpl method unmarshal.

public final Object unmarshal(Node node) throws JAXBException {
    try {
        DOMScanner scanner = new DOMScanner();
        UnmarshallerHandler handler = new InterningUnmarshallerHandler(createUnmarshallerHandler(new DOMLocator(scanner)));
        if (node instanceof Element)
            scanner.parse((Element) node, handler);
        else if (node instanceof Document)
            scanner.parse(((Document) node).getDocumentElement(), handler);
        else
            // no other type of input is supported
            throw new IllegalArgumentException();
        return handler.getResult();
    } catch (SAXException e) {
        throw createUnmarshalException(e);
    }
}
Also used : DOMScanner(com.sun.xml.bind.unmarshaller.DOMScanner) Element(org.w3c.dom.Element) UnmarshallerHandler(javax.xml.bind.UnmarshallerHandler) DOMLocator(com.sun.xml.bind.validator.DOMLocator) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Example 4 with DOMScanner

use of com.sun.xml.bind.unmarshaller.DOMScanner in project OpenAM by OpenRock.

the class UnmarshallerImpl method unmarshal.

public final Object unmarshal(Node node) throws JAXBException {
    try {
        DOMScanner scanner = new DOMScanner();
        UnmarshallerHandler handler = new InterningUnmarshallerHandler(createUnmarshallerHandler(new DOMLocator(scanner)));
        if (node instanceof Element)
            scanner.parse((Element) node, handler);
        else if (node instanceof Document)
            scanner.parse(((Document) node).getDocumentElement(), handler);
        else
            // no other type of input is supported
            throw new IllegalArgumentException();
        return handler.getResult();
    } catch (SAXException e) {
        throw createUnmarshalException(e);
    }
}
Also used : DOMScanner(com.sun.xml.bind.unmarshaller.DOMScanner) Element(org.w3c.dom.Element) UnmarshallerHandler(javax.xml.bind.UnmarshallerHandler) DOMLocator(com.sun.xml.bind.validator.DOMLocator) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Example 5 with DOMScanner

use of com.sun.xml.bind.unmarshaller.DOMScanner in project OpenAM by OpenRock.

the class UnmarshallerImpl method unmarshal.

public final Object unmarshal(Node node) throws JAXBException {
    try {
        DOMScanner scanner = new DOMScanner();
        UnmarshallerHandler handler = new InterningUnmarshallerHandler(createUnmarshallerHandler(new DOMLocator(scanner)));
        if (node instanceof Element)
            scanner.parse((Element) node, handler);
        else if (node instanceof Document)
            scanner.parse(((Document) node).getDocumentElement(), handler);
        else
            // no other type of input is supported
            throw new IllegalArgumentException();
        return handler.getResult();
    } catch (SAXException e) {
        throw createUnmarshalException(e);
    }
}
Also used : DOMScanner(com.sun.xml.bind.unmarshaller.DOMScanner) Element(org.w3c.dom.Element) UnmarshallerHandler(javax.xml.bind.UnmarshallerHandler) DOMLocator(com.sun.xml.bind.validator.DOMLocator) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException)

Aggregations

DOMScanner (com.sun.xml.bind.unmarshaller.DOMScanner)5 DOMLocator (com.sun.xml.bind.validator.DOMLocator)5 UnmarshallerHandler (javax.xml.bind.UnmarshallerHandler)5 Document (org.w3c.dom.Document)5 Element (org.w3c.dom.Element)5 SAXException (org.xml.sax.SAXException)5