W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2000

Re: [Moderator Action] Validation problem and deriving attributes

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 30 Nov 2000 11:04:38 +0000
To: "Holger Juschkewitz" <hjuschke@web.de>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bhf4p67qx.fsf@cogsci.ed.ac.uk>
"Holger Juschkewitz" <hjuschke@web.de> writes:

> why does the validation not fail if I validate obvisiously wrong
> schemas? I developed accidently the following (wrong) schema with
> defining a complex type with a type attribute.  Even though the
> (strict) validation succeeded. Shouldn't it report my error?

Sorry for slow reply, I've been on the road (at XML Schema meetings :-).

You haven't said which validator you were using, or how you invoked
it.  If you were using XSV, and you just checked whether yor schema
was schema-valid per the schema for schemas, then no errors _should_
be reported, because the constraint that a 'type' attribute is
incompatible with a 'complexType' child is not _in_ the schema for

If you try to _use_ this schema, XSV will report an error as follows:

<schemaError char='15' line='9' phase='schema'
resource='jusch.xsd'>declaration with 'type' attribute must not have
nested type  declaration</schemaError>

> Also, the validation doesn't report if I use undeclared types, like
> the attribute complex type would be missing in the above schema.

Same issue -- the validator doesn't know until you try to _use_ this
schema whether or not a definition of 'attribute' may be supplied from 
some other schema document.

> All I'm trying to do is to derive attributes and define the simple
> content of the derived type in the derived type. Is that possible at
> all?!?

Sure, if I've understood you correctly:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"

 <complexType name="attribute">
   <extension base="anySimpleType">
    <attribute name="isNullable" type="boolean" use="optional"/>
    <attribute name="isQueryable" type="boolean" use="optional"/>
    <attribute name="isUpdatable" type="boolean" use="optional"/>
 <element name="ShipmentNo">
       <restriction base="attribute">
          <restriction base="integer"/>

This is a tricky case, and there should probably be a section in the
Primer illustrating and explaining its use.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 30 November 2000 06:04:48 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC