validate:xsd-report() is not emitting warnings
Monday, 3 June 2024 · 2 messages · last reply 5 Jun 2024
Y
ykhabins3 Jun 2024 19:05 #
Hello,
I am using BaseX 11.0 beta build 587d1ca and Xerces 2.12.2 for the XSD 1.1 validation.
It looks like that
validate:xsd-report() call is not emitting warnings.
Though Oxygen XML IDE shows the following upon validation:
For simpleType definition '#AnonType_ADDR_TYPE', the enumeration value '' contradicts with value of 'length' facet.
Warning.xq
===========
declare variable $xml as xs:string external;
declare variable $xsd as xs:string external;
let $result := validate:xsd-report($xml, $xsd, map {
'http://apache.org/xml/features/validation/cta-full-xpath-checking': true(), 'cache': false() })
return $result
It returns the following:<report>
<status>valid</status>
</report>But it should be as follow:
<report>
<status>valid</status>
<message level="Warning" line="..." column="..." url="...">Warning
message</message>
</report>XML/XSD pair to reproduce the behavior.
Warning.xml
============
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Warning.xsd">
<ADDR_TYPE>B</ADDR_TYPE>
</root>
Warning.xsd
============
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="ADDR_TYPE"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ADDR_TYPE">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="1"/>
<xs:enumeration value="">
<xs:annotation>
<xs:documentation>NOT SELECTED</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="B"/>
<xs:enumeration value="S"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>Regards,
Yitzhak Khabinsky
CG
Christian Grün5 Jun 2024 09:43 #
Hi Yitzhak,
Though Oxygen XML IDE shows the following upon validation:
Quoted text · ykhabins · 2 lines
> For simpleType definition '#AnonType_ADDR_TYPE', the enumeration value '' > contradicts with value of 'length' facet.
The warning is not shown as it occurs before the actual validation (i.e, while the schema is compiled). I’ve changed this behavior: With the latest snapshot, schema warnings are considered as well [1].
Best,
Christian
[1] https://files.basex.org/releases/latest/
Written for BaseX 10.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery