http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2758 *** shadow/2758 Mon Jul 23 23:35:45 2001 --- shadow/2758.tmp.14729 Mon Jul 23 23:35:45 2001 *************** *** 0 **** --- 1,59 ---- + +============================================================================+ + | Call to transform() resets output properties | + +----------------------------------------------------------------------------+ + | Bug #: 2758 Product: XalanJ2 | + | Status: NEW Version: CurrentCVS | + | Resolution: Platform: All | + | Severity: Normal OS/Version: Other | + | Priority: Other Component: javax.xml | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + If I use the following code snippet, which reads the xml + document "a.xml" and "transformes" it to two new documents + "a-1.xml" and "a-2.xml", the second call to the transform() + method does not use the previously set output properties. It seems + that they are reset after each call to transform(). + + Is this a feature or a bug? + + PS: Setting the output properties before each transform() + works of course. + + >>>>> CODE SNIPPET <<<<<<<<<<<<< + import java.util.Properties; + import javax.xml.transform.Transformer; + import javax.xml.transform.TransformerFactory; + import javax.xml.transform.stream.StreamSource; + import javax.xml.transform.stream.StreamResult; + import javax.xml.transform.OutputKeys; + + + public class Test + { + public static void main(String[] args) + throws Exception + { + Transformer + transformer=TransformerFactory.newInstance().newTransformer(); + Properties format=new Properties(); + format.put(OutputKeys.METHOD, "xml"); + format.put(OutputKeys.ENCODING, "ISO-8859-1"); + format.put(OutputKeys.OMIT_XML_DECLARATION, "no"); + format.put(OutputKeys.INDENT, "yes"); + transformer.setOutputProperties(format); + + transformer.transform( + new StreamSource("a.xml"), + new StreamResult("a-1.xml")); + transformer.transform( + new StreamSource("a.xml"), + new StreamResult("a-2.xml")); + } + } + >>>>> END CODE SNIPPET <<<<<<<<<<<<<
