| <!-- |
| |
| Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved. |
| |
| This program and the accompanying materials are made available under the |
| terms of the Eclipse Distribution License v. 1.0, which is available at |
| http://www.eclipse.org/org/documents/edl-v10.php. |
| |
| SPDX-License-Identifier: BSD-3-Clause |
| |
| --> |
| |
| <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
| <xs:element name="purchaseOrder" type="PurchaseOrderType"/> |
| <xs:element name="comment" type="xs:string"/> |
| <xs:complexType name="PurchaseOrderType"> |
| <xs:sequence> |
| <xs:element name="shipTo" type="USAddress"/> |
| <xs:element name="billTo" type="USAddress"/> |
| <xs:element ref="comment" minOccurs="0"/> |
| <xs:element name="items" type="Items"/> |
| </xs:sequence> |
| <xs:attribute name="orderDate" type="xs:date"/> |
| </xs:complexType> |
| |
| <xs:complexType name="USAddress"> |
| <xs:sequence> |
| <xs:element name="name" type="xs:string"/> |
| <xs:element name="street" type="xs:string"/> |
| <xs:element name="city" type="xs:string"/> |
| <xs:element name="state" type="USState"/> |
| <xs:element name="zip" type="ZipCodeType"/> |
| </xs:sequence> |
| <xs:attribute name="country" type="xs:NMTOKEN" fixed="US"/> |
| </xs:complexType> |
| |
| <xs:complexType name="Items"> |
| <xs:sequence> |
| <xs:element name="item" minOccurs="1" maxOccurs="unbounded"> |
| <xs:complexType> |
| <xs:sequence> |
| <xs:element name="productName" type="xs:string"/> |
| <xs:element name="quantity" default="10"> |
| <xs:simpleType> |
| <xs:restriction base="xs:positiveInteger"> |
| <xs:maxExclusive value="100"/> |
| </xs:restriction> |
| </xs:simpleType> |
| </xs:element> |
| <xs:element name="USPrice" type="xs:decimal"/> |
| <xs:element ref="comment" minOccurs="0"/> |
| <xs:element name="shipDate" type="xs:date" minOccurs="0"/> |
| </xs:sequence> |
| <xs:attribute name="partNum" type="SKU" use="required"/> |
| </xs:complexType> |
| </xs:element> |
| </xs:sequence> |
| </xs:complexType> |
| |
| <!-- Stock Keeping Unit, a code for identifying products --> |
| <xs:simpleType name="SKU"> |
| <xs:restriction base="xs:string"> |
| <xs:pattern value="\d{3}-[A-Z]{2}"/> |
| </xs:restriction> |
| </xs:simpleType> |
| |
| |
| <xs:simpleType name="USState"> |
| <xs:restriction base="xs:string"> |
| <xs:enumeration value="AK"/> |
| <xs:enumeration value="AL"/> |
| <xs:enumeration value="AR"/> |
| <xs:enumeration value="CA"/> |
| <xs:enumeration value="MA"/> |
| <!-- and so on ... --> |
| </xs:restriction> |
| </xs:simpleType> |
| |
| <xs:simpleType name="ZipCodeType"> |
| <xs:restriction base="xs:integer"> |
| <xs:minInclusive value="10000"/> |
| <xs:maxInclusive value="99999"/> |
| </xs:restriction> |
| </xs:simpleType> |
| </xs:schema> |