FW: [jdom-interest] Question regarding XML transformation!

Salim Hamid hamid at us.ibm.com
Thu May 20 10:07:13 PDT 2004


Hello.  Just FYI.... The reason the transformation was not working is 
because my XML contained the tag <xsl:text>.  Apparently, it is not yet 
supported by Java 1.4.2 transformation.  I would have at least expected an 
exception.  If it is intended to be supported, then I assume it is a bug. 
Thanks to everyone who responded.

Regards,

Salim Hamid
IBM Software Group --  Digital Media Development
301-803-1247   T/L 262-1247





Phill_Perryman at Mitel.COM
Sent by: jdom-interest-admin at jdom.org
05/19/2004 05:18 AM
 
        To:     jdom-interest at jdom.org
        cc: 
        Subject:        Re: FW: [jdom-interest] Question regarding XML 
transformation!



I use the following which produces an xml output file from a JDOM document 
(called quote here). 

The xsl contains the following 

<xsl:output method="xml" encoding="UTF-8" standalone="yes" indent="yes" /> 


        /** 
         * Produces an export of selected data from the quote (JDOM 
Document) 
         * into an xml file. 
         */ 
        public void menuFileExport() { 
                enableWaitCursor(); 
 
                Transformer transformer; 
                FileOutputStream fos = null; 

                try { 
                        transformer = 
 TransformerFactory.newInstance().newTransformer( 
                                        new 
javax.xml.transform.stream.StreamSource( 
                                                Global.getRootDir() + 
"export.xsl")); 
                        fos = new FileOutputStream(Global.getReportsDir() 
+ "export.xml"); 
                        StreamResult out = new StreamResult(fos); 
                        transformer.transform(new JDOMSource(quote), out); 

                        fos.flush(); 
                        fos.close(); 
                } catch (Exception e) { 
                        Global.showErrorMessage( 
                                Utility.get(
"DialogUnableToCreateReportMessage")); 
                } finally { 
                        disableWaitCursor(); 
                } 
 
                fos = null; 
                transformer = null; 
        }

/Phill
IS Dept, Software Engineer.
phill_perryman at mitel.com
http://www.mitel.com
Tel: +44 1291 436023 



Salim Hamid <hamid at us.ibm.com> 
Sent by: jdom-interest-admin at jdom.org 
18/05/2004 19:27 
        
        To:        jdom-interest at jdom.org, jdom-interest-admin at jdom.org 
        cc:         
        Subject:        Re: FW: [jdom-interest] Question regarding XML 
transformation!




Our XSL does not contain "<xsl:output method="text"/>" but it does contain 
the following: 

     <xsl:output method="xml" encoding="UTF-8" indent="yes"/> 




"Robert Taylor" <rtaylor at mulework.com> 
Sent by: jdom-interest-admin at jdom.org 
05/18/2004 01:54 PM 
        
       To:        <jdom-interest at jdom.org> 
       cc:         
       Subject:        FW: [jdom-interest] Question regarding XML 
transformation!




I sent this directly to the recipient (by accident)  instead of the list. 
 
robert 
-----Original Message-----
From: Robert Taylor [mailto:rtaylor at mulework.com]
Sent: Tuesday, May 18, 2004 1:27 PM
To: Salim Hamid
Subject: RE: [jdom-interest] Question regarding XML transformation!

This may or may not help, but I get the same exception when I have the 
following line in my XSL: 
 
<xsl:output method="text"/> 
 
If I remove that line, then the exception is no longer thrown. 
 
hth, 
 
robert 
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On 
Behalf Of Salim Hamid
Sent: Tuesday, May 18, 2004 1:17 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Question regarding XML transformation!


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. 

Regards,

Salim Hamid
IBM Software Group --  Digital Media Development
301-803-1247   T/L 262-1247 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040520/8031eeb7/attachment.htm


More information about the jdom-interest mailing list