Mark Chambers
1/7/2008 4:00:00 PM
> XML is whitespace insensitive. You need to use entities when you have
> runs of whitespace that must be preserved. I'm sure everyone is familiar
> with using for a run of spaces. While I'm not
> sure if there are named entities for "\r\n", you should at least be able
> to use " ". Actually, the fact that you care about "\r\n" vs
> "\n" suggests that you want the binary data and not the platform-dependent
> newline characters, so specifying the ASCII codes would be best.
Thanks for the info. Unfortunately my experience with XML is limited. In any
case, the data I'm writing to this file comes from an external source and
though I could manually parse these strings and replace "\r\n" as you
suggested, I assume there must be a cleaner way using some property or
whatever. The fact that I can read the CR/LF combination as-is via the other
overload (taking a single file name) pretty much confirms this. Since my
last post I also discovered the "XmlWriterSettings.NewLineHandling "
property but in light of the latter overload I don't see why I would need
this (if it's even relevant - I'm still investigating). Somewhere there must
be a property that disables this "text mode" conversion but it's not clear
what, at least not to an XML novice like myself. I've been spinning my
wheels for hours now in fact. In any case, thanks again.