Closed SmartLayer closed 4 years ago
I have investigated this completely and it is almost impossible to implement combination of sequence and random order as mentioned above.
It is still possible if all the random order elements either have
But this is not the case for TokenScript XSD. We have some of the elements as maxOccurs="1" and some of them have maxOccurs="unbounded".
i.e.
Under
<element name="origins" minOccurs="0">
<complexType>
<sequence>
<element ref="ts:ethereum"/>
</sequence>
</complexType>
</element>
<element ref="ts:cards"/>
<element minOccurs="0" ref="ts:grouping"/>
<element minOccurs="0" ref="ts:ordering"/>
Under
<element minOccurs="0" ref="ts:origins"/>
<element minOccurs="0" name="input" type="ts:tokens"/>
<element minOccurs="0" name="output" type="ts:tokens"/>
<element minOccurs="0" ref="ts:transaction"/>
Tried to resolve it for cards using different combinations of XSD elements like sequence, choice, group and all but ultimately the goal is not achieved.
Here one tried XSD trick using choice:
<complexType name="card">
<sequence>
<element minOccurs="0" name="label" type="ts:text"/>
<choice minOccurs="0" maxOccurs="unbounded">
<element minOccurs="0" maxOccurs="unbounded" ref="ts:attribute"/>
<element minOccurs="0" maxOccurs="unbounded" ref="ts:selection"/>
<element minOccurs="0" maxOccurs="unbounded" name="guide-view" type="ts:view"/>
<element minOccurs="0" maxOccurs="unbounded" name="item-view" type="ts:view"/>
<element minOccurs="0" maxOccurs="unbounded" name="view" type="ts:view"/>
</choice>
<choice minOccurs="0" maxOccurs="1">
<element minOccurs="0" ref="ts:origins"/>
</choice>
<!-- consider putting input and output in transaction
declaration later when/if DvP Security is
implemented. At this stage, DvP security is not
implemented so whatever input and output here are
for the user interface only. One may argue that
this provides a false sense of security if we move
them to <transaction> too early -->
<choice minOccurs="0" maxOccurs="1">
<element minOccurs="0" name="input" type="ts:tokens"/>
</choice>
<choice minOccurs="0" maxOccurs="1">
<element minOccurs="0" name="output" type="ts:tokens"/>
</choice>
<choice minOccurs="0" maxOccurs="1">
<element minOccurs="0" ref="ts:transaction"/>
</choice>
</sequence>
<attribute name="type" use="required" type="ts:cardType"/>
<attribute name="exclude" type="IDREFS"/>
<attribute name="name" type="NCName" use="required"/>
</complexType>
Thanks.
For
<token>
it has<cards>
Is it possible to require that only the first 2 elements to be at the beginning of the TS file, while the rest of the elements can appear in any order following?
Similarly, every element inside
<card>
, except<label>
, can be in any order. is it achievable with schema?