Using the XML Schema Infoset Model APIs and adding on to the schema
created in Exercise 4: Create a global complex type with a sequence model
group, create the following schema document:
<?xml version="1.0"?>
<schema
targetNamespace="http://www.eclipse.org/xsd/examples/po"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.eclipse.org/xsd/examples/po">
<simpleType name="USState">
<restriction base="string">
<enumeration value="AK"/>
<enumeration value="AL"/>
<enumeration value="AR"/>
</restriction>
</simpleType>
<simpleType>
<list itemType="po:USState"/>
</simpleType>
<complexType name="PurchaseOrderType">
<sequence>
<element minOccurs="0" name="state" type="po:USState"/>
<element ref="po:notes"/>
</sequence>
</complexType>
<element name="notes" type="string"/>
</schema>
Hint: You will need to create an
org.eclipse.xsd.XSDParticle for the local element and element reference.
New constructs created in this exercise:
- <element> - Global element with name="notes"
and type="string"
- <element> - Local element with name="state",
type="po:USState" and minOccurs="0"
- <element> - Element reference with
ref="po:notes"
Solution:
Exercise 5 solution