public void WriteXml(string fileName, XmlWriteMode mode)
{
long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.WriteXml|API> {0}, fileName='{1}', mode={2}", ObjectID, fileName, (int)mode);
XmlTextWriter xw = new XmlTextWriter(fileName, null);
try
{
xw.Formatting = Formatting.Indented;
xw.WriteStartDocument(true);
if (xw != null)
{
// Create and save the updates
if (mode == XmlWriteMode.DiffGram)
{
new NewDiffgramGen(this).Save(xw);
}
else
{
// Create and save xml data
new XmlDataTreeWriter(this).Save(xw, mode == XmlWriteMode.WriteSchema);
}
}
xw.WriteEndDocument();
}
finally
{
xw.Close();
DataCommonEventSource.Log.ExitScope(logScopeId);
}
}