Formatting exceptions that cannot be output due to the use of xmlreader to read data in LINQ to XML

Source: Internet
Author: User

I can't believe this is true.

The load method of the xdocument class reads a template XML file using the xmlreader class, adds nodes, and saves the files using the Save method. The result shows that the output XML is not well formatted. All elements are stacked on a row without line breaks between nodes at each layer. If you have used all the methods to find out why, you have switched the network to the next day. The result is the same. By default, the SAVE method of xdocument outputs well-formatted text. But why am I not here? Finally, I found out that I used xmlreader as the method for loading the original data of xdocument. Instead of xmlreader, just change it to streamreader. God, how can this happen?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.