Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 5, 2019. It is now read-only.

Commit b3ed047

Browse files
Video 04 h 1.08
-File
1 parent b2b57d7 commit b3ed047

File tree

1 file changed

+96
-31
lines changed

1 file changed

+96
-31
lines changed

‎03 - XML Schema.md

Lines changed: 96 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -740,44 +740,109 @@ Il meccanismo di restrizione è molto simile alla programmazione ad oggetti quan
740740
741741
PurchaseOrder.xml:
742742
743-
<?xml version="1.0"?>
744-
<purchaseOrder orderDate="1999-10-20"
743+
01 <?xml version="1.0"?>
744+
02 <purchaseOrder orderDate="1999-10-20"
745745
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
746746
xsi:noNamespaceSchemaLocation="purchaseOrder.xsd">
747747
748-
<shipTo country="US">
749-
<name>Alice Smith</name>
750-
<street>123 Maple Street</street>
751-
<city>Mill Valley</city>
752-
<state>CA</state>
753-
<zip>90952</zip>
754-
</shipTo>
755-
<billTo country="US">
756-
<name>Robert Smith</name>
757-
<street>8 Oak Avenue</street>
758-
<city>Old Town</city>
759-
<state>PA</state>
760-
<zip>95819</zip>
761-
</billTo>
762-
<comment>Hurry, my lawn is going wild!</comment>
763-
<items>
764-
<item partNum="872-AA">
765-
<productName>Lawnmower</productName>
766-
<quantity>1</quantity>
767-
<USPrice>148.95</USPrice>
768-
<comment>Confirm this is electric</comment>
769-
</item>
770-
<item partNum="926-AA">
771-
<productName>Baby Monitor</productName>
772-
<quantity>1</quantity>
773-
<USPrice>39.98</USPrice>
774-
<shipDate>1999年05月21日</shipDate>
775-
</item>
776-
</items>
748+
03 <shipTo country="US">
749+
04 <name>Alice Smith</name>
750+
05 <street>123 Maple Street</street>
751+
06 <city>Mill Valley</city>
752+
07 <state>CA</state>
753+
08 <zip>90952</zip>
754+
09 </shipTo>
755+
10 <billTo country="US">
756+
11 <name>Robert Smith</name>
757+
12 <street>8 Oak Avenue</street>
758+
13 <city>Old Town</city>
759+
14 <state>PA</state>
760+
15 <zip>95819</zip>
761+
16 </billTo>
762+
17 <comment>Hurry, my lawn is going wild!</comment>
763+
18 <items>
764+
19 <item partNum="872-AA">
765+
20 <productName>Lawnmower</productName>
766+
21 <quantity>1</quantity>
767+
22 <USPrice>148.95</USPrice>
768+
23 <comment>Confirm this is electric</comment>
769+
24 </item>
770+
25 <item partNum="926-AA">
771+
26 <productName>Baby Monitor</productName>
772+
27 <quantity>1</quantity>
773+
28 <USPrice>39.98</USPrice>
774+
29 <shipDate>1999年05月21日</shipDate>
775+
30 </item>
776+
31 </items>
777777
</purchaseOrder>
778778
779+
In questo caso si hanno due indirizzi:
780+
`shipTo` (03/09) e `billTo` (10/16).
781+
782+
Poi ci sono due items:
783+
-(19/24) `partNum`
784+
-(25/30) `partNum`
785+
779786
780787
788+
- **documento XML**: PurchaseOrder.xml
789+
790+
791+
792+
<?xml version="1.0"?>
793+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
794+
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
795+
<xsd:element name="comment" type="xsd:string"/>
796+
<xsd:complexType name="PurchaseOrderType">
797+
<xsd:sequence>
798+
<xsd:element name="shipTo" type="USAddress"/>
799+
<xsd:element name="billTo" type="USAddress"/>
800+
<xsd:element ref="comment" minOccurs="0"/>
801+
<xsd:element name="items" type="Items"/>
802+
</xsd:sequence>
803+
<xsd:attribute name="orderDate" type="xsd:date"/>
804+
</xsd:complexType>
805+
<xsd:complexType name="USAddress">
806+
<xsd:sequence>
807+
<xsd:element name="name" type="xsd:string"/>
808+
<xsd:element name="street" type="xsd:string"/>
809+
<xsd:element name="city" type="xsd:string"/>
810+
<xsd:element name="state" type="xsd:string"/>
811+
<xsd:element name="zip" type="xsd:decimal"/>
812+
</xsd:sequence>
813+
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
814+
</xsd:complexType>
815+
<xsd:complexType name="Items">
816+
<xsd:sequence>
817+
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
818+
819+
<xsd:complexType>
820+
<xsd:sequence>
821+
<xsd:element name="productName" type="xsd:string"/>
822+
<xsd:element name="quantity">
823+
<xsd:simpleType>
824+
<xsd:restriction base="xsd:positiveInteger">
825+
<xsd:maxExclusive value="100"/>
826+
</xsd:restriction>
827+
</xsd:simpleType>
828+
</xsd:element>
829+
<xsd:element name="USPrice" type="xsd:decimal"/>
830+
<xsd:element ref="comment" minOccurs="0"/>
831+
<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
832+
</xsd:sequence>
833+
<xsd:attribute name="partNum" type="SKU" use="required"/>
834+
</xsd:complexType>
835+
</xsd:element>
836+
</xsd:sequence>
837+
</xsd:complexType>
838+
<!-- Stock Keeping Unit, a code for identifying products -->
839+
<xsd:simpleType name="SKU">
840+
<xsd:restriction base="xsd:string">
841+
<xsd:pattern value="\d{3}-[A-Z]{2}"/>
842+
</xsd:restriction>
843+
</xsd:simpleType>
844+
</xsd:schema>
845+
781846
782847
783848

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /