Thursday, June 1, 2017

XPath 2.0 atomization in XML Schema 1.1 validation

XPath 2.0 atomization as a concept, as applicable to XML Schema 1.1 validation is worth looking at. I would like to ponder on this in this post, with a brief example.

Consider the following brief XML Schema 1.1 validation example.

XSD 1.1 document:

<?xml version="1.0"?>
<xs:schema xmlns:xs="">
   <xs:element name="X">
            <xs:element name="a" type="xs:integer"/>
            <xs:element name="b" type="xs:integer"/>
         <xs:assert test="a gt b"/>

XML document that is fed to the XML Schema 1.1 validator, when validating with the above XSD document:

<?xml version="1.0"?>

This XML document fails validation, because "a" is less than "b". Now what is XPath 2.0 atomization, as for in this example that I want to talk about?

Since the XML document has been validated with the mentioned XSD, while building the XPath tree to apply <assert>, the nodes of the tree are annotated (or decorated) with the XSD types as mentioned in the XSD document. Therefore, the <assert> XPath 2.0 expression "a gt b", comes with runtime availability of the corresponding XSD types on <assert> tree nodes for "a" and "b". In XPath 2.0 terms, the <assert> tree nodes for "a" and "b" have been atomized. The Schema aware XPath 2.0 in action, is same in <assert> as in the generic Schema aware XPath 2.0 processor.

The XSD 1.1 processor that I've used for this example is located at

1 comment:

Anton Udovychenko said...
This comment has been removed by the author.