[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Perplexing Invalid Schema

  • From: Timothy Cook <timothywayne.cook@gmail.com>
  • To: "xml-dev@lists.xml.org\"" <xml-dev@lists.xml.org>
  • Date: Tue, 11 Sep 2012 10:50:11 -0300

Perplexing Invalid Schema
Hi All,

Using Oxygen XML Editor 14 I get this error from Saxon-EE:

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

This is from a simplified example of my real application; so it is
easier to see.

I have a base schema rm-test.xsd and a constraint schema ccd-test.xsd
The two schemas and the instance are included below.

Here are a couple of images of a logical model for the two schemas.
They may or may not help.

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

rm-test.xsd
=====================================
<?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>

=====================================

ccd-test.xsd
=====================================
<?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>

=====================================

instance1.xml
=====================================
<?xml version="1.0" encoding="UTF-8"?>
<CCD1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="file:/home/tim/MLHIM/mlhim-specs/schemas/ccd-test.xsd">
    <defin>
        <L-data>My L string.</L-data>
        <I-data>
            <A-data>My A string.</A-data>
            <dt-data>A dt string.</dt-data>
        </I-data>
    </defin>
</CCD1>

=====================================





-- 
============================================
Timothy Cook, MSc           +55 21 94711995
MLHIM http://www.mlhim.org
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
Academic.Edu Profile: http://uff.academia.edu/TimothyCook


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.