Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XSD with "required" attribute option related query

Rajneesh S-OracleFeb 21 2020 — edited Feb 24 2020

Hello All,

I am new to XSD and XML and need to explore if there is option to make sure that any one attribute in a set of attributes within same element is required.

Example:

  <xs:element name="where" maxOccurs="1" minOccurs="0">

          <xs:complexType>

            <xs:sequence>

              <xs:element name="condition" maxOccurs="unbounded" minOccurs="1">

                <xs:complexType>

                  <xs:simpleContent>

                    <xs:extension base="xs:string">

                      <xs:attribute type="xs:string" name="alias1" use="required"/>

                      <xs:attribute type="xs:string" name="col1" use="required"/>

                      <xs:attribute type="xs:string" name="operator" use="required"/>

                      <xs:attribute type="xs:string" name="string" use="optional"/>

                      <xs:attribute type="xs:string" name="number" use="optional"/>

                      <xs:attribute type="xs:string" name="date" use="optional"/>

                    </xs:extension>

                  </xs:simpleContent>

                </xs:complexType>

              </xs:element>

            </xs:sequence>

          </xs:complexType>

        </xs:element>

Here I want to ensure that minimum one  attribute  in a set of 3 attributes (mentioned as optional in above) are required. All can not be optional , however any one (can be more than one also) is required.

Thanks,

Rajneesh

This post has been answered by odie_63 on Feb 22 2020
Jump to Answer
Comments
Post Details
Added on Feb 21 2020
4 comments
2,213 views