You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2005/04/05 23:04:20 UTC

[jira] Assigned: (XALANJ-2075) Transformation using StreamResult and DOMSource with text nodes containing "\r\n" results in " \r\n"

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

Brian Minchau reassigned XALANJ-2075:
-------------------------------------

    Assign To: Brian Minchau

> Transformation using StreamResult and DOMSource with text nodes containing "\r\n" results in "&#13;\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

>
> Transformation using StreamResult and DOMSource with text nodes containing "\r\n" results in "&#13;\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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org