|
I'm having problems getting an xml Document as
the result of a transformation. I get a sax exception - Can't have more
than one root on a DOM!
If I use any other result type, Xalan works
fine and I get the output I expect. I double-checked both input files and
the output, and everything is well formed. I think it has to do with how
I'm building the xml source.
I have business logic that returns an
xml Document, and then I use Xalan and a xsl page to transform it. I
want to keep it as a Document so that I can pass it on to FOP. When the
business logic builds the dom, I use the DOM Level III command adoptNode
implemented by Xerces 1.4.2. Is it possible that this method returns the
dom in a slightly different format than xalan expects? When I use this
method and use a StreamResult everything works fine, but a DOMResult throws an
exception.
Does anyone know more about how the DOMResult is
built and why this exception would occur? Or could you suggest a
work-around -- Is there a better way to combine two Document objects than use
adoptNode?
Thanks,
Dave Frankson
org.xml.sax.SAXException: Can't have more than one root on
a DOM!
at org.apache.xml.utils.DOMBuilder.append(DOMBuilder.java:203) at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:308) at org.apache.xalan.transformer.ResultTreeHandler.flushElem(ResultTreeHandler.java:843) at org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandler.java:914) at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:298) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:668) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:423) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:226) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2096) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:1927) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1120) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:590) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1037) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1015) |
- RE: Exception using DOMResult Shustef, Eugene
- Re: Exception using DOMResult Gary L Peskin
- Re: Exception using DOMResult Joseph_Kesselman
- Re: Exception using DOMResult David Frankson
- Re: Exception using DOMResult Gary L Peskin
- Re: Exception using DOMResult Joseph_Kesselman
- Re: Exception using DOMResult Gary L Peskin
- Re: Exception using DOMResult Joseph_Kesselman
- Re: Exception using DOMResult Gary L Peskin
- Re: Exception using DOMResult Gary L Peskin
