[jdom-interest] Transformation Issue

Mattias Jiderhamn mj-lists at expertsystems.se
Wed Jan 17 23:58:11 PST 2007


Why not try to use some other output than JDOM (like a StreamResult) 
and then compare the output from the two configurations?
Since JDOM complains in one case but not the other, there has to be a 
difference.

At 2007-01-17 23:14, Jason Shapiro wrote:
>I switched versions of WebSphere (to 9.0.2.17) and am now getting a 
>more detailed stack trace (any ideas?)
>
>javax.xml.transform.TransformerException: 
>org.jdom.IllegalAddException: A DocType cannot be added after the root element
>  at 
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2379)
>  at 
> org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2245)
>  at 
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1334)
>  at 
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:738)
>  at 
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251)
>  at 
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1229)
>  at org.jdom.transform.XSLTransformer.transform(XSLTransformer.java:234)
>
>Caused by: org.jdom.IllegalAddException: A DocType cannot be added 
>after the root element
>  at org.jdom.ContentList.documentCanContain(ContentList.java:169)
>  at org.jdom.ContentList.add(ContentList.java:205)
>  at org.jdom.ContentList.add(ContentList.java:140)
>  at java.util.AbstractList.add(AbstractList.java:102)
>  at org.jdom.Document.addContent(Document.java:319)
>  at org.jdom.DefaultJDOMFactory.addContent(DefaultJDOMFactory.java:177)
>  at org.jdom.input.SAXHandler.startDTD(SAXHandler.java:711)
>  at 
> org.jdom.transform.JDOMResult$DocumentBuilder.startDTD(JDOMResult.java:592)
>  at 
> org.apache.xml.serializer.ToHTMLSAXHandler.startElement(ToHTMLSAXHandler.java:524)
>  at 
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:626)
>  at 
> org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:393)
>  at 
> org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:176)
>  at 
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2374) 
>
>
>Jason Shapiro wrote:
>I'm running into a strange issue and am hoping someone here has some 
>advice on how to best troubleshoot the problem.
>
>I have a very simple XSLT operation (producing HTML), using the 
>XSLTransformer class:
>
>XSLTransformer transformer = new XSLTransformer(xsl);
>Document doc2 = transformer.transform(doc);
>
>When I run this in a JDK 1.4 / Tomcat configuration, the Document is 
>returned that looks exactly as I would expect it (an HTML 
>document).  When I use the same code in a JDK 5 / WebSphere 
>configuration, the Document object doesn't contain any elements (so 
>when I try to display with an "toString" or "XMLOutputter", I get 
>the following exception message: 'A DocType cannot be added after 
>the root element').
>
>My guess is that this is ultimately related to some Xalan / 
>Transformer issue, but I'm not sure what the best way is to 
>determine what's being used (vs. what should be used).
>
>Any advice is appreciated.
>
>Regards,
>Jason
>
>
>Access over 1 million songs - 
><http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/>Yahoo! 
>Music Unlimited.
>_______________________________________________
>To control your jdom-interest membership:
>http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20070118/edad618c/attachment.htm


More information about the jdom-interest mailing list