Invalid Schema
Posted: Tue Sep 11, 2012 3:59 pm
This is essentially the same issue I had under the Invalid Restriction subject in this forum. However, I have created a smaller version of the two schemas as an easier way to look at the problem.
The base schema aka. reference model.
The constraint model:
Oxygen (Saxon-EE) gives this error:
http://www.hkcr.net/docs/tmp
If I generate an instance (using Oxygen) for ccd-test.xsd Of course Oxygen won't validate it because it says the schema is invalid.
xmllint and xmlstarlet both validate the instance against ccd-test.xsd
I was unable to discover how I might execute Saxon-EE outside of Oxygen. ???
The questions are:
1) are xmllint and xmlstarlet too forgiving?
2) is there an issue with Saxon?
3) is there an issue with Saxon inside Oxygen?
4) am I just totally missing something obvious?
Thanks,
Tim
The base schema aka. reference model.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="Any" abstract="true">
<xs:sequence>
<xs:element name="A-data" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DT1">
<xs:complexContent>
<xs:extension base="Any">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="DT1-1">
<xs:complexContent>
<xs:extension base="DT1">
<xs:sequence>
<xs:element name="dt-data" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Locate" abstract="true">
<xs:sequence>
<xs:element name="L-data" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Definition" abstract="true">
<xs:complexContent>
<xs:extension base="Locate">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Item" abstract="true">
<xs:complexContent>
<xs:extension base="Definition">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Item1">
<xs:complexContent>
<xs:extension base="Item">
<xs:sequence>
<xs:element name="I-data" type="Any"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Entry" abstract="true">
<xs:complexContent>
<xs:extension base="Definition">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Entry1">
<xs:complexContent>
<xs:extension base="Entry">
<xs:sequence>
<xs:element name="E-data" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ccdType">
<xs:sequence>
<xs:element name="defin" type="Locate"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:include schemaLocation="rm-test.xsd"/>
<xs:element name="CCD1" type="Y"/>
<xs:complexType name="Y">
<xs:complexContent>
<xs:restriction base="ccdType">
<xs:sequence>
<xs:element name="defin" type="Z"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Z">
<xs:complexContent>
<xs:restriction base="Item1">
<xs:sequence>
<xs:element name="L-data" type="xs:string" fixed="My L string."/>
<xs:element name="I-data" type="X"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="X">
<xs:complexContent>
<xs:restriction base="DT1-1">
<xs:sequence>
<xs:element name="A-data" type="xs:string" fixed="My A string."/>
<xs:element name="dt-data" type="xs:string" fixed="A dt string."/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Here are a couple of images of a logical model for the two schemas. They may or may not help.F [Saxon-EE 9.4.0.3] The content model of the complex type Z is not a valid restriction of the content model of the type Item1. Definition of element I-data differs between the restricted type and the base type. Type of element in restricted content model is not validly derived from the type of the corresponding element in base content model
http://www.hkcr.net/docs/tmp
If I generate an instance (using Oxygen) for ccd-test.xsd Of course Oxygen won't validate it because it says the schema is invalid.
xmllint and xmlstarlet both validate the instance against ccd-test.xsd
I was unable to discover how I might execute Saxon-EE outside of Oxygen. ???
The questions are:
1) are xmllint and xmlstarlet too forgiving?
2) is there an issue with Saxon?
3) is there an issue with Saxon inside Oxygen?
4) am I just totally missing something obvious?
Thanks,
Tim