Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: How to read \r\n in MSXML? [Thread Next] Re: How to read \r\n in MSXML?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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
