[C#] 
private void ReadSchemaFromFile(){
   // Create the DataSet to read the schema into.
   DataSet thisDataSet = new DataSet();
   // Set the file path and name. Modify this for your purposes.
   string filename="mySchema.xml";
   // Invoke the ReadXmlSchema method with the file name.
   thisDataSet.ReadXmlSchema(filename);
   //然后写数据,通过什么方式你自己决定datagrid或者代码都可以
   ........................
   thisDataSet.WriteXML("你要形成XML文件的名称");}

解决方案 »

  1.   

    谢谢,试试看直接使用VS.net的IDE不可以实现吗?因为起初我只需要写点测试数据即可
      

  2.   

    谢谢,其实有一个架构文件之后,另外一个文件只需要指定到那个文件为架构即可例如存在一个架构文件XMLSchema1.xsd在数据文件中只需要建立这样的一个头即可
    <?xml version="1.0" standalone="yes" ?>
    <XMLSchema1 xmlns="http://tempuri.org/XMLSchema1.xsd">然后使用IDE打开即可填写数据了