Title: XSD complexType definition without indicators
Tags: xsd;complextype
Question: if i want to define a complex type, i can go
<xs:complexType name="personinfo"&gt;
<xs:sequence&gt;
<xs:element name="firstname" type="xs:string"/&gt;
<xs:element name="lastname" type="xs:string"/&gt;
</xs:sequence&gt;
</xs:complexType&gt;
or, i can replace the
<xs:sequence&gt; ...     </xs:sequence&gt;
tag in the above with
<xs:all&gt; ...     </xs:all&gt;
<xs:choice&gt; ...     </xs:choice&gt;
and it validates.
However, these are imposing restrictions on the order/occurrence of the elements.
Is there a way to define a complex element without any of these indicators?
Been "inspired" with
<xs:complexType name="personinfo2"&gt;
<xs:complexContent&gt;
<xs:element name="firstname" type="xs:string"/&gt;
<xs:element name="lastname" type="xs:string"/&gt;
</xs:complexContent&gt;
</xs:complexType&gt;
so far, but didn't work.


Here is another answer: You really should read a tutorial on XSD.
No, you cannot define a content model without specifying (explicitly or implicitly) one of xs:sequence, xs:choice, or xs:all.
If you want to make no restrictions on the sequence or number of occurrences of your child elements, then what you probably want is:
<xs:complexType name="sample"&gt;
<xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
<xs:element name="e1" type="xs:string"/&gt;
<xs:element name="e2" type="xs:string"/&gt;
</xs:choice&gt;
</xs:complexType&gt;
This allows any number of e1 and e2 children, in any order.  If you find that you don't want any valid elements of type personinfo to contain 37 lastname elements and 36 firstname elements, in alternation, then you have discovered something about what you do and don't want.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:08/27/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<xsd><complextype>', 'Title': 'XSD complexType definition without indicators', 'ViewCount': 389, 'id': 18476814, 'user_AboutMe': None, 'user_AccountId': 2939648.0, 'user_DisplayName': 'Roam', 'user_Reputation': 4701.0, 'user_Views': 775.0, 'user_id': 2517838.0}}