Possible Bug with XML Schema 1.1 override

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
fsteimke
Posts: 58
Joined: Tue Jan 01, 2013 3:19 pm

Possible Bug with XML Schema 1.1 override

Post by fsteimke » Mon Feb 15, 2021 12:57 am

Hi,

I have to use the XSD Schema 1.1 feature xs:override for the first time, and found something that looks like a bug. The real use Case deals with a complex ebXML Schema construct (XML Schema 1.0). For the purpose of demonstration i have two very simple Schema files.

The first one has no versioning attributes in the Namespace http://www.w3.org/2007/XMLSchema-versioning . It is called Base.xsd and defines the global root Element with child Elements called child

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://demo.com" xmlns:tns="http://demo.com">

    <xs:element name="root">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" name="child" type="xs:token"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
The second Schema File called Overriding.xsd is of Version 1.1. I overrides the root Element from Base.xsd, so that child Elements are called subelement.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified"
    vc:minVersion="1.1" targetNamespace="http://demo.com" xmlns:tns="http://demo.com">

    <xs:override schemaLocation="Base.xsd">
        <xs:element name="root">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="subelement" maxOccurs="unbounded" type="xs:positiveInteger"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:override>
</xs:schema>
What happens is that when i validate the Overriding Schema File with XERCES as Default Schema Validation Engine, the schema File is valid;

But when i validate the same Overriding Schema File with Saxon EE, i get the following Error:
System ID: /home/frank/override.xsl
Main validation file: /home/frank/test/Overriding.xsd
Engine name: Saxon-EE 9.9.1.7
Severity: error
Description: <xs:schema> must be the outermost element in a schema document

It is most interesting, that the Resource / System ID says "/home/frank/override.xsl", although there is no such file.

This happens in Oxygen 23 build 2020111805 on Linux.

Thanks in Advance,
Frank

tavy
Posts: 276
Joined: Thu Jul 01, 2004 12:29 pm

Re: Possible Bug with XML Schema 1.1 override

Post by tavy » Mon Feb 15, 2021 8:15 pm

Hello,

Thanks for your feedback.
There is a problem with the Saxon validation, I already reported this problem at Saxon, and they fixed it. Here is the Saxon issue: https://saxonica.plan.io/issues/4518
We need to update the default Saxon library in Oxygen, probably in the next Oxygen major release.

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply