How would I define an element that can either contain plain text or contain elements? Say I wanted to somehow allow for both of these cases:
<xs:element name="field">
<xs:complexType>
<xs:sequence>
<xs:element ref="subfield" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="field" type="xs:string" />
... so that both these elements would be valid:
<field name="test_field_0">
<subfield>Some text.</subfield>
</field>
<field name="test_field_1">Some more text.</field>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…