how to specify in xml schema that either one of two fields must be present?

Posted by matti on Stack Overflow See other posts from Stack Overflow or by matti
Published on 2010-03-26T13:57:07Z Indexed on 2010/03/26 16:43 UTC
Read the original article Hit count: 294

Filed under:

i want to specify that either fieldname or freetext is always present in xml files that apply to xsd. is there a way to define it?

<xs:complexType name="tSome">
<xs:sequence>
  <!-- either of 2 below have 2 be present. -->
  <xs:element name="fieldname" type="xs:string" minOccurs="0" />
  <xs:element name="freetext" type="xs:string" minOccurs="0" />
  <xs:element name="dbtablename" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>

thanks & best regards: Matti

© Stack Overflow or respective owner

Related posts about xml-schema