All about Schematron
Intro - what is it, how to use it (Schematron.NET, Topologi)
Rick Jelliffe created Schematron in 1999. Only DTDs and XDR at that time.
Rules-based validation.
Assertions are defined in XPath.
Schematron has a natural upgrade path to the upcoming XPath 2.0
Ref impl. in XSLT (designed to be trivial in XSLT)
Schematron.NET using System.Xml and System.Xml.XPath
Six simple elements, one optional:
Assert and Report
Assert detects absence, Report detects presence
Content is a natural language message if the assert or report test fails
Rule - group of asserts and reports (assert y reports per Daniel's slides)
Flexible execution context - each rule can specify xpath expressions to define the context, e.g. order[count(items) > 100]
Pattern == logical grouping of rules
Schema - contains title and namespace (ns) elements
Namespace elements define prefixes used in xpath expressions
"I still don't like it, but whatever, I did not create the spec..."
XSLT ref impl: meta-stylesheet - transforms schema into another xslt, then run against instance documents
SoapExtension comes with Schematron.NET (there is a sample with the source)
xml-dev list - schema (xsd) validation - either valid or not. Not so with Schematron.
Supports phases for document workflow definition - as a document grows over its workflow lifecycle, different phases may be used to validate. e.g. different validation stages apply during different stages in the life of the document. As a hypothetical, in a mortgage application, you have to have a property appraisal to get a loan. But you need a credit check first, so the property appraisal can be the document equivalent of NULL when the credit check is validated, but it is added later.
What's wrong with XSD?
- allowed axis: parent-child, sibling
- data/message oriented, structured information
- co-occurrence constraints
-- sibling content: elements and attributes
-- mutual exclusion
-- attribute value exclusion
- context dependent content model
from attribute presence or content
attribute type from element content
XSD extensibility: <annotation> y <appinfo>
Allows embedding schematron elements inside of XSD -- proposal from [he thinks] Eric Van der List.
Requires a schematron aware parser
Future:
Part 3, Rule based validation (RelaxNG as grammar language)
Framework with profiles
Abstract patterns, inclusion
Seamless integration with EXSLT and XPath 2.0
.NET v3? XQuery as the implementation?
[I like schematron, btw)
Comments