W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

RE: Getting validation errors when using derived types

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Tue, 16 Jul 2002 09:08:37 -0400
To: "'Wise, Bowden \(Research\)'" <wisegb@crd.ge.com>, <xmlschema-dev@w3.org>
Message-ID: <003a01c22cc9$e660afe0$339afea9@WALMSLEYPH>

Hi,

It's failing on the elements caution, note, consumable and warning, and
I don't see where those elements are declared.  Are they declared in
another schema that you didn't include?

If the Xerces parsers are not giving you an error, perhaps you did not
turn schema validation on?  You need to set two features: one for
validation and one for schema validation.
(http://xml.org/sax/features/validation and
http://apache.org/xml/features/validation/schema).

Hope that helps!
Priscilla

-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
----------------------------------------------------- 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Wise, 
> Bowden (Research)
> Sent: Tuesday, July 16, 2002 8:54 AM
> To: 'xmlschema-dev@w3.org'
> Subject: Getting validation errors when using derived types
> 
> 
> 
> Hi
> 
> I have defined a schema that that includes a variable content 
> container. A <results>
> element has been defined to include a sequence of <result> 
> (abstract), depending
> on the application there may be one or more derived classes 
> from <result>
> using xsd:extension.  
> 
> I am finding that when I run an XML instance through the JAXP 
> validating 
> parser, I get errors telling me that the derived elements are 
> invalid content.
> When I use Xerces DOM or SAX parsers directly, no errors are reported
> even if I include an invalid tag never defined inside of a 
> <results> element.
> 
> Do schema valdiating parsers recognize derived classes??  See 
> the errors
> below when using JAXP parser (from DocumentBuilder).  
> 
> I was hoping to be able to validate my document instances based on
> a schema that uses derived classes, is this not possible?
> 
> I enclose my schema files below, any suggestions, insights welcome
> 
> - smgtglf-base.xsd (base class defines <results>)
> - ResultType.xsd   (defines <result> as abstract)
> - TaskTimeType.xsd (defines <tasktime> as extension of <result>)
> - ToolType.xsd (defines <tool> as extension of <result>
> - mtatglf.xsd (all of above)
> 
> - OilFilterElement-tglf-new.xml (instance using mtatglf.xsd schema)
> 
> 
> SAX Parsing C:\develop\mta\web\test1\OilFilterElement-tglf-new.xml
> SAX Parsed
> DOM Parsing C:\develop\mta\web\test1\OilFilterElement-tglf-new.xml
> DOM Parsed
> JAXP Parsing C:\develop\mta\web\test1\OilFilterElement-tglf-new.xml
> ERROR: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 
> Invalid content st
> arting with element 'caution'. The content must match 
> '("":result){0-UNBOUNDED}'
> . at  line=59 col=27 pubid=null sysid=null
> ERROR: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 
> Invalid content st
> arting with element 'note'. The content must match 
> '("":result){0-UNBOUNDED}'. a
> t  line=78 col=24 pubid=null sysid=null
> ERROR: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 
> Invalid content st
> arting with element 'consumable'. The content must match 
> '("":result){0-UNBOUNDE
> D}'. at  line=101 col=59 pubid=null sysid=null
> ERROR: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: 
> Invalid content st
> arting with element 'warning'. The content must match 
> '("":result){0-UNBOUNDED}'
> . at  line=112 col=27 pubid=null sysid=null
> JAXP Parsed
>  <<smgtglf-base.xsd>>  <<OilFilterElement-tglf-new.xml>>  
> <<ResultType.xsd>>  <<mtatglf.xsd>>  
> <<TaskTimeType.xsd>>  <<ToolType.xsd>> 
> > Bowden
> > g GE Global Research Center 
> > 
> ______________________________________________________________
> _____________________________________
> > ________________
> G. Bowden Wise
> mailto:wisegb@research.ge.com
> Information and Decision Technologies
> GE Global Research Center
> Building K1, Room 5B2C
> PO Box 8                            | One Research Circle
> Schenectady, NY 12301       | Niskayuna NY 12309
> Phone: 518-387-7833           | Fax: 518-387-6104
> 
> 
> 
> 
Received on Tuesday, 16 July 2002 09:10:23 UTC

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