RE: Getting validation errors when using derived types

Sigh!
A simple fix, I knew I was missing something...

Which of the parsers do you find most useful when
using XML Schema: Sun JAXP or Apaache parsers, or other?

thanks Priscilla

>-----Original Message-----
>From: Priscilla Walmsley [mailto:priscilla@walmsley.com]
>Sent: Tuesday, July 16, 2002 9:27 AM
>To: Wise, Bowden (Research)
>Cc: xmlschema-dev@w3.org
>Subject: RE: Getting validation errors when using derived types
>
>
>Hi,
>
>You need to set the generic validation feature in addition to 
>the schema
>validation feature.  So, you need to add the line:
>
>      parser.setFeature (VALIDATION_FEATURE_ID,    true);
>
>where you set the other features in the parseXSAX and 
>parseXDOM methods.
>
>
>Priscilla
>
>-----------------------------------------------------
>Priscilla Walmsley             priscilla@walmsley.com
>Author, Definitive XML Schema     (Prentice Hall PTR)
>----------------------------------------------------- 
>
>> -----Original Message-----
>> From: Wise, Bowden (Research) [mailto:wisegb@crd.ge.com] 
>> Sent: Tuesday, July 16, 2002 9:22 AM
>> To: 'Priscilla Walmsley'
>> Cc: 'xmlschema-dev@w3.org'
>> Subject: RE: Getting validation errors when using derived types
>> 
>> 
>> Hi Priscilla:
>> 
>> Thanks for your reply... 
>> 
>> You are correct about warning, note, caution being undefined.
>> I removed those elements from my document instance
>> 
>> I have attached an XML instance and the XSD.
>> 
>> I am finding that errors are detected when using JAXP
>> parser, but Xerces2 SAXParser and DOMParser are NOT detecting
>> the error?  What am I missing, see my sample Java code. 
>> 
>> 
>> 
>> >-----Original Message-----
>> >From: Priscilla Walmsley [mailto:priscilla@walmsley.com]
>> >Sent: Tuesday, July 16, 2002 9:09 AM
>> >To: Wise, Bowden (Research); xmlschema-dev@w3.org
>> >Subject: RE: Getting validation errors when using derived types
>> >
>> >
>> >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:32:02 UTC