Java Mailing List Archive

http://www.junlu.com/

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

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

Roland Hartinger

2004-02-12


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@gmx.de
©2008 junlu.com - Jax Systems, LLC, U.S.A.