|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > root element no set error in jdom transformator |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|