Skip to main content
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
XML Schema Infoset Model, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
6. Elements and attributes

Exercise 5: Create a global, local, and element reference page 2 of 6

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"?>
  <simpleType name="USState">
    <restriction base="string">
      <enumeration value="AK"/>
      <enumeration value="AL"/>
      <enumeration value="AR"/>
    <list itemType="po:USState"/>
  <complexType name="PurchaseOrderType">
      <element minOccurs="0" name="state" type="po:USState"/>
      <element ref="po:notes"/>
  <element name="notes" type="string"/>

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

Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact