XQResultSequence result = transformer.executeQuery();
//No support for return Arrays yet
List results = new ArrayList();
while (result.next())
{
XQItem item = result.getItem();
Class type = returnType.getType();
if (Node.class.isAssignableFrom(type) || Node[].class.isAssignableFrom(type))
{
results.add(item.getNode());
}
else if (String.class.isAssignableFrom(type) || String[].class.isAssignableFrom(type))
{
results.add(item.getItemAsString());
}
else if (XMLStreamReader.class.isAssignableFrom(type) || XMLStreamReader[].class.isAssignableFrom(type))
{
try
{
results.add(item.getItemAsStream());
}
catch (XQException e)
{
throw new TransformerException(XmlMessages.streamNotAvailble(getName()));
}
}
else
{
//This can be a JAXB bound object instance depending on whether the CommonHandler has been set
try
{
results.add(item.getObject());
}
catch (XQException e)
{
throw new TransformerException(XmlMessages.objectNotAvailble(getName()));