valid XSD schema but invalid TSD schema

Hello :wink:

I’m importing a .xsd in Tamino 4.4.1. When I validate the XML Schema there’s no problem, but when I try to validate or save the TSD schema, an error occurs:


(derivation-ok-restriction.5.3.2) The particle of the complex type derived via restriction does not satisfy the “Particle Valid (Restriction)” constraint with respect to the particle of the complex base type: constraint (NameAndTypeOK.7) has been violated - see Line 105, Column 11 and Line 135, Column 11 <INOXDE7931,INOXDE7657>

Are there different validators for the XSD and TSD schemas?

Thanks.

I forgot to include the XSD…
datatypes-base.xsd (38.4 KB)

Hi Carlos

indeed, there are two different schema validators:

  1. a Java-based schema validator used inside the schema editor
    (sorry, I do not know which one it is)
    It is used in
    Tools > Validate XML Schema

  2. a schema validator inside the Tamino server
    It is used in
    Database > Validate TSD Schema…
    and
    Database > Define Schema…

This issue illustrates that the two validators are not
completely consistent. Below, you’ll see, that 1) contains
some flaws…

The reported error is well-founded for the following reasons:

  • the complexType “ST” is derived by restriction from “ED”
    hence every particle in “ST” must be a valid restriction of
    a particle in “ED”

  • when looking at element “thumbnail” declared in both types
    you’ll find

    (ED)
    <xsd:element name = “thumbnail” type = “thumbnail”
    minOccurs = “0”></xsd:element>
    (ST)
    <xsd:element name = “thumbnail” type = “ED”
    minOccurs = “0” maxOccurs = “0”></xsd:element>

    Cardinality-wise, thumbnail(ST) is a valid restriction of thumbnail(ED),
    but the type “thumbnail” used in thumbnail(ED) is a restriction if “ED”
    being used in thumbnail(ST). As of the XML schema constraint, just the
    opposite constraint should be fulfilled.

Once you change the type of thumbnail(ST) to “thumbnail” (effectively this
does not change the schema, as the maxOccurs of thumbnail(ST) is 0),
you’ll run into another error. The definitions for the complex types
“CD” and “CE” contain a flaw, as “CE” which is derived by restriction
from “CD” uses a different order of elements “originalText” and
“qualifier” in a sequence:

<xsd:complexType name = “CD”>

<xsd:element name = “originalText” …
<xsd:element name = “qualifier” …
<xsd:element name = “translation” …

<xsd:complexType name = “CE”>
xsd:complexContent
<xsd:restriction base = “CD”>
xsd:sequence
<xsd:element name = “qualifier” …
<xsd:element name = “originalText” …
<xsd:element name = “translation” …
</xsd:sequence>

Once, this is aligned, the Tamino server will accept the schema without
any problem. I have attached the corrected schema.

Best regards
Uli
fixed_datatypes-base.xsd (38.4 KB)

Hello Uli:

Thanks for replying so fast. Your XML Schema lesson has been very useful to solve the problem. I’ve already imported the schema into Tamino correctly.

Thanks 4 all :wink:

Carlos.