Problem with xsd validation

This should cover W3C XML Schema, Relax NG and DTD related problems.
NicoU
Posts: 2

Problem with xsd validation

Fri Dec 11, 2015 1:00 pm

Hello,

I'm not able to valide 2 xsd file:

Image

The 2 xsd:

form_v1.xsd

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://spw.wallonie.be/services/form/messages/v1" version="1.0"
    xmlns:entnum="http://bced.wallonie.be/data/entity/enteprise/number/v1" xmlns:tns="http://spw.wallonie.be/services/form/messages/v1"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:import namespace="http://bced.wallonie.be/data/entity/enteprise/number/v1" schemaLocation="enterpriseNumber_v1.xsd"/>

    <xs:complexType name="GetPrefilledDataRequestType">
        <xs:sequence>
            <xs:element name="request">
                <xs:complexType>
                    <xs:sequence>
                        <xs:choice>
                            <xs:element name="enterpriseNumber" type="entnum:CbeEntityNumber"/>
                        </xs:choice>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:schema>



enterpriseNumber_v1.xsd

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://bced.wallonie.be/data/entity/enteprise/number/v1"
    vc:minVersion="1.1" version="1.1" xmlns:num="http://bced.wallonie.be/data/entity/enteprise/number/v1" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:simpleType name="CbeEntityNumber">
        <xs:restriction base="xs:long"/>
    </xs:simpleType>
</xs:schema>


Both xsd are in the same directory, when i crt+click on the "entnum:CbeEntityNumber", he open the enterpriseNumber_v1.xsd file.
Same probleme with Saxon, Xerces and Schematron validator.
I use oxygen 17.1
Other include works fine (but removed for the sample)

I can validate it with xmlspy.

Any idea why i get this error?

System ID: C:\Workspace\Schemas\exposed\xsd\services\flatten\form_v1.xsd
Main validation file: C:\Workspace\Schemas\exposed\services\flatten\form_v1.xsd
Engine name: Xerces
Severity: error
Description: src-resolve: Cannot resolve the name 'entnum:CbeEntityNumber' to a(n) 'type definition' component.
Start location: 13:70
End location: 13:94
URL: http://www.w3.org/TR/xmlschema-1/#src-resolve
adrian
Posts: 2337

Re: Problem with xsd validation

Mon Dec 14, 2015 9:29 pm

Hi,

The short story is this happens because you're importing a v1.1 XML schema in what is considered by Oxygen to be a v1.0 XML schema (unless the version is specified, Oxygen defaults to 1.0).
If you tag the main schema with vc:minVersion="1.1", it works as expected.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2337

Re: Problem with xsd validation

Tue Dec 15, 2015 11:32 am

Hi,

One thing I forgot to mention.
Alternatively, if you don't want to specify the version in the schema, you can change the default XML Schema version (considered when no version is specified in the schema itself) in the Oxygen options, Options > Preferences, XML > XML Parser > XML Schema, "Default XML Schema version".

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
NicoU
Posts: 2

Re: Problem with xsd validation

Tue Dec 15, 2015 7:36 pm

Perfect answer.

Thx u

Return to “XML Schemas”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest