XML Schema Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 4.00

Built-in Datatype - "decimal" Errors

This section describes a tutorial example on validation errors against decimal restriction facets.

In the previous section, we created a schema using "decimal" datatype with different restriction facets. Now we are going to create an XML document, decimal_datatype_error.xml, with several validation errors:

<?xml version="1.0"?>
<orderLine
 quantity="1003"
 price="19.9999"
 subTotal="9.99"
/>

Here is the output of XsdSchemaValidator.java:

>java" XsdSchemaValidator decimal_datatype.xsd
   decimal_datatype_error.xml

Error:
   Line number: 6
   Column number: 3
   Message: cvc-maxInclusive-valid: Value '1003' is not facet-valid
   with respect to maxInclusive '1000' for type 
   '#AnonType_quantityorderLine'.

Error:
   Line number: 6
   Column number: 3
   Message: cvc-attribute.3: The value '1003' of attribute 
   'quantity' on element 'orderLine' is not valid with respect to 
   its type, 'null'.

Error:
   Line number: 6
   Column number: 3
   Message: cvc-fractionDigits-valid: Value '19.9999' has 4 
   fraction digits, but the number of fraction digits has been
   limited to 2.

Error:
   Line number: 6
   Column number: 3
   Message: cvc-attribute.3: The value '19.9999' of attribute 
   'price' on element 'orderLine' is not valid with respect to 
   its type, 'null'.

Error:
   Line number: 6
   Column number: 3
   Message: cvc-minInclusive-valid: Value '9.99' is not facet-valid
   with respect to minInclusive '10.01' for type 
   '#AnonType_subTotalorderLine'.

Error:
   Line number: 6
   Column number: 3
   Message: cvc-attribute.3: The value '9.99' of attribute 
   'subTotal' on element 'orderLine' is not valid with respect to 
   its type, 'null'.

Failed with errors: 6

Sections in This Chapter

Overview of XML Schema Built-in Datatypes

List of Built-in Datatypes

Deriving from Built-in Datatypes - simpleType

Built-in Datatype - "string"

Built-in Datatype - "string" Errors

Built-in Datatype - "dateTime"

Built-in Datatype - "dateTime" Errors

Built-in Datatype - "decimal"

Built-in Datatype - "decimal" Errors

Dr. Herong Yang, updated in 2007
Built-in Datatype - "decimal" Errors