posted 23 years ago
Hello
I developed some classes or accesing xml Documents with JDom.
I like JDOM a lot cause of its little and uncomplicated Api.
I manipulate my xml-document - but then i want it to be used by xalan -
But Xalan only accepts org.w3c.dom.Documents but i have a org.jdom.Document - ok i thought i can use the XMLOutputter of JDOM to do the job.
But i always get a JDom Exception
org.jdom.JDOMException: Exception outputting Document: null
at org.jdom.output.DOMOutputter.output(DOMOutputter.java:168)
at com.discon.servlets.EditServlet.doPost(EditServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:
04)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
hmm i dont have any special processing instruction or namespaces in my xml document.
hers the source code that causes the error
File file = new File(xmlPath);
SAXBuilder builder = new SAXBuilder();
org.jdom.Document jdoc = builder.build(file);
DOMOutputter out = new DOMOutputter();
org.w3c.dom.Document w3cdoc = out.output(jdoc);
this should work :-(
and heres the xml File
<?xml version="1.0" encoding="ISO-8859-1"?>
<NewsDocument>
<NewsContent>
<NewsContentHeader>
<Caption>1.News erstellt</Caption>
<Date>06.07.2001</Date>
<Author>Holger Prause</Author>
<Id></Id>
</NewsContentHeader>
<NewsText>
Heute wurde eine neue News erstellt
</NewsText>
</NewsContent>
<NewsContent>
</NewsDocument>
I know i am using a Beta Version but maybe i am doing something wrong...
Ok thx a lot,
Holger