Re: Invoking schema validation processors

On 10/01/2012 15:14, G. Ken Holman wrote:
> Hi, folks!  And happy new year!
And to you, Ken
>
> Can anyone help me with the invocations of Xerces and Altova W3C 
> Schema validation?  These processors are reporting problems with valid 
> XML documents and I'm hoping that with the right incantations I'll get 
> rid of the error messages.
>
> If I don't use external parsed general entities, everything is fine.  
> When I do, the processors are expecting to find element DTD 
> declarations that do not exist.
I suspect that some parsers interpret the presence of a <DOCTYPE> 
declaration as an instruction to perform DTD validation, and that most 
of your problems here are that you don't actually want DTD validation 
done. A lot of the confusion here seems to be that DTD validation and 
XSD validation are happening at the same time and the messages from both 
are getting mixed up.

Michael Kay
Saxonica
>
> A transcript is below.  I'm invoking Xerces using Norm's xjparse with 
> the "-S" option.  The "test3" example illustrates that for Xerces XSD 
> validation is detecting the bad content even while the processor 
> complains about the DTD declarations being missing ... which goes 
> farther than Altova.
>
> Thank you for any guidance anyone may have regarding invocations.
>
> . . . . . . . . . Ken
>
> T:\ftemp>type test.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   elementFormDefault="qualified">
> <xs:element name="doc">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="test"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> T:\ftemp>type test1.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <doc><test/></doc>
>
> T:\ftemp>w3cschema test.xsd test1.xml
> Xerces...
> No validation errors.
> Saxon...
> No validation errors.
> Altova...
> The XML data is valid.
>
> T:\ftemp>type test2.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE doc
>   [
> <!ENTITY test SYSTEM "test2.ent">
>   ]>
> <doc>&test;</doc>
>
> T:\ftemp>type test2.ent
> <?xml version="1.0" encoding="UTF-8"?>
> <test/>
>
> T:\ftemp>w3cschema test.xsd test2.xml
> Xerces...
> Attempting validating, namespace-aware parse
> Error:file:///T:/ftemp/test2.xml:6:6:Element type "doc" must be declared.
> Error:file:///T:/ftemp/test2.ent:2:8:Element type "test" must be 
> declared.
> Parse succeeded (0.250) with 2 errors and no warnings.
> Saxon...
> No validation errors.
> Altova...
> The XML data is invalid.
> No external markup declarations present - referenced entity '&test;' 
> must be declared.
>
> T:\ftemp>type test3.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE doc
>   [
> <!ENTITY test SYSTEM "test3.ent">
>   ]>
> <doc>&test;</doc>
>
> T:\ftemp>type test3.ent
> <?xml version="1.0" encoding="UTF-8"?>
> <testbad/>
>
> T:\ftemp>w3cschema test.xsd test3.xml
> Xerces...
> Attempting validating, namespace-aware parse
> Error:file:///T:/ftemp/test3.xml:6:6:Element type "doc" must be declared.
> Error:file:///T:/ftemp/test3.ent:2:11:Element type "testbad" must be 
> declared.
> Error:file:///T:/ftemp/test3.ent:2:11:cvc-complex-type.2.4.a: Invalid 
> content was found starting with element 'testbad'. One of '{test}' is 
> expected.
> Parse succeeded (0.340) with 3 errors and no warnings.
> Saxon...
> Validation error on line 2 column 11 of test3.ent:
>   In content of element <doc>: The content model does not allow 
> element <testbad> to appear
>   here. Expected: test (See 
> http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 2.4)
> Altova...
> The XML data is invalid.
> No external markup declarations present - referenced entity '&test;' 
> must be declared.
>
> T:\ftemp>
>
> -- 
> Contact us for world-wide XML consulting and instructor-led training
> Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
> Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
> G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
> Google+ profile: https://plus.google.com/116832879756988317389/about
> Legal business disclaimers:    http://www.CraneSoftwrights.com/legal
>
>
>

Received on Tuesday, 10 January 2012 16:04:37 UTC