StaxSource ss = (StaxSource)source;
if (ss.getXMLStreamReader() == null) {
return;
}
} else if (source instanceof StAXSource) {
StAXSource ss = (StAXSource)source;
if (ss.getXMLStreamReader() == null) {
return;
}
} else if (source instanceof SAXSource) {
SAXSource ss = (SAXSource)source;
InputSource src = ss.getInputSource();
if (src == null || (src.getSystemId() == null && src.getPublicId() == null)) {
if (ss.getXMLReader() != null) {
//OK - reader is OK. We'll use that out
StreamWriterContentHandler ch = new StreamWriterContentHandler(writer);
XMLReader reader = ((SAXSource)source).getXMLReader();
reader.setContentHandler(ch);
try {
try {
reader.setFeature("http://xml.org/sax/features/namespaces", true);
} catch (Throwable t) {
//ignore
}
try {
reader.setProperty("http://xml.org/sax/properties/lexical-handler", ch);
} catch (Throwable t) {
//ignore
}
reader.parse(((SAXSource)source).getInputSource());
return;
} catch (Exception e) {
throw new XMLStreamException(e.getMessage(), e);
}
} else if (ss.getInputSource() == null) {
//nothing to copy, just return
return;
}
}
} else if (source instanceof StreamSource) {
StreamSource ss = (StreamSource)source;
if (ss.getInputStream() == null
&& ss.getReader() == null
&& ss.getSystemId() == null) {
//nothing to copy, just return
return;
}
}
XMLStreamReader reader = createXMLStreamReader(source);