[xep-support] FW: DOM element does not have an owner document: cannot determine DOM Level

From: Hamacher, Eric <Eric_Hamacher@gallup.com>
Date: Tue Mar 03 2009 - 08:03:57 PST

Hello:

I am embedding XEP in a Java application which means I am using the APIs directly I my code, sort of like what the Formatter servlet does. I am getting the following exception:

org.xml.sax.SAXException: DOM element does not have an owner document: cannot determine DOM Level
                at com.renderx.sax.DOMWalker.play(Unknown Source)
                at com.renderx.sax.XMLPlayer.parse(Unknown Source)
                at com.renderx.xep.FormatterCore.render(Unknown Source)
                at com.renderx.xep.FormatterImpl.render(Unknown Source)
                at com.renderx.xep.FormatterImpl.render(Unknown Source)
                at com.renderx.xep.FormatterImpl.render(Unknown Source)
                at com.gallup.fogen.PDFGenerator.transform(PDFGenerator.java:35)

at the following:

        FormatterImpl formatter = new FormatterImpl(confProps);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        Properties outputProps = new Properties();
        FOTarget target = new FOTarget(os, "PDF", outputProps);
        formatter.render(new DOMSource(foDocument),target); //exception happens here

The code which produces the org.w3c.dom.Document named foDocument is here:

        Document fo = null;

       DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
       DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
       fo = docBuilder.newDocument();
       DOMResult domr = new DOMResult(fo);

       System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
       TransformerFactory tfactory = TransformerFactory.newInstance();
       Transformer transformer = tfactory.newTransformer(new DOMSource(xslt));
       transformer.transform(new DOMSource(xml),domr);
      return fo;

The DOM document has no owner. . . it is the entire document. Any help would be appreciated!

J. ERIC HAMACHER
Software Application Developer
608.664.3859
8476 Greenway Boulevard
Suite 100
Middleton, WI 53562
USA
GALLUP Technology

Achiever | Learner | Restorative | Intellection | Deliberative

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Tue Mar 3 08:37:54 2009

This archive was generated by hypermail 2.1.8 : Tue Mar 03 2009 - 08:37:59 PST