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
|
# plankton's example from Perlmonks, with one change moving the
# maxOccurs="unbounded" from the <sequence> in lineItems to the
# <element>. http://perlmonks.org/index.pl?node_id=295416
--- |
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="invoiceNumber" type="xsd:string">
</xsd:element>
<xsd:element name="originator">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="companyName"/>
<xsd:element ref="companyContact"/>
<xsd:element ref="companyIdentifier"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="companyName" type="xsd:string">
</xsd:element>
<xsd:element name="companyContact" type="xsd:string">
</xsd:element>
<xsd:element name="companyIdentifier" type="xsd:string">
</xsd:element>
<xsd:element name="receiver">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="companyName"/>
<xsd:element ref="companyContact"/>
<xsd:element ref="companyIdentifier"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="itemDescription" type="xsd:string">
</xsd:element>
<xsd:element name="itemCount" type="xsd:string">
</xsd:element>
<xsd:element name="itemUnit" type="xsd:string">
</xsd:element>
<xsd:element name="itemPrice">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="currency"
type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="itemTotal">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="currency"
type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="lineItem">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="itemDescription"/>
<xsd:element ref="itemCount"/>
<xsd:element ref="itemUnit"/>
<xsd:element ref="itemPrice"/>
<xsd:element ref="itemTotal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="lineItems">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="lineItem" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="total" type="xsd:string">
</xsd:element>
<xsd:element name="invoice">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="invoiceNumber"/>
<xsd:element ref="originator"/>
<xsd:element ref="receiver"/>
<xsd:element ref="lineItems"/>
<xsd:element ref="total"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
--- |
<invoice>
<invoiceNumber>A1112CD</invoiceNumber>
<originator>
<companyName>Metaphorical Web</companyName>
<companyContact>James Eldridge</companyContact>
<companyIdentifier>MetWeb</companyIdentifier>
</originator>
<receiver>
<companyName>Semantic Web</companyName>
<companyContact>Sarah Tremaine</companyContact>
<companyIdentifier>SemanticWeb</companyIdentifier>
</receiver>
<lineItems>
<lineItem>
<itemDescription>Essay on Metaphorical
Web</itemDescription>
<itemCount>1</itemCount>
<itemUnit>Article</itemUnit>
<itemPrice currency="USD">155.60</itemPrice>
<itemTotal currency="USD">155.60</itemTotal>
</lineItem>
<lineItem>
<itemDescription>Lesson Package
</itemDescription>
<itemCount>4</itemCount>
<itemUnit>Lesson</itemUnit>
<itemPrice currency="USD">176.13</itemPrice>
<itemTotal currency="USD">704.52</itemTotal>
</lineItem>
</lineItems>
<total>860.12</total>
</invoice>
--- >
PASS
|