Skip to main content
IBM  
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
3. Simple types
  


Exercise 3: Create a list simple type page 8 of 10


Using the XML Schema Model APIs and adding on to the schema created in Exercise 2: Create an atomic simple type with enumeration facets, create a user-defined simple type called "USStateList" that has a item type "USState", which was created in the previous exercise.


<?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 name="USStateList">
    <list itemType="po:USState"/>
  </simpleType>
   
</schema>
                                

New constructs created in this exercise:

  • <simpleType> - global list simple type with name="USStateList" and itemType="po:USState"
Solution: Exercise 3 solution


Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact