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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using XMLTextWriter to output to stream and then a file

Status
Not open for further replies.

MarkGreen

Technical User
Oct 4, 2002
40
GB
Hello

Beginners question! I need some help regarding writing XML to a file using C#

I am currently outputting my XML to a file directly using

KeywordsDataXML = new XmlTextWriter(keywordCacheLocationFile, Encoding.UTF8);

This working fine, however I now need to examine the results of each node before I output them to the file. So I thought I would output to a memory stream first using

XmlTextWriter tempKeywordsDataXML = null; //MG
MemoryStream ms = new MemoryStream(); //MG
tempKeywordsDataXML = new XmlTextWriter(ms, Encoding.UTF8);

However I am now having problems transferring the contents of the memorystream (tempKeywordsDataXML) to the file (KeywordsDataXML)

Sorry to be posting quite a basic question but I'm new to this - any help is appreciated.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top