I have never tried to get the WriteXml function to close the stream so I
don't know if there is a way of doing it but this is how I handle writing to
XML. You can ignore the Xceed part and just use anything that opens a
stream.
private void WriteToFile(Xce ed.FileSystem.A bstractFile sentFile)
{
using (System.IO.Stre am stream = sentFile.OpenWr ite(true))
{
XML.XmlWriterSe ttings settings = new System.Xml.XmlW riterSettings() ;
settings.Indent = true;
settings.OmitXm lDeclaration = false;
XML.XmlWriter xw = XML.XmlWriter.C reate(stream, settings);
xw.WriteStartDo cument();
xw.WriteStartEl ement("root");
this.WriteData( xw);
xw.WriteEndElem ent();
xw.WriteEndDocu ment();
xw.Close();
stream.Close();
}
}
"UJ" <fr**@nowhere.c om> wrote in message
news:O4******** ********@TK2MSF TNGP02.phx.gbl. ..
It appears when you do a DataSet.WriteXm l ( <filename>, <writemode> ) it
doesn't close the file immediately.
Is that true ? The reason I think that is I have two programs that are
going to be access the same XML file and when one writes to it the other
can't seem to read it.
I've also tried running in the debugger and stopping the program on the
line after the file is written, go to the next line and then attempting to
open the file. I can't until I close the debugger.
Any suggestions?
TIA - Jeff.