2013-06-21 3 views
0

) 데이터 세트를 xsd 파일로 변환하는 유틸리티를 만들고 있습니다. 나는 데이터베이스에서 데이터를 읽고 데이터 세트를 작성 중이다 XSD 파일 작성을 위해 실제로 데이터 세트 및 데이터 테이블을 작성한 후Dataset.WriteXMLSchema()를 사용하여 xsd 파일을 작성합니다.XSD에서 minoccur 값을 변경하는 방법 (C#

내 파일 내가이 minOccur = 2를 변경하거나 우리가 같은도 Maxoccur을 추가 할 수있는 어떤 방법이

인가 내 XSD 파일의 모든 요소에 대한 속성 minoccur = 0을 얻고 생성 후 방법.?? 다음은

내가는 minOccurs와 maxOccurs에 값을 변경을 원

<?xml version="1.0" standalone="yes"?> 
    <xs:schema id="Golfers" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> 
    <xs:element name="Emp" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> 
     <xs:complexType> 
     <xs:choice minOccurs="0" maxOccurs="unbounded"> 
      <xs:element name="Employee_1"> 
      <xs:complexType> 
       <xs:attribute name="ID" type="xs:int" /> 
       <xs:attribute name="Name" type="xs:string" /> 
       <xs:attribute name="Salary" type="xs:int" /> 
      </xs:complexType> 
      </xs:element> 
     </xs:choice> 
     </xs:complexType> 
    </xs:element> 
    </xs:schema><!--EndFragment--> 

DataSet MyDataSet = new DataSet("Emp"); 

    // This can be confusing, the 'DataTable' will actually 
    // become Elements (Rows) in the XML file. 
    DataTable MyDataTable = new DataTable("Employee_1"); 

    MyDataSet.Tables.Add(MyDataTable); 

    // Make columns attributes so we can 
    // link directly to a GridView 
    MyDataTable.Columns.Add(new DataColumn("ID", 
           typeof(System.Int32), 
           null, 
           MappingType.Attribute)); 

    MyDataTable.Columns.Add(new DataColumn("Name", 
           typeof(String), 
           null, 
           MappingType.Attribute)); 

    MyDataTable.Columns.Add(new DataColumn("Salary", 
           typeof(int), 
           null, 
           MappingType.Attribute)); 

    // Write out the XSD 
    MyDataSet.WriteXmlSchema(@"C:\Employee.xsd"); 

내가 XSD 파일 아래에 무엇입니까 내 코드입니다

답변

1

의 생성에 영향을 미칠 할 방법이 없습니다 XSD 사용자 정의 도구에 내장 된 DataSet. 출력을 수동으로 후 처리하려면 여기서 설명한 http://support.microsoft.com/kb/318502과 같은 생성 후 XSD를로드하고 수정하는 것이 좋습니다.

관련 문제