I am writing a program for someone that takes a word document and turns it into an xml document. The program works completely, except that when I write all of the information to an xml document only half of the document actually gets written. Then I get the following error:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Element was not closed. Error processing resource
The funny thing is that if I make the program write the xml file to the visual basic console and then I copy and paste the result into an xml document it works fine! The .writeto method is what is causing the file to go bad, but I can't figure out why. If anyone has had experience with this sort of problem I would greatly appreciate the help. I would rather use the xdocument .writeto method for this program because it takes two lines of code.
EDIT*
Problem solved, the .writeto() method only writes to a specified file length and doesn't throw an exception if you try to write too much data. The .save method is much better.