开发者

Typed recursive element

  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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜