W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2012

Invoking schema validation processors

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Tue, 10 Jan 2012 10:14:39 -0500
Message-Id: <7.0.1.0.2.20120110100602.022a7fa0@CraneSoftwrights.com>
To: xmlschema-dev@w3.org
Hi, folks!  And happy new year!

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.

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 15:15:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 10 January 2012 15:15:41 GMT