ConsolidateAddress.xsd Sample

This topic inludes the source code for the ConsolidateAddress.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/bea/samples/workshop/xmlmap/consolidateAddress" xmlns:ca="http://openuri.org/bea/samples/workshop/xmlmap/consolidateAddress" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
03     <xs:complexType name="addressType">
04         <xs:sequence>
05             <xs:element name="street" type="xs:string"/>
06             <xs:element name="city" type="xs:string"/>
07             <xs:element name="state" type="xs:string"/>
08             <xs:element name="zip" type="xs:string"/>
09         </xs:sequence>
10         <xs:attribute name="location" use="required">
11             <xs:simpleType>
12                 <xs:restriction base="xs:NMTOKEN">
13                     <xs:enumeration value="home"/>
14                     <xs:enumeration value="work"/>
15                 </xs:restriction>
16             </xs:simpleType>
17         </xs:attribute>
18     </xs:complexType>
19     <xs:complexType name="employeeType">
20         <xs:sequence>
21             <xs:element name="name" type="xs:string"/>
22             <xs:element name="address" type="ca:addressType" maxOccurs="unbounded"/>
23             <xs:element name="phone" type="ca:phoneType" maxOccurs="unbounded"/>
24         </xs:sequence>
25     </xs:complexType>
26     <xs:element name="setEmployees">
27         <xs:complexType>
28             <xs:sequence>
29                 <xs:element ref="ca:employees" maxOccurs="unbounded"/>
30             </xs:sequence>
31         </xs:complexType>
32     </xs:element>
33     <xs:element name="employees">
34         <xs:complexType>
35             <xs:sequence>
36                 <xs:element name="employee" type="ca:employeeType" maxOccurs="unbounded"/>
37             </xs:sequence>
38         </xs:complexType>
39     </xs:element>
40     <xs:complexType name="phoneType">
41         <xs:simpleContent>
42             <xs:extension base="xs:string">
43                 <xs:attribute name="location" use="required">
44                     <xs:simpleType>
45                         <xs:restriction base="xs:NMTOKEN">
46                             <xs:enumeration value="home"/>
47                             <xs:enumeration value="mobile"/>
48                             <xs:enumeration value="work"/>
49                         </xs:restriction>
50                     </xs:simpleType>
51                 </xs:attribute>
52             </xs:extension>
53         </xs:simpleContent>
54     </xs:complexType>
55 </xs:schema>