Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - How to load xml into an XDocument without indentation [Thread Next] Re: How to load xml into an XDocument without indentationTo: NULL Date: 11/7/2009 12:11:00 PM Rahul Aggarwal wrote: > 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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
