Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to read \r\n in MSXML?

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 3/10/2008 10:10:00 AM


"Adam Badura" <adam@h...> wrote in message
news:A320E13A-1D3E-431C-826E-D9ADE0858C40@m......
> > Its a little strange to have an XML file where some text nodes would
> > contain
> > \n and others might contain \r\n.    However if changing all \n to \r\n
> > would break things then you'll need to replace them in after retrieving
> > text
> > that should have \r\n instead of \n.
>
>     Actually in current code I could change \n to \r\n after reading the
XML
> file. And it is likely that this will not cause any problems ever. However
> its kind of personal thing here. I just don't like to write such code as I
> feel obliged to make it correct in case of future possibilities (even
those
> unlikely). So I would have to trace somehow \n and \r\n before reading the
> XML file. This could cause the need to modify the XML file data somehow.
>     Anyway I will suggest the solution to change \n to \r\n (all) only
> before displaying the data in Windows controls since only they require
\r\n
> and for internal handling it is even simpler to have \n instead. The
> decision is however not up to me. All I wanted to know was whether there
is
> such possibility (of reading \r\n) in MSXML and it seems there is no
(which
> I suspected) due to XML rules.
>     Thanks for help.

Window controls and XML don't mix well because of this issue.  Things arre
further muddled by the fact that you can place an \r\n in a text node in an
MSXML and read it out again.  However as soon as the document is streamed
somewhere and parsed in again the \r\n will be reduced to \n.

The only proper solution to this is intercede between a Window Control and
Text derived from XML and defensively convert lone \n to \r\n bearing in
mind that it may also be possilbe for \r\n to exist in the string.


-- 
Anthony Jones - MVP ASP/ASP.NET




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent