我想将数据集转换为XML文件而不使用内置函数的WriteXML()。任何人都可以告诉我有没有其他选择?
private void WriteDataSetToXmlFile(DataSet ds, string fileName)
{
if (ds != null)
{
string b = TextBox2.Text;
string absoluteFileName = Server.MapPath(fileName);
System.IO.FileStream myFileStream = new System.IO.FileStream("D:\\XMLCON\\XMLCON\\" +b.ToString() +".xml", System.IO.FileMode.Create);
System.Xml.XmlTextWriter myXmlWriter = new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
ds.WriteXml(myXmlWriter);
myXmlWriter.Close();
}
}