Project 2 - Problem 8.7 from Oracle 10g textbook

Consider the following XML document containing data from the mail order database:
<mo>
  	  <customers>
    	    <customer cno="1111">
            <cname>Charles</cname>
            <street>123 Main St.</street>
            <city>Wichita</city>
            <zip>67226</zip>
            <phone>316-636-5555</phone>
    	    </customer>
	  …
	  </customers>
	  <employees>
	    <employee eno="1000">
            <ename>Jones</ename>
            <city>Wichita</city>
            <zip>67226-1555</zip>
            <hdate>1995-12-12</hdate>
          </employee>
	    …
	  </employees>
	<parts>
        <part pno="10506">
          <pname>Land Before Time I</pname>
          <qoh>200</qoh>
          <price>19.99</price>
          <level>20</level>
        </part>
        …
      </parts>
      <orders>
        <order ono="1022" takenBy="1001" customer="2222">
          <receivedDate>1995-02-13</receivedDate>
          <shippedDate>1995-02-20</shippedDate>
          <items>
            <item>
              <partNumber>10601</partNumber>
              <quantity>1</quantity>
            </item>
            <item>
              <partNumber>10701</partNumber>
              <quantity>1</quantity>
            </item>
          </items>
        </order>
        …
      </orders>
    </mo>
The XML document has the <mo> element at the root and contains four sub-elements: <customers>, <employees>, <parts>, and <orders> in sequence.

The <customers> element contains zero or more <customer> sub-elements and the <customer> element contains one attribute, cno, whose value is a 4-digit integer between 1000 and 9999, and five sub-elements: <cname> of type string, <street> of type string, <city> of type string, <zip> whose value is either a 5-digit number or a 5-digit number followed by a “-“ followed by a 4-digit number, and <phone> whose value is a 3-digit area code followed by a “-“ followed by a 3-digit exchange code, followed by a “-“ and followed by a 4-digit number.

The <employees> element contains zero or more <employee> sub-elements and the <employee> element contains one attribute, eno, whose value is a 4-digit integer between 1000 and 9999, and four sub-elements: <ename> of type string, <city> of type string, <zip> whose value is either a 5-digit number or a 5-digit number followed by a “-“ followed by a 4-digit number, and <hdate> of type date.

The <parts> element contains zero or more <part> sub-elements and the <part> element contains one attribute, pno, whose value is a 5-digit integer between 10000 and 99999, and four sub-elements: <pname> of type string, <qoh> of type positive integer, <price> of type positive decimal with two fractional digits, and <level> of type positive integer.

The <orders> element contains zero or more <order> sub-elements and the <order> element contains three attributes, ono, whose value is a 4-digit integer between 1000 and 9999, takenBy whose value is the same type as an employee number, and customer whose value is the same type as a customer number, and the following sub-elements: <receivedDate> of type date, an optional <shippedDate> of type date, and <items> which is a repeating group (one or more) of <item> elements. The <item> element contains two sub-elements: <partNumber> whose value is the same type as a part number and <quantity> of type positive integer.

Write an XML Schema specification for the mail order document and validate several instance documents against the schema.