try {
resetMethod.invoke(xsw);
setOutputMethod.invoke(xsw,new StreamResult(out),encoding);
return xsw;
} catch (IllegalAccessException e) {
throw new XMLReaderException("stax.cantCreate",e);
} catch (InvocationTargetException e) {
throw new XMLReaderException("stax.cantCreate",e);
}
}
// create a new instance
try {
return xof.createXMLStreamWriter(out,encoding);
} catch (XMLStreamException e) {
throw new XMLReaderException("stax.cantCreate",e);
}
}