Help with xs:substitutionGroup and MSXML

V

Val Melamed

Hi all,

These days I'm playing with schemas and SOM from MSXML. To learn it I used
the excellent tutorial from Mr.Costello:
http://www.xfront.com/xml-schema.html. while working through the labs I
stumbled upon a problem with substitutionGroup-s (Lab 9).

Below you can find both the schema and a sample document to test it.
Unfortunately, MSXML doesn't like the document and ends up with an error:
"### <guarantee>lifetime warranty</guarantee>(11) error: Element content
is invalid according to the DTD/Schema." Can someone please take a look at
it and comment on the problem. May be I am doing something wrong here or
may be someone can confirm that this is MSXML validation bug.

Thank you!
Val Melamed

The schema:
-------------------------------------------------------------------------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.juicers.org"
xmlns="http://www.juicers.org"
elementFormDefault="qualified">
<xsd:element name="warranty" type="xsd:string"/>
<xsd:element name="guarantee" substitutionGroup="warranty"
type="xsd:string"/>
<xsd:complexType name="juiceAppliance">
<xsd:all>
<xsd:element name="description" type="xsd:string"/>
<xsd:element ref="warranty" minOccurs="0"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="image" type="imageType"/>
<xsd:element name="weight" minOccurs="0">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:positiveInteger">
<xsd:attribute name="units" type="xsd:string"
fixed="pounds"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="cost" minOccurs="0">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="money">
<xsd:attribute name="currency" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="USD"/>
<xsd:enumeration value="CAD"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="retailer" type="xsd:anyURI"/>
</xsd:all>
<xsd:attribute name="id" type="xsd:ID" use="required"/>
<xsd:attribute name="electric" type="xsd:boolean" use="required"/>
<xsd:attribute name="type" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="press"/>
<xsd:enumeration value="gear"/>
<xsd:enumeration value="centrifugal"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="juicers">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="juicer" type="juiceAppliance"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="money">
<xsd:restriction base="xsd:decimal">
<xsd:fractionDigits value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="imageType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(.)+\.(gif|jpg|jpeg|bmp)"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
-------------------------------------------------------------------------------
The document:
-------------------------------------------------------------------------------
<?xml version="1.0"?>
<juicers xmlns="http://www.juicers.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.juicers.org
C:\xml-schemas\labs\lab09\answer\juicers.xsd">
<juicer id="mighty-oj" electric="false" type="press">
<name>OJ Home Juicer</name>
<image>images\mighty_oj.gif</image>
<cost currency="USD">41.95</cost>
<description>There&apos;s just no substitute for a properly
squeezed orange in the morning. So delicate and refreshing. The finest
hotels use mechanical juicers of this type for their most discriminating
guests. This is the largest selling juicer of its kind. It&apos;s a
beautiful little all-metal piece in baked enamel and polished chrome; it
even won the Frankfurt Fair Award for its design. Uses no electricity and
produces no non-recyclable waste as do frozen juices.</description>
<guarantee>lifetime warranty</guarantee>
<retailer>http://www.thewhitewhale.com/oj.htm</retailer>
</juicer>
<juicer id="champion" electric="true" type="gear">
<cost currency="USD">239.00</cost>
<retailer>http://www.grainsandgreens.com/juicerparts.html</retailer>
<description>The Champion Juicer is the answer to every juicing
problem. Because it operates on the mastication process principle, the
Champion chews the fibers and breaks up the cells of vegetables and fruits.
This give you more fiber, enzymes, vitamins and trace minerals. The juice
will be a darker, richer color, with a sweeter, richer more full-bodied
flavor.</description>
<name>Champion Juicer</name>
<image>images\champion.gif</image>
</juicer>
<juicer id="green-power" electric="true" type="gear">
<name>Green Power Gold Juice Extractor</name>
<image>images\greenPower.jpg</image>
<description>You are not What You Eat, But What you Absorb. The
rate of absorption of juice has never been considered a factor in comparing
juicers. With the introduction of Green Power&apos;s magnetic Twin Gear
press, this has now changed. Experiments conducted by the Green Power Co.
Research and Development Dept. show the rate of absorption of green juice
using dual gear extraction is up to five times greater than using
centrifugal extraction.</description>
<cost currency="USD">459.99</cost>
<retailer>http://www.discountjuicers.com/greencomplete.html</retailer>
</juicer>
<juicer id="juiceman-jr" electric="true" type="centrifugal">
<description>The Juiceman Jr. juicer is the little brother to the
Juiceman II juicer that is seen on television. The Juiceman Jr. is a pulp
ejection juicer that allows you to juice continuously without having to stop
and clean the machine. Made popular by Jay Kordich, the Juiceman series of
juicers have been a popular addition to millions of households all across
this nation. This machine comes ready to use out of the box</description>
<warranty>1 yr. Limited Warranty </warranty>
<name>Juiceman Jr.</name>
<image>images\juiceman.jpg</image>
<weight>10</weight>
<cost currency="USD">82.00</cost>
<retailer>http://www.juicebars.com/juicers/jm1.htm</retailer>
</juicer>
<juicer id="omega" electric="true" type="centrifugal">
<description>This heavy-duty, American-made juicer has a powerful
GE motor that spins at 3,600 rpm to extract 20% - 30% more juice than pulp
ejector models (according to independent laboratory tests). Large capaciy
bowl hold a ful 1-2 quarts of fruits or vegetables - compared to just one
pint for many brands. Easy-cleaning design with lift out disposable
filter.</description>
<name>Omega Juicer</name>
<image>images\omega.jpg</image>
<cost currency="USD">234.00</cost>
<retailer>http://www.boschcanada.com/omega.htm</retailer>
</juicer>
<juicer id="wheateena" electric="true" type="gear">
<description>Wheatgrass juice contains 70% "crude" chlorophyll.
Chlorophyll by definition being the green pigment in plants. It is
considered the "blood" of plants, due to the similarity to our blood in
molecular structure. This juicer extracts the juice out of the blades of
wheatgrass. Normal fruit and vegetable juicers will not juice
wheatgrass</description>
<guarantee>Motor Guarantee: For Home Use: one (1) year. For
Commercial Use: six (6) months.</guarantee>
<name>Wheateena Wheatgrass Juicer</name>
<image>images\wheateena.jpg</image>
<weight>46</weight>
<cost currency="USD">639.99</cost>
<retailer>http://www.rawfoods.com/marketplace/heavyduty.html</retailer>
</juicer>
</juicers>

-------------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top