DataSet ds=new DataSet();
System.IO.FileStream fs=new System.IO.FileStream("abc.xml",System.IO.FileMode.Open);
//读取XML文档
ds.ReadXmlSchema(fs);
fs.Close();
2,使用文件名的例子:
DataSet ds=new DataSet();
ds.ReadXmlSchema("abc.xml");
3,使用StreamReader对象(TextReader的派生类)
DataSet ds=new DataSet();
System.IO.StreamReader sr=new System.IO.StreamReader("abc.xml");
sr.Close();
4,使用XmlTextReader(XmlReader的派生类)
DataSet ds=new DataSet();
System.IO.FileStream fs=new System.IO.FileStream("abc.xml",System.IO.FileMode.Open);
System.Xml.XmlTextReader xmlreader=new System.Xml.XmlTextReader(fs);
ds.ReadXmlSchema(xmlreader);
xmlreader.Close();