I need to require
(firstName and lastName) OR (nameForDisplay)
in an XSD. I can get XOR if I use <xs:choice>
but I can't seem to get OR.
You'll need to use # escape codes for these two characters, so ™ for TM and ® for (R).
Supported XML Schema data typesMetric and key value expressions. Calculating a key performance indicator (KPI) based on other KPIs or user-defined XPath functions. Expressions to set outbound event attributes. Specification of default values.
<xsd:element name="A" minOccurs="0"/> means A is optional and may appear at most once. <xsd:element name="A" maxOccurs="unbounded"/> means A is required and may repeat an unlimited number of times.
The TargetNamespace is the namespace of all schema components in this schema as well as any schema included using the include element. Included schemas must either have the same target namespace as the containing schema or have no target namespace specified.
<choice>
<sequence>
<element name="firstName" />
<element name="lastName" />
<element name="nameForDisplay" minOccurs="0" />
</sequence>
<element name="nameForDisplay" />
</choice>
Ugly to have repetition, I know. You could factor out some repetition with groups.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With