summaryrefslogtreecommitdiff
path: root/examples/manual
diff options
context:
space:
mode:
authorpab <devnull@localhost>2009-08-22 04:19:29 +0000
committerpab <devnull@localhost>2009-08-22 04:19:29 +0000
commit5d01f8376a40181ba9e6bebaffd856c5caea184e (patch)
tree27df2c07b14609b826c0df8c821e919f958f68ef /examples/manual
parent01083979fcf30aa38333e6b0cb411befb2531b22 (diff)
Update for new interfaces and documentation
Diffstat (limited to 'examples/manual')
-rw-r--r--examples/manual/demo.sh35
-rw-r--r--examples/manual/demo1.out3
-rw-r--r--examples/manual/demo1.sh2
-rw-r--r--examples/manual/demo2.sh2
-rw-r--r--examples/manual/demo3a.sh2
-rw-r--r--examples/manual/demo3b.sh3
-rw-r--r--examples/manual/demo3c.sh3
-rw-r--r--examples/manual/demo3d.sh3
-rw-r--r--examples/manual/demo4.sh3
-rw-r--r--examples/manual/demo4b.sh3
-rw-r--r--examples/manual/nsaddress.xsd59
-rw-r--r--examples/manual/po3.xsd1
12 files changed, 93 insertions, 26 deletions
diff --git a/examples/manual/demo.sh b/examples/manual/demo.sh
index 0eb2559..81a1f23 100644
--- a/examples/manual/demo.sh
+++ b/examples/manual/demo.sh
@@ -1,22 +1,13 @@
-PYTHONPATH=../..:.
-export PYTHONPATH
-PYXB_ARCHIVE_PATH=.:+
-export PYXB_ARCHIVE_PATH
-rm -f *.wxs
-rm -f po1.py
-../../scripts/pyxbgen -u po1.xsd -m po1
-python demo1.py
-rm -f po2.py
-../../scripts/pyxbgen -u po2.xsd -m po2
-python demo2.py
-rm -f address.py address.wxs
-../../scripts/pyxbgen -u nsaddress.xsd -m address --archive-to-file=address.wxs
-if [ ! -f address.wxs ] ; then
- echo 1>&2 "Address namespace archive not found"
- exit 1
-fi
-rm -f po3.py
-../../scripts/pyxbgen -u po3.xsd -m po3
-python demo3.py
-#rm po4.py
-#../../scripts/pyxbgen -u po4.xsd -m po4
+rm -f *.wxs po?.py *.pyc
+sh demo1.sh \
+ && python demo1.py > demo1.out \
+ && cat demo1.out
+sh demo2.sh \
+ && python demo2.py
+sh demo3a.sh \
+ && python demo3.py
+sh demo3b.sh \
+ && python demo3.py
+sh demo3c.sh \
+ && sh demo3d.sh \
+ && python demo3.py
diff --git a/examples/manual/demo1.out b/examples/manual/demo1.out
new file mode 100644
index 0000000..2aa8a40
--- /dev/null
+++ b/examples/manual/demo1.out
@@ -0,0 +1,3 @@
+Robert Smith is sending Alice Smith 2 thing(s):
+ Quantity 1 of Lapis necklace at $99.95
+ Quantity 4 of Plastic necklace at $3.95
diff --git a/examples/manual/demo1.sh b/examples/manual/demo1.sh
new file mode 100644
index 0000000..c1851dc
--- /dev/null
+++ b/examples/manual/demo1.sh
@@ -0,0 +1,2 @@
+pyxbgen \
+ -u po1.xsd -m po1
diff --git a/examples/manual/demo2.sh b/examples/manual/demo2.sh
new file mode 100644
index 0000000..26c702c
--- /dev/null
+++ b/examples/manual/demo2.sh
@@ -0,0 +1,2 @@
+pyxbgen \
+ -u po2.xsd -m po2
diff --git a/examples/manual/demo3a.sh b/examples/manual/demo3a.sh
new file mode 100644
index 0000000..bf71c4e
--- /dev/null
+++ b/examples/manual/demo3a.sh
@@ -0,0 +1,2 @@
+pyxbgen \
+ -u po3.xsd -m po3
diff --git a/examples/manual/demo3b.sh b/examples/manual/demo3b.sh
new file mode 100644
index 0000000..34bfd4c
--- /dev/null
+++ b/examples/manual/demo3b.sh
@@ -0,0 +1,3 @@
+pyxbgen \
+ -u po3.xsd -m po3 \
+ -u nsaddress.xsd -m address
diff --git a/examples/manual/demo3c.sh b/examples/manual/demo3c.sh
new file mode 100644
index 0000000..8fc69b9
--- /dev/null
+++ b/examples/manual/demo3c.sh
@@ -0,0 +1,3 @@
+pyxbgen \
+ -u nsaddress.xsd -m address \
+ --archive-to-file address.wxs
diff --git a/examples/manual/demo3d.sh b/examples/manual/demo3d.sh
new file mode 100644
index 0000000..94b22ed
--- /dev/null
+++ b/examples/manual/demo3d.sh
@@ -0,0 +1,3 @@
+pyxbgen \
+ -u po3.xsd -m po3 \
+ --archive-path .:+
diff --git a/examples/manual/demo4.sh b/examples/manual/demo4.sh
new file mode 100644
index 0000000..8fc69b9
--- /dev/null
+++ b/examples/manual/demo4.sh
@@ -0,0 +1,3 @@
+pyxbgen \
+ -u nsaddress.xsd -m address \
+ --archive-to-file address.wxs
diff --git a/examples/manual/demo4b.sh b/examples/manual/demo4b.sh
new file mode 100644
index 0000000..94b22ed
--- /dev/null
+++ b/examples/manual/demo4b.sh
@@ -0,0 +1,3 @@
+pyxbgen \
+ -u po3.xsd -m po3 \
+ --archive-path .:+
diff --git a/examples/manual/nsaddress.xsd b/examples/manual/nsaddress.xsd
index 6e33745..7920491 100644
--- a/examples/manual/nsaddress.xsd
+++ b/examples/manual/nsaddress.xsd
@@ -1,5 +1,56 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="URN:address"
- xmlns="URN:address">
- <xsd:include schemaLocation="file:address.xsd"/>
+<xsd:schema
+ targetNamespace="URN:address"
+ xmlns:tns="URN:address"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:complexType name="Address">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="street" type="xsd:string"/>
+ <xsd:element name="city" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="USAddress">
+ <xsd:complexContent>
+ <xsd:extension base="tns:Address">
+ <xsd:sequence>
+ <xsd:element name="state" type="tns:USState"/>
+ <xsd:element name="zip" type="xsd:positiveInteger"/>
+ </xsd:sequence>
+ <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="UKAddress">
+ <xsd:complexContent>
+ <xsd:extension base="tns:Address">
+ <xsd:sequence>
+ <xsd:element name="postcode" type="tns:UKPostcode"/>
+ </xsd:sequence>
+ <attribute name="exportCode" type="xsd:positiveInteger" fixed="1"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <xsd:simpleType name="USState">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="AK"/>
+ <xsd:enumeration value="AL"/>
+ <xsd:enumeration value="AR"/>
+ <xsd:enumeration value="AZ"/>
+ <!-- and so on ... -->
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- simple type definition for UKPostcode -->
+ <!-- *** pyxb mod: provide missing STD *** -->
+ <xsd:simpleType name="UKPostcode">
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="[A-Z]{2}\d\s\d[A-Z]{2}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
</xsd:schema>
diff --git a/examples/manual/po3.xsd b/examples/manual/po3.xsd
index 0c312c6..5bf67b8 100644
--- a/examples/manual/po3.xsd
+++ b/examples/manual/po3.xsd
@@ -1,5 +1,6 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:address="URN:address">
+ <xsd:import namespace="URN:address" schemaLocation="nsaddress.xsd"/>
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:element name="comment" type="xsd:string"/>
<xsd:complexType name="PurchaseOrderType">