PriceSummary.xsd Sample

This topic inludes the source code for the PriceSummary.xsd Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/Schemas/

Sample Source Code


01 <?xml version="1.0" encoding="UTF-8"?>
02 <xs:schema targetNamespace="http://openuri.org/easypo/price-summary" 
03     xmlns:ps="http://openuri.org/easypo/price-summary" 
04     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
05     elementFormDefault="qualified">
06 
07     <!-- Define an item type that specifies information about an item. 
08         item elements are children of the price element. -->
09     <xs:complexType name="itemType">
10         <xs:sequence>
11             <xs:element name="title" type="xs:string"/>
12             <xs:element name="amount" type="xs:double"/>
13             <xs:element name="quantity" type="xs:integer"/>
14         </xs:sequence>
15     </xs:complexType>
16 
17     <!-- Define a price type that specifies price information. A price may
18         contain multiple item elements (of type "itemType"), and has a single
19         threshold attribute whose value may be "Below10Dollars""Between10And20Dollars",
20         or "Above20Dollars". These values are enumerated, and may be accessed as
21         enumerations through XMLBeans. -->
22     <xs:complexType name="priceType">
23         <xs:sequence>
24             <xs:element name="item" type="ps:itemType" minOccurs="0" maxOccurs="unbounded"/>
25         </xs:sequence>
26         <xs:attribute name="threshold">
27             <xs:simpleType>
28                 <xs:restriction base="xs:string">
29                     <xs:enumeration value="Below10Dollars"/>
30                     <xs:enumeration value="Between10And20Dollars"/>
31                     <xs:enumeration value="Above20Dollars"/>
32                 </xs:restriction>
33             </xs:simpleType>
34         </xs:attribute>
35     </xs:complexType>
36 
37     <!-- Define a price type that specifies price information. A price may
38         contain multiple item elements (of type "itemType"), and has a single
39         threshold attribute whose value may be "Below10Dollars""Between10And20Dollars",
40         or "Above20Dollars". These values are enumerated, and may be accessed as
41         enumerations through XMLBeans. -->
42     <xs:element name="price-summary">
43         <xs:complexType>
44             <xs:sequence>
45                 <xs:element name="price" type="ps:priceType" maxOccurs="unbounded"/>
46             </xs:sequence>
47         </xs:complexType>
48     </xs:element>
49 </xs:schema>