[jdom-interest] Question regarding XML transformation!
hamid at us.ibm.com
Tue May 18 11:24:07 PDT 2004
Actually, in this case I build the document programmatically using JDOM
and I know the Document object is built correctly since I can recreate the
XML string back from it. Unfortunately, JDOM's XSLTransformer class
doesn't like something about this same Document object that I build using
the JDOM classes and methods. So, is there something extra that I need to
do than the code below?
XSLTransformer transformer = new XSLTransformer(xslFileName);
Document targetDoc = transformer.transform(sourceDoc);
IBM Software Group -- Digital Media Development
301-803-1247 T/L 262-1247
Jason Hunter <jhunter at xquery.com>
Sent by: jdom-interest-admin at jdom.org
05/18/2004 01:44 PM
To: Salim Hamid/Gaithersburg/IBM at IBMUS
cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Question regarding XML
Sounds like the result of your transform was not a document but just one
or more nodes. There are other methods on XSLTransformer to handle this
situation. And you can transform strings instead of files by just
building from a string. It's shown in the FAQ.
Salim Hamid wrote:
> We've recently acquired Beta 10 release of JDOM and are interested in
> the new transformation classes. Do they support transforming an XML doc
> using an XSL file that I provide? I have the following code but I get
> the exception "*java.lang.IllegalStateException: Root element not set* "
> when I attempt to do anything with the transformed document:
> XSLTransformer transformer = new XSLTransformer(xslFileName);
> Document targetDoc = transformer.transform(sourceDoc);
> System.out.println(targetDoc); *// This line throws the
> exception indicating that the transformation did not occur correctly*
> The XML doc is transformed fine using the XMLTransformer class provided
> by IBM WebSphere. Unfortunately, the WebSphere class only deals with
> files-- something that we don't want due to I/O processing. We want to
> transform XML strings instead of files. Am I not understanding
> something about the JDOM transformation classes or are there future
> plans to support what we want?
> A reply to this note would be greatly appreciated.
> Salim Hamid
> IBM Software Group -- Digital Media Development
> 301-803-1247 T/L 262-1247
To control your jdom-interest membership:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jdom-interest