Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLTextWriter

Status
Not open for further replies.

Laeg

Programmer
Nov 29, 2004
95
IE
When finishing off writing an XML file with XMLTextWriter at the point where you use WriteEndDocument, how can I add a vbCrLf to the end of this document?

As in XMLTextWriter writes

<a>
<b></b>
</a> <----- I want to add a carriage return after this line but using XMLTextWriter's WriteEndDocument method to finish the document does not add this. How can I achieve this without having to open a file stream again and adding it in a second pass over this file?

Thanks for replies.
 
You can write Environment.NewLine using XmlTextWriter's WriteString() method after WriteEndDocument() and before Flush() and/or Close(). It is still legitimate. (I take your carriage return meant for a newline, otherwise, consider using ControlChars.Cr in the Microsoft.VisualBasic namespace.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top