File: TestInvoice.xsd

package info (click to toggle)
netbeans 8.1%2Bdfsg3-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 816,472 kB
  • ctags: 847,258
  • sloc: java: 5,564,229; xml: 634,273; cpp: 25,695; ansic: 20,104; jsp: 12,621; sh: 10,354; php: 4,204; makefile: 1,456; fortran: 1,200; sql: 1,192; objc: 288; perl: 277; haskell: 120; yacc: 30; awk: 17; lex: 11; asm: 4
file content (146 lines) | stat: -rw-r--r-- 4,659 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

   <xsd:annotation>
      <xsd:documentation>
         This is a test XML Schema for Castor XML.
      </xsd:documentation>
   </xsd:annotation>

   <!--
       A simple representation of an invoice. This is simply an example
       and not meant to be an exact or even complete representation of an invoice.
     -->
   	
   <!-- Shipping Method -->
   <xsd:element name="shipping-method">
      <xsd:complexType>
      	  <xsd:sequence>
          	<xsd:element name="carrier" type="xsd:string"/>
          	<xsd:element name="option"  type="xsd:string"/>
          	<xsd:element name="estimated-delivery" type="xsd:duration"/>
      	  </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <!-- Shipping date -->
   <xsd:element name="shipping-date">
   		<xsd:complexType>
   			<xsd:sequence>
   				<xsd:element name="date" type="xsd:date"/>
   				<xsd:element name="time" type="xsd:time"/>
   			</xsd:sequence>
   		</xsd:complexType>
   	</xsd:element>
   
   <!-- A simple U.S. based Address structure -->
   <xsd:element name="address">
      <xsd:annotation>
         <xsd:documentation>
            Represents a U.S. Address
         </xsd:documentation>
      </xsd:annotation>

      <xsd:complexType>
      	 <xsd:sequence>
         	<!-- street address 1 -->
         	<xsd:element name="street1" type="xsd:string"/>
         	<!-- optional street address 2 -->
         	<xsd:element name="street2" type="xsd:string" minOccurs="0"/>
         	<!-- city-->
         	<xsd:element name="city" type="xsd:string"/>
         	<!-- state code -->
         	<xsd:element name="state" type="stateCodeType"/>
         	<!-- zip-code -->
         	<xsd:element ref="zip-code"/>
      	</xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <!-- A U.S. Zip Code -->
   <xsd:element name="zip-code">
      <xsd:simpleType>
         <xsd:restriction base="xsd:string">
        	 <xsd:pattern value="[0-9]{5}(-[0-9]{4})?"/>
      	 </xsd:restriction>
      </xsd:simpleType>
   </xsd:element>

   <!-- State Code
        obviously not a valid state code....but this is just
        an example and I don't feel like creating all the valid
        ones.
    -->
	<xsd:simpleType name="stateCodeType">
		<xsd:restriction base="xsd:string">
      		<xsd:pattern value="[A-Z]{2}"/>
   		</xsd:restriction>
   </xsd:simpleType>
   
   <!-- Telephone Number -->
   <xsd:simpleType name="TelephoneNumberType">
   		<xsd:restriction base="xsd:string">
   			<xsd:length value="12"/>
   			<xsd:pattern value="[0-9]{3}-[0-9]{3}-[0-9]{4}"/>
   		</xsd:restriction>
   </xsd:simpleType> 

   <!-- Cool price type -->
   <xsd:simpleType name="PriceType">
   		<xsd:restriction base="xsd:decimal">
   			<xsd:fractionDigits value="2"/>
    		        <xsd:totalDigits value="5"/>
    		        <xsd:minInclusive value="1"/>
   			<xsd:maxInclusive value="100"/>
   		</xsd:restriction>
   </xsd:simpleType>

   <!-- The attributes for an Item -->
   <xsd:attributeGroup name="ItemAttributes">
        <xsd:attribute name="Id" type="xsd:ID" use="required"/>
   	<xsd:attribute name="InStock" type="xsd:boolean" default="false"/>
   	<xsd:attribute name="Category" type="xsd:string" use="required"/>
    </xsd:attributeGroup>

   <xsd:element name="invoice">
      <xsd:annotation>
         <xsd:documentation>
             A simple representation of an invoice
         </xsd:documentation>
      </xsd:annotation>

      <xsd:complexType>
      	 <xsd:sequence>
      		<xsd:element name="ship-to">
            	<xsd:complexType>
                 	<xsd:group ref="customer"/>
                </xsd:complexType>
         	</xsd:element>
        	<xsd:element ref="item" maxOccurs="unbounded" minOccurs="1"/>
        	<xsd:element ref="shipping-method"/>
        	<xsd:element ref="shipping-date"/>
      	</xsd:sequence>
      </xsd:complexType>
   </xsd:element>

   <!-- Description of a customer -->
   <xsd:group name="customer">
        <xsd:sequence>
             <xsd:element name="name" type="xsd:string"/>
             <xsd:element ref="address"/>
             <xsd:element name="phone" type="TelephoneNumberType"/>
         </xsd:sequence>
	</xsd:group>
  
   <!-- Description of an item -->
   <xsd:element name="item">
   		<xsd:complexType>
   			<xsd:sequence>
   				<xsd:element name="Quantity" type="xsd:integer" minOccurs="1" maxOccurs="1"/>
        		<xsd:element name="Price" type="PriceType" minOccurs="1" maxOccurs="1"/>
    		</xsd:sequence>
    		<xsd:attributeGroup ref="ItemAttributes"/>
    	</xsd:complexType>
   	</xsd:element>

</xsd:schema>