November 2000
Intermediate to advanced
1152 pages
23h 32m
English
A choice lets you specify a number of elements, only one of which will be chosen. To create a choice in XML schemas, you use the <xsd:choice> element. Here's an example—in this case, I'll change the transactionType type so that the borrower can borrow either several books or just one book. I do this by creating the <xsd:choice> element that holds both a <books> element and a <book> element (note that in this case, the <book> element needs to be made into a global element so that I can refer to it in this choice, so I remove it from the declaration of the <books> element, as you see here:
<xsd:complexType name="transactionType"> <xsd:element name="Lender" type="address"/> <xsd:element name="Borrower" type="address"/> <xsd:element ...
Read now
Unlock full access