Saved .XML file contains &#xD;&#xA; in place of Carriage Returns and line feeds.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

When I open the new Metabase.XML file with notepad, I find that the tabs have been changed to spaces, and in place of my Carriage returns and line feeds, I see &#xD;&#xA; which appear to me to look like hex representations of what the white space characters should be.

So just to make sure it wasn't something I had done in my code that modified the attribute, I copied the original file back over, then I ran the following, which as you can see, simply opens the original file, sets the XMLDocument.PreserveWhiteSpace property to true, and then saves it right back out.

I got the same results. So, I opened up the before and after files with a Hex editor and noticed that both files have a Byte-Order-Mark of EF BB BF, which I understand to be UTF8. So i closed both of the files and this time I tried using an XMLWriter object, along with an XMLWriterSettings object to specify the encoding:

I got the same &#xD;&#xA; for CR/LF again, as well as, now the file is about 11KB larger, and there are a ton of these everywhere: &#x9; which appear to be in place of TAB characters, (except it looks like that there are still a few tabs in the document that have been changed to a plain space).

This is driving me nuts. I have thought about slitting my wrists, but I only have an electric Norelco. What am I doing wrong here? I would very much appreciate any help you can give me on this. (For reference, I created this with using Visual Studio 2010 Pro (WinForm App), .NET 3.5, Windows 7 64-bit)