Mo, Jennifer wrote:
Does anyone know how to modify the FOPServlet so that it takes in a XML
string instead of a XML file? The XSLTInputHandler class (which inherits
from InputHandler) seems to only take in a file but not a String. i'm stuck.
Any ideas or suggestion?
Use something like this:
Driver driver =new Driver();
driver.setOutputStream(response.getOutputStream());
driver.setRenderer(Driver.RENDER_PDF);
Transformer transformer=TransformerFactory.newInstance()
.newTransformer(new StreamSource(
new StringReader(theString)));
transformer.transform(xmlsource,
new SAXResult(driver.getContentHandler()));
Are you building the string in memory by yourself? In this case,
you should look into writing a SAX Source.
J.Pietschmann