Allow sequence OR empty in XSD

Viewed 208

Looking to figure out how to match either on a set sequence or no value. Example below of my sequence, but I'm stuck for how to get it to accept either the sequence as written, or the <body> tag existing with no value inside it.

<xs:element name="body">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="id" type="xs:string"/>
              <xs:element name="name" type="xs:string"/>
              <xs:element name="type" type="xs:string"/>
              <xs:element name="user" type="xs:string"/>
            </xs:sequence>
          </xs:complexType>
</xs:element>

I want the above to match on either a blank (as below) or a correctly filled tag.

<body></body>

1 Answers
Related