XML schema validation allows space character (blank) In xs:decimal type

(Doc ID 1942160.1)

Last updated on NOVEMBER 05, 2014

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.3 to 12.1.0.2 [Release 11.2 to 12.1]
Information in this document applies to any platform.

Symptoms

Given the following sample XML schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://testschemavalidation.com" xmlns:wb="http://testschemavalidation.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://testschemavalidation.com" elementFormDefault="unqualified" attributeFormDefault="unqualified">
    <xs:simpleType name="anzahl">
        <xs:annotation>
            <xs:documentation>Anzahl</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:decimal">
            <xs:fractionDigits value="2"/>
            <xs:totalDigits value="11"/>
            <xs:minInclusive value="0"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element name="decimalValues">
        <xs:annotation>
            <xs:documentation>space Validation</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element name="value" type="anzahl"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


And XML instance document:

<?xml version="1.0" encoding="UTF-8"?>
<wb:decimalValues xsi:schemaLocation="http://testschemavalidation.com spaceValidation.xsd" xmlns:wb="http://testschemavalidation.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <value>0</value>
    <value>1</value>
    <value>2</value>
    <value> </value>
</wb:decimalValues>


Schema validation does not raise an error and allows a blank space character in xs:decimal type:

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms