/Users/lyon/j4p/src/xml/classInfo/schema examples/single schema/ClassInfo.xsd

1    <?xml version="1.0" encoding="UTF-8"?> 
2     
3    <xsd:schema xmlns='http://tfr.com/myClassSchema' 
4                xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
5                targetNamespace='http://tfr.com/myClassSchema' 
6                elementFormDefault='qualified'> 
7     
8        <xsd:annotation> 
9            <xsd:documentation> 
10               XML Schema defining information about a class 
11           </xsd:documentation> 
12       </xsd:annotation> 
13    
14       <xsd:simpleType name="CourseNumType"> 
15           <xsd:restriction base="xsd:string"> 
16               <xsd:pattern value="[A-Z]{2}[0-9]{3}"/> 
17           </xsd:restriction> 
18       </xsd:simpleType> 
19    
20       <xsd:simpleType name="ID9Type"> 
21           <xsd:restriction base="xsd:integer"> 
22               <xsd:totalDigits value="9"/> 
23               <xsd:minInclusive value="000000000"/> 
24           </xsd:restriction> 
25       </xsd:simpleType> 
26    
27       <xsd:simpleType name="YearType"> 
28           <xsd:restriction base="xsd:integer"> 
29               <xsd:totalDigits value="4"/> 
30               <xsd:minInclusive value="2001"/> 
31           </xsd:restriction> 
32       </xsd:simpleType> 
33        
34       <xsd:element name="ClassInfo" type="ClassInfoType"/>  
35       <xsd:element name="Instructor" type="InstructorType"/>  
36       <xsd:element name="Student" type="StudentType"/>  
37    
38       <xsd:element name="ID" type="ID9Type"/>  
39       <xsd:element name="Name" type="xsd:string"/>  
40       <xsd:element name="Title" type="xsd:string"/>  
41       <xsd:element name="Email" type="xsd:string"/>  
42       <xsd:element name="Phone" type="xsd:string"/>  
43        
44       <xsd:complexType name="InstructorType"> 
45           <xsd:sequence> 
46               <xsd:element ref="Name"/> 
47               <xsd:element ref="Title"/> 
48               <xsd:element ref="ID"/> 
49               <xsd:element ref="Email"/> 
50               <xsd:element ref="Phone"/> 
51           </xsd:sequence>  
52       </xsd:complexType>  
53    
54       <xsd:complexType name="StudentType"> 
55           <xsd:sequence> 
56               <xsd:element ref="Name"/> 
57               <xsd:element ref="ID"/> 
58               <xsd:element name="YOG" type="YearType"/>  
59               <xsd:element ref="Email"/> 
60               <xsd:element ref="Phone"/> 
61           </xsd:sequence>  
62       </xsd:complexType>  
63    
64       <xsd:complexType name="ClassInfoType"> 
65           <xsd:sequence> 
66               <xsd:element name="CourseNo" type="CourseNumType"/> 
67               <xsd:element ref="Title"/> 
68               <xsd:element name="Section" type="xsd:string"/>  
69               <xsd:element name="Semester" type="xsd:string"/>  
70               <xsd:element name="Year" type="YearType"/>  
71               <xsd:element ref="Instructor" minOccurs="0"/> 
72               <xsd:element ref="Student" minOccurs="0" maxOccurs="unbounded"/> 
73           </xsd:sequence> 
74       </xsd:complexType>  
75    
76   </xsd:schema> 
77