2013-02-08 89 views
1

我附上我的XSD的刪減版本如何創建XSD架構與

<?xml version="1.0" encoding="UTF-8"?> 

<xs:complexType name="School_ip_details"> 
    <xs:sequence> 
     <xs:element type="xs:string" name="Tarun_Name" /> 
     <xs:element type="xs:string" name="Tarun_IP" /> 
     <xs:element type="xs:string" name="Tarun_Subnet" /> 

    </xs:sequence> 
</xs:complexType> 

<xs:element name="CLASSESS"> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="Taruns"> 
       <xs:complexType> 
        <xs:sequence> 
         <xs:element name="Tarun" maxOccurs="127"> 
          <xs:complexType> 
           <xs:sequence> 
            <xs:element type="xs:string" name="Tarun_Name" /> 
            <xs:element type="xs:string" name="Tarun_Prefix" /> 
            <xs:element type="xs:string" name="Tarun_Subnet" /> 
           </xs:sequence> 
          </xs:complexType> 
         </xs:element> 
        </xs:sequence> 
       </xs:complexType> 
      </xs:element> 



      <xs:element name="Schools"> 
       <xs:complexType> 
        <xs:sequence> 
         <xs:element name="School"> 
          <xs:complexType> 
           <xs:sequence> 
            <xs:element name="School_IPdetails" type="School_ip_details" /> 
           </xs:sequence> 
          </xs:complexType> 
         </xs:element> 
        </xs:sequence> 
       </xs:complexType> 

       <xs:keyref name="TarunRef" refer="TarunKey"> 
        <xs:selector xpath="." /> 
        <xs:field xpath="./School/School_IPdetails/Tarun_Name" /> 

       </xs:keyref> 
      </xs:element> 

     </xs:sequence> 
    </xs:complexType> 
    <xs:key name="TarunKey"> 
     <xs:selector xpath="./Taruns/Tarun/Tarun_Name" /> 

     <xs:field xpath="." /> 
    </xs:key> 

    <xs:key name="TarunIPKey"> 
     <xs:selector xpath="./Taruns/Tarun/Tarun_Prefix" /> 
     <xs:field xpath="." /> 
    </xs:key> 

</xs:element> 

在這裏,我要實現以下情形字段之間的關係。當我提到從CLASSES/Taruns/Tarun/Tarun_NameCLASSES/Scools/School/School_ip_details/Tarun_Name那麼CLASSES/Taruns/Tarun/Tarun_Prefix針對特定Tarun_Name值應在CLASSES/Scools/School/School_ip_details/Tarun_IP

體現任何價值,請幫助我爲同一

+0

我使用了以下代碼byt no benefit \t \t \t

回答

0

查找身份的約束(唯一,密鑰和keyref)在XSD參考指南。 (您沒有XSD參考指南?獲取一個。)