W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2003

Re: MSXML Validation Fails - Error 1072898035

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 9 Sep 2003 16:51:58 +0100
Message-ID: <38-2114838637.20030909165158@jenitennison.com>
To: "EVANGELISTA Luca" <luca@webmediastrategy.com>
Cc: xmlschema-dev@w3.org

Hi Luca,

> While validating this file with XMLSpy I've no errors, but if I try
> to import the file with MSXML this error is returned:
> Error : -1072898035
> Line/Col: 2/218
> The element 'catalogue' is used but not declared in the DTD/Schema.
> Probably it could be a MSXML 4.0 bug... Could you help me to resolve
> it?

Actually, if XML Spy isn't giving you errors, then it's a bug in XML
Spy. Your schema isn't valid: in the complex type definition for the
<catalogue> element, you have:

      <xs:element name="song">
      <xs:element name="song">

Here, the two <song> elements have different types, and you're not
allowed to have that in a single content model in XML Schema.

If you changed the element declaration for the <catalogue> element to:

  <xs:element name="catalogue">
      <xs:sequence maxOccurs="unbounded">                                
        <xs:element name="song">                                                        
              <xs:element name="barcode" type="barcodeType"/>
              <xs:element name="volume" type="xs:positiveInteger"/>
              <xs:element name="track" type="xs:positiveInteger"/>
              <xs:element name="title" type="notNullStringType"/>
              <xs:element name="duration" type="xs:time"/>
              <xs:element name="price" type="xs:decimal"/>
              <xs:sequence minOccurs="0">
                <xs:element name="previewExpirationDate" type="xs:date"/>
                <xs:element name="previewPrice" type="xs:decimal"/>
            <xs:attribute name="ISRC" type="ISRCType" use="optional"/>
            <xs:attribute name="streaming30" type="xs:boolean" use="required"/>
            <xs:attribute name="preview" type="xs:boolean"/>

then your schema would be valid. With this element declaration, both
Xerces-J and MSXML give no errors for the instance that you provided.

I know that this schema isn't exactly the same as what you wanted,
because you want to express the co-occurrence constraint that the
'preview' attribute controls whether the <previewExpirationDate> and
<previewPrice> elements are present or not, but I'm afraid that it's
the closest that you can get with XML Schema. If you need stricter
validation, you need to add some Schematron validation, or switch to

Of course you might still get an error with MSXML, for example if it
can't locate the schema, but I suspect that it was just complaining
because it couldn't locate a *valid* schema for the element (and not
giving you a very helpful error message).


Jeni Tennison
Received on Tuesday, 9 September 2003 11:52:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:13 UTC