> I am trying to load xml into XDocument using XDocument.Load(filename).
> The cml in the file is not indented but when the xml gets loaded into
> the XDocument, it gets indented. The content I am loading is mixed
> content which causes issues for me. I have looked a lot but have not
> been able to figure out the answer.
>
> *XDocument.Load(filename) is indenting the XML that is being loaded*
Both the Load method and the Save method have options to control
indendation.
You probably want to use
XDocument doc = XDocument.Load(filename, LoadOptions.PreserveWhitespace);
and then
doc.Save(filename, SaveOptions.DisableFormatting);
See http://msdn.microsoft.com/en-us/library/bb387014.aspx and
http://msdn.microsoft.com/en-us/library/bb387103.aspx
--
Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/