[jdom-interest] Help: Root element not set exception

Roland Hartinger roland.hartinger at gmx.de
Thu Feb 12 12:43:07 PST 2004


Hi,

I'm using jdom-b9 and the latest -b10 and get the following exception:

java.lang.IllegalStateException: Root element not set
        at org.jdom.Document.getRootElement(Document.java:216)

The exception doesn't occur if I'm using jdom-b8. All works fine when generating HTML from the XML tree.

The following Java code in the System.err.out statement seems to cause the exception:

JFrame frame = new JFrame(); 
    StringBuffer sbuf = new StringBuffer(1000);
    try {
        Transformer transformer = TransformerFactory.newInstance()
          .newTransformer(new StreamSource(new File(html_stylesheetfile)));
                
        JDOMResult out = new JDOMResult();
        // Transform XML LogBook into HTML using XSLT stylesheet
        transformer.transform(new JDOMSource(doc), out);
        
        if (debug == true) {
            // exception at out.getDocument() -> "no root element set" when using jdom-b9 and -10 !!
            System.err.println("showHTML: out.getRootElement() == " + out.getDocument().getRootElement().getName());
        }

Any idea whats going wrong here ? Didn't find any hint in the archives.
But beside this problem, I like to use jdom very much - its a fine work done!

Regards,
Roland Hartinger
Email: roland.hartinger at gmx.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040212/f84e14d7/attachment.htm


More information about the jdom-interest mailing list