SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old May 20th, 2003, 05:05 PM
shacham shacham is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: STL
Posts: 13 shacham User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
root element no set error in jdom transformator

I'm getting the error:

[Fatal Error] :-1:-1: Premature end of file.
Exception in thread "main" java.lang.IllegalStateException: Root element not set
at org.jdom.Document.getContent(Document.java:307)
at org.jdom.output.XMLOutputter.output(XMLOutputter.java:679)

when trying to transform a jdom doc, based on XML file (A) with xslt (B), and output the transfomed file as html (C).

This is the code of the transformer:

package...
imports...
StreamSource xsltstreamsource = new StreamSource("./" + packagePath + "B.xslt");
Transformer transformer = TransformerFactory.newInstance().newTransformer(xsltstreamsource);
JDOMResult out = new JDOMResult();
transformer.transform(new JDOMSource(jdoc), out);
XMLOutputter xmloutputter = new XMLOutputter(" ",true);
xmloutputter.setTextNormalize(true);
xmloutputter.output(out.getDocument(), new FileWriter("./" + packagePath + "C.html"));

Now, jdoc is the jdom doc that was created from:
File xmlfile = new File("./" + packagePath + "A.xml");
SAXBuilder builder = new SAXBuilder();
jdoc = builder.build(xmlfile);

What am i doing wrong? i'm sure that the xml and the xslt are valid, and i did not get errors when the jdoc was built.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > root element no set error in jdom transformator


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway