Ian's books |
CPU Magazine
XML Schema Part 2: Global and Local Types
As described in the August 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 -- aug04.zip -- and install
them on your own machine?
B) The example XML documents
To play with these documents, simply load them into an XML 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.
- all-global.xsd : (plain text version: all-global.txt)
Schema file from last month,with all elements and attributes declared globally. This should be contrasted
with all-local.xsd
(next item) in which all elements and attributes (except for the root element)
are declared locally.
- all-local.xsd : (plain text version: all-local.txt)
An XML schema document equivalent to the above, except that all elements and attributes (except for the root
element) are declared locally.
- globalAndLocal.xsd --
(plain text version: globalAndLocal.txt)
The example schema document from the article, which uses both global and local definitions for comments elements
inside the declaration for item elements. The following are some example XML documents: all but the latter are
consistent with this schema.
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/).