}
else if (_sourceSystemId != null) {
input = new InputSource(_sourceSystemId);
}
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR);
throw new TransformerException(err.toString());
}
// Start pushing SAX events
reader.parse(input);
} finally {
_readerManager.releaseXMLReader(reader);
}
} else if (source instanceof SAXSource) {
final SAXSource sax = (SAXSource) source;
XMLReader reader = sax.getXMLReader();
final InputSource input = sax.getInputSource();
boolean userReader = true;
try {
// Create a reader if not set by user
if (reader == null) {
reader = _readerManager.getXMLReader();
userReader = false;
}
// Hook up reader and output handler
try {
reader.setProperty(LEXICAL_HANDLER_PROPERTY, handler);
reader.setFeature(NAMESPACE_PREFIXES_FEATURE, true);
} catch (SAXException e) {
// Falls through
}
reader.setContentHandler(handler);
// Start pushing SAX events
reader.parse(input);
} finally {
if (!userReader) {
_readerManager.releaseXMLReader(reader);
}
}
} else if (source instanceof StAXSource) {
final StAXSource staxSource = (StAXSource)source;
StAXEvent2SAX staxevent2sax;
StAXStream2SAX staxStream2SAX;
if (staxSource.getXMLEventReader() != null) {
final XMLEventReader xmlEventReader = staxSource.getXMLEventReader();
staxevent2sax = new StAXEvent2SAX(xmlEventReader);
staxevent2sax.setContentHandler(handler);
staxevent2sax.parse();
handler.flushPending();
} else if (staxSource.getXMLStreamReader() != null) {
final XMLStreamReader xmlStreamReader = staxSource.getXMLStreamReader();
staxStream2SAX = new StAXStream2SAX(xmlStreamReader);
staxStream2SAX.setContentHandler(handler);
staxStream2SAX.parse();
handler.flushPending();
}
} else if (source instanceof DOMSource) {
final DOMSource domsrc = (DOMSource) source;
new DOM2TO(domsrc.getNode(), handler).parse();
} else if (source instanceof XSLTCSource) {
final DOM dom = ((XSLTCSource) source).getDOM(null, _translet);
((SAXImpl)dom).copy(handler);
} else {
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR);
throw new TransformerException(err.toString());
}
}