[ http://issues.apache.org/jira/browse/XALANJ-2075?page=all ]

Brian Minchau updated XALANJ-2075:
----------------------------------

    Fix Version: 2.7

> Transformation using StreamResult and DOMSource with text nodes containing 
> "\r\n" results in "
\r\n"
> --------------------------------------------------------------------------------------------------------
>
>          Key: XALANJ-2075
>          URL: http://issues.apache.org/jira/browse/XALANJ-2075
>      Project: XalanJ2
>         Type: Bug
>   Components: Serialization
>     Versions: 2.6
>  Environment: Windows 2000 SP4, Sun JDK 1.4.2_05, xalan-j 2.6.0, xerces-j 
> 2.6.2
>     Reporter: Tim Chao
>     Assignee: Brian Minchau
>      Fix For: 2.7

>
> Transformation using StreamResult and DOMSource with text nodes containing 
> "\r\n" results in "
\r\n"
> The following code snippet transform the DOM:
>   <textarea>line1\r\nline2\r\nline3</textarea>
> into:
>   <textarea>line1&#13;\r\nline2&#13;\r\nline3</textarea>
> [Transforming into a DOMResult works as expected (no extraneous &#13;'s).]
> Code snippet (using DOMSource and StreamResult):
> public void reproduceBySerialization() {
>     String outputFile = "result";
>     OutputStream ostream = null;
>     try {
>         ostream = new BufferedOutputStream(new FileOutputStream(outputFile));
>         Result result = new StreamResult(ostream);
>         // create dom of:
>         // <textarea>line1\r\nline2\r\nline3</textarea>
>         Document doc = DocumentBuilderFactory
>                         .newInstance()
>                         .newDocumentBuilder()
>                         .newDocument();
>         Node parent = doc.createElement("textarea");
>         doc.appendChild(parent);
>         Node child = doc.createTextNode("line1\r\nline2\r\nline3");
>         parent.appendChild(child);
>         Source input = new DOMSource(doc);
>         Transformer transformer = TransformerFactory
>                                     .newInstance()
>                                     .newTransformer();
>         transformer.transform(input, result);
>     } catch (Exception e) {
>         e.printStackTrace();
>     } finally {
>         if (ostream != null) {
>             try {
>                 ostream.flush();
>                 ostream.close();
>             } catch (IOException e) {
>                 e.printStackTrace();
>             }
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to