如何把xsd转换成xml?

解决方案 »

  1.   

    什么叫把XSD转换成XML?XSD本身的格式就是XML,如果你要产生基于XSD的样品XML文件,如果你用XMLSPYFile | Document Wizards... | "XML Schema to XML"
    用编码的话,参考下文,虽然该文是产生类,不是完全你要的,但你应该据此而产生XMLhttp://msdn.microsoft.com/xml/default.aspx?pull=/library/en-us/dnxmlnet/html/xsdcodegen.asp
    http://www.codeproject.com/soap/xmlcodegen.asp
      

  2.   

    xsd转成xml?xsd本身就是xml呀。
      

  3.   

    楼主是想通过xsd得到xml吗?给段代码:DataSet ds=new DataSet();
    string path=Server.MapPath("./");
    ds.ReadXmlSchema(path+"XSDSchema1.xsd");//XSDSchema1.xsd是已经存在的,有两列
    DataRow dr=ds.Tables[0].NewRow();
    dr[0]="111";
    dr[1]="hello";
    ds.Tables[0].Rows.Add(dr);//插入值到ds
    ds.WriteXml(path+"test.xml");//ds写到xml中,不存在就新建