Reputation: 1247
My original xml file is not complete it's throwing an exception: Unexpected end of file has occured . the following elements are not closed rrrr, nnnn
XML file e.g.:
<rrrr>
<nnnn>
<aaaa>
</aaaa>
<bbbb>
</bbbb>
How can I edit this file using C# to include </nnnn></rrrr>
?
Upvotes: 0
Views: 70
Reputation: 125660
The simplest one would use File.AppendText
method:
using (StreamWriter w = File.AppendText(filePath))
{
w.WriteLine("</nnnn>");
w.WriteLinw("</rrrr>");
}
Upvotes: 3