开发者

Typed recursive element

开发者 https://www.devze.com 2022-12-22 07:15 出处:网络
Need to define XSD element that has some attributes and can hold list of itself This is the type definition:
  1. Need to define XSD element that has some attributes and can hold list of itself

This is the type definition:

<xs:complexType name="t_TestCase" >
  <xs:sequence>
    <xs:element type="t_TestCase" minOccurs="0"></xs:element>
  </xs:sequence>
</xs:complexType>

This is t开发者_运维问答he element based on the type:

  1. BUT - when adding attribute to the type - it seems that it is not valid anymore. (the sequence tag is invalid)

Advise please?

Tx


Use a complex type like so:

  <xs:element name="t_TestCase">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="t_TestCase"/>
      </xs:sequence>
      <xs:attribute name="att1"/>
    </xs:complexType>
  </xs:element>

Edit: my first answer sucked

0

精彩评论

暂无评论...
验证码 换一张
取 消