I managed to figure out how to get it to work. I have to explicity call startDocument() and endDocument() on the underlying ContentHandler to make the null pointer go away.
PrintWriter out = response.getWriter(); StreamResult result = new StreamResult(out); SAXWriter sax = new SAXWriter(); Source xsltSourceOne = new StreamSource(new File(xslFile)); TransformerHandler tHandler1 = factory.newTransformerHandler(xsltSourceOne); sax.setContentHandler(tHandler1); tHandler1.setResult(result); Element root = DocumentHelper.createElement("Root"); tHandler1.startDocument(); sax.writeOpen(root); //--- NullPointer thrown here tHandler1.endDocument(); I'm wondering why startDocument() and endDocument() have protected access in SAXWriter? SAXWriter throws an invalid sequence of events if you are using only the SAXWriter API. Since it blocks you from using those, I would think it would automatically start and end the document when the first element is written and then closed. Dave ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_ids93&alloc_id281&op=click _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user