Ian's books |
CPU Magazine
XML Schema Part 6:Breaking Schemas into Parts
As described in the December 2004 issue of
CPU - Computer Power User
magazine.
Examples
A) Downloadable ZIP File
-
There are several examples here -- why not download the whole lot
as a ZIP file -- dec04.zip -- and install
them on your own machine?
B) The example XML documents
To play with these documents, simply load them into an XML or XML schema editor and
test them for validity, or load them into a browser and view the results. Some editors will
test for validity automatically as the file is loaded, while others will require
that you select to validate.
- Include Example:
An example schema file (productOrders.xsd) that uses the XML
Schema include mechanism to include to two other schemas
(customers.xsd,
(products.xsd). All three schema files employ the same target
namespace (http://www.orderforms.org). The XML document
example.xml validates against this schema.
(Plain text versions:
productOrders.txt, customers.txt,
products.txt, example.txt )
- Chameleon Include:
An example schema file (productOrders-chameleon.xsd) that uses the XML
Schema include mechanism to include to two other schemas
(customers-no-ns.xsd,
(products-no-ns.xsd). All three schema files employ the same target
namespace (http://www.orderforms.org). The XML document
example-chameleon.xml validates against this schema.
(Plain text versions:
productOrders-chameleon.txt,
customers-no-ns.txt,
products-no-ns.txt,
example-chameleon.txt )
- Importing From Another Namespace:
An example schema file (productOrders-import.xsd) that uses the XML
Schema include mechanism to include to two other schemas
(customers-ns.xsd,
(products-ns.xsd). All three schema files employ the same target
namespace (http://www.orderforms.org). The XML document
example-ns.xml validates against this schema.
(Plain text versions:
productOrders-import.txt,
customers-ns.txt,
products-ns.txt,
example-ns.txt )
C) Some XML Editors with Validation Features
See the listing provided in the March 2004 CPU article (http://www.iangraham.org/writing/cpu-articles/mar04/).
Also, Altovia provides a free 'Home use' Version of their XML Spy XML editor. This editor has pretty good
diagnostic messages for XML schema errors, and can be a useful tool for learning about XML schema. The package
is available form Altovia at
http://www.xmlspy.com/download_spy_home.html.