Search in sources :

Example 1 with DOMLocator

use of com.sun.xml.bind.validator.DOMLocator 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 DOMLocator

use of com.sun.xml.bind.validator.DOMLocator 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 DOMLocator

use of com.sun.xml.bind.validator.DOMLocator 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 4 with DOMLocator

use of com.sun.xml.bind.validator.DOMLocator 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)4 DOMLocator (com.sun.xml.bind.validator.DOMLocator)4 UnmarshallerHandler (javax.xml.bind.UnmarshallerHandler)4 Document (org.w3c.dom.Document)4 Element (org.w3c.dom.Element)4 SAXException (org.xml.sax.SAXException)4