<person>
    <personinfo>
        <name></name>
        <father>
            <personinfo>
                <name></name>
                <father>
                    ……
                </father>
            </personinfo>
        </father>
    </personinfo>
</person>
就是想用一个schema验证子孙N代的校验,看了相关资料,嵌套没搞明白。呵呵,希望可以给一个完善一点的xsd,有相关的说明更好了。

解决方案 »

  1.   

    xml中一個元素属性又有值的schema的驗證寫法. 如下:  例如:下面的元素的寫法:                        <price days="12">5500</price>schema的驗證寫法:     <xs:element name="price" maxOccurs="2">
         <xs:complexType mixed="true">
          <xs:attribute name="days">
           <xs:simpleType>
            <xs:restriction base="xs:integer"></xs:restriction>
           </xs:simpleType>
          </xs:attribute>
         </xs:complexType>
        </xs:element>