title: How to specify in an XML schema that either one of two fields must be present?
body: <p>I want to specify that either <code>fieldname</code> or <code>freetext</code> must always be present in XML files that apply to this XSD. Is there a way to do that?</p>
  
  <pre><code>&lt;xs:complexType name="tSome"&gt;
  &lt;xs:sequence&gt;
    &lt;!-- either one of the two below has to be present. --&gt;
    &lt;xs:element name="fieldname" type="xs:string" /&gt;
    &lt;xs:element name="freetext" type="xs:string" /&gt;
    &lt;!-- this one below must always be present --&gt;
    &lt;xs:element name="dbtablename" type="xs:string" /&gt;
  &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>