[jdom-interest] Transformation Issue
Jason Shapiro
fetik3 at yahoo.com
Wed Jan 17 14:14:55 PST 2007
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 - Yahoo! Music Unlimited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20070117/18f4fe4f/attachment.htm
More information about the jdom-interest
mailing list