<xs:element name="root">
   <xs:complexType>
      <xs:all minOccurs="0" maxOccurs="unbounded">
          <xs:element name="identifier" type="xs:string"/>
          <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xs:all>
   </xs:complexType>
</xs:element>你看看用all行不行。 没试。

解决方案 »

  1.   

    不行,应该,all不要求顺序,但每个都需要出现。
    我现在正在试着用RELAX NG的name class,不知道是否可行。
      

  2.   

    <xs:element name="root">
       <xs:complexType>
          <xs:all minOccurs="0" maxOccurs="unbounded">
              <xs:element name="identifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
              <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
          </xs:all>
       </xs:complexType>
    </xs:element>如果都加上MIN 0, MAX unbounded 不行吗?
      

  3.   

    The all element provides an XML representation that describes an unordered set of element types. For each element type associated with an all element in an XML Schema Document, there must be a corresponding element in the corresponding XML instance. However, they may appear in the any order. In fact, there may be zero or many elements for each type depending upon the values of the minOccurs and maxOccurs attributes associated with the corresponding element type.
      

  4.   

    路过,想请问一下Relax技术是怎么一回事?
    是用来生成xsd的么?
    xsd是用来校验XML格式的合法性的么?
    也就是说XML还是要用程序自己生成?