public XMLStreamReader toXMLStreamReader()

in src/main/java/org/apache/servicemix/jbi/jaxp/SourceTransformer.java [513:532]


    public XMLStreamReader toXMLStreamReader(Source source) throws XMLStreamException, TransformerException {
        if (source instanceof StaxSource) {
            return ((StaxSource) source).getXMLStreamReader();
        }
        // It seems that woodstox 2.9.3 throws some NPE in the servicemix-soap
        // when using DOM, so use our own dom / stax parser
        if (source instanceof DOMSource) {
            Node n = ((DOMSource) source).getNode();
            Element el = n instanceof Document ? ((Document) n).getDocumentElement() : n instanceof Element ? (Element) n : null;
            if (el != null) {
                return new W3CDOMStreamReader(el);
            }
        }
        XMLInputFactory factory = getInputFactory();
        try {
            return factory.createXMLStreamReader(source);
        } catch (XMLStreamException e) {
            return factory.createXMLStreamReader(toReaderFromSource(source));
        }
    }