Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Merging JDOM documents

Rosén Håkan

2003-10-07

Replies:

Hi,
I'm trying to merge two documents and then transform them into a result.

some code:
public Document setReports(Document inReport, Document rules)
            throws Exception {
// insert incoming rules into inReport
inReport.getRootElement().getChild("employee").addContent
               (rules.getRootElement().detach());
Transformer transformer = TransformerFactory.newInstance().
      newTransformer(new StreamSource("prepare.xsl"));
JDOMSource source = new JDOMSource(inReport);
JDOMResult result = new JDOMResult();
transformer.transform(source, result);
return result.getDocument();
}

The Document 'rules' is stored in my a servletContext and only read once,
The code works fine the first time, but the second time I get an error that
the root element is not set.
please help
regards
/Håkan
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.