}
else if (src instanceof String)
{
if (useStaxSource)
{
return new StaxSource(xmlInputFactory.createXMLStreamReader(new StringReader((String) src)));
}
else
{
return new StreamSource(new StringReader((String) src));
}
}
else if (src instanceof org.dom4j.Document)
{
return new DocumentSource((org.dom4j.Document) src);
}
else if (src instanceof org.xml.sax.InputSource)
{
return new SAXSource((InputSource) src);
}
// TODO MULE-3555
else if (src instanceof XMLStreamReader)
{
XMLStreamReader xsr = (XMLStreamReader) src;
// StaxSource requires that we advance to a start element/document event
if (!xsr.isStartElement() &&
xsr.getEventType() != XMLStreamConstants.START_DOCUMENT)
{
xsr.nextTag();
}
return new StaxSource((XMLStreamReader) src);
}
else if (src instanceof org.w3c.dom.Document || src instanceof org.w3c.dom.Element)
{
return new DOMSource((org.w3c.dom.Node) src);
}