http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2626

*** shadow/2626 Fri Jul 13 16:24:35 2001
--- shadow/2626.tmp.8989        Fri Jul 13 16:24:35 2001
***************
*** 0 ****
--- 1,58 ----
+ +============================================================================+
+ | Embedded Transformation fails when input is the actual XML string!         |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2626                        Product: XalanJ2                 |
+ |       Status: NEW                         Version: 2.1.0                   |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Major                    OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: org.apache.xalan.transf |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                                     |
+ |  Reported By: [EMAIL PROTECTED]                                          |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ This is a case of transformation where the stylesheet is embedded!!! 
+ 
+ When the input XML is actually an ascii string xml (that is, the input is not 
+ URI string that points to an xml-file), the transformation fails with an error 
+ message "not well-formed". The "UseStylesheetPI" is sample is used. Following 
+ is an excerpt of the failing program:
+ 
+        {
+         String media= null , title = null, charset = null;
+         try
+         {     
+       TransformerFactory tFactory = TransformerFactory.newInstance();
+ 
+         // following xmlInputString is a string variable that contains
+         //     the actual XML string that has embedded "xml-stylesheet" tag
+         //   
+         byte [] xmlByteStream = xmlInputString.getBytes();
+         InputStream isXML = new ByteArrayInputStream(xmlByteStream);
+ 
+       Source stylesheet = tFactory.getAssociatedStylesheet
+         (new StreamSource(isXML),media, title, charset);
+       
+       Transformer transformer = tFactory.newTransformer(stylesheet);
+         
+                  transformer.transform(new StreamSource(isXML), 
+                              new StreamResult(new java.io.FileOutputStream
+ ("foo.out")));
+        
+       System.out.println("************* The result is in foo.out 
+ *************");
+        
+         }
+         catch (Exception e)
+         {
+           e.printStackTrace();
+         }
+   } 
+ 
+ 
+      THE ABOVE PROGRAM FAILS WITH THE MESSAGE LIKE, "DOCUMENT MUST BE WELL-
+ FORMED..." 
+      Thanks in advance...

Reply via email to