You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org> on 2009/11/04 15:19:32 UTC

[jira] Closed: (XERCESC-1507) DOMWriter::setNewLine( NULL ) doesn't work

     [ https://issues.apache.org/jira/browse/XERCESC-1507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov closed XERCESC-1507.
------------------------------------

    Resolution: Fixed

Confirmed that Xerces-C++ always uses '\n'. This is actually quite convoluted:

1. The newline sequence set with setNewLine() is only used for pretty-printing. Other newlines (e.g., those in the document set with setTextContent() or extracted during parsing) are not affected.

2. \n is automatically translated to \r\n on Windows when a file is opened in text mode. As a result, if we change default newline to \r\n then it will work as expected (sans point 1 above) for files opened in binary mode and will result in '\r\r\n' sequences for files opened in text mode. This is arguably worse than having just '\n' on Windows.

It seems like the only way to get good results is to use text mode files and let the runtime do the translation. So I have left the current behavior unchanged and added a note to the documentation describing these issues and the recommendation.


> DOMWriter::setNewLine( NULL ) doesn't work
> ------------------------------------------
>
>                 Key: XERCESC-1507
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1507
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM
>    Affects Versions: 2.6.0
>         Environment: Windows XP, compiled with Visual studio .NET 7.1
>            Reporter: Martin Boucher
>             Fix For: 3.1.0
>
>
> Calling DOMWriter::setNewLine( NULL ) on an instance of a DOMWriter doesn't seem to work under Windows. Based on documentation, it is supposed to respect the OS line termination. Expecting "\r\n" under Windows, I've got "\n".
> Trying to hardcode "\r\n" on the same writer works partialy. I've got "\r\n" except on elements with attribute xml:space="preserve". Preserving space it's a thing but I think that respecting the line termination of the OS is more important.
> I search the bug db and found few issues about that. I judge that it was not exactly my problem. Thanks a lot.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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