Since Camel 2.15

Schematron is an XML-based language for validating XML instance documents. It is used to make assertions about data in an XML document and it is also used to express operational and business rules. Schematron is an[ISO Standard]. The schematron component uses the leading implementation of ISO schematron. It is an XSLT based implementation. The schematron rules is run through four XSLT pipelines, which generates a final XSLT which will be used as the basis for running the assertion against the XML document. The component is written in a way that Schematron rules are loaded at the start of the endpoint (only once) this is to minimise the overhead of instantiating a Java Templates object representing the rules.

URI format


URI options

The Schematron component has no options.

The Schematron endpoint is configured using URI syntax:


with the following path and query parameters:

Path Parameters (1 parameters):

Name Description Default Type


Required The path to the schematron rules file. Can either be in class path or location in the file system.


Query Parameters (4 parameters):

Name Description Default Type

abort (producer)

Flag to abort the route and throw a schematron validation exception.



rules (producer)

To use the given schematron rules instead of loading from the path


synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).



uriResolver (advanced)

Set the URIResolver to be used for resolving schematron includes in the rules file.


Spring Boot Auto-Configuration

When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

  <!-- use the same version as your Camel core version -->

The component supports 2 options, which are listed below.

Name Description Default Type


Enable schematron component




Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.




Name Description Type In/Out


The schematron validation status: SUCCESS / FAILED




The schematrion report body in XML format. See an example below



URI and path syntax

The following example shows how to invoke the schematron processor in Java DSL. The schematron rules file is sourced from the class path:


The following example shows how to invoke the schematron processor in XML DSL. The schematrion rules file is sourced from the file system:

   <from uri="direct:start" />
   <to uri="schematron:///usr/local/sch/schematron.sch" />
   <log message="Schematron validation status: ${in.header.CamelSchematronValidationStatus}" />
         <simple>${in.header.CamelSchematronValidationStatus} == 'SUCCESS'</simple>
         <to uri="mock:success" />
         <log message="Failed schematron validation" />
         <to uri="mock:failure" />
Where to store schematron rules? Schematron rules can change with business requirement, as such it is recommended to store these rules somewhere in file system. When the schematron component endpoint is started, the rules are compiled into XSLT as a  Java Templates Object. This is done only once to minimise the overhead of instantiating Java Templates object, which can be an expensive operation for large set of rules and given that the process goes through four pipelines of[XSLT transformations]. So if you happen to store the rules in the file system, in the event of an update, all you need is to restart the route or the component. No harm in storing these rules in the class path though, but you will have to build and deploy the component to pick up the changes.

Schematron rules and report samples

Here is an example of schematron rules

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="">
   <title>Check Sections 12/07</title>
   <pattern id="section-check">
      <rule context="section">
         <assert test="title">This section has no title</assert>
         <assert test="para">This section has no paragraphs</assert>

Here is an example of schematron report:

<?xml version="1.0" encoding="UTF-8"?>
<svrl:schematron-output xmlns:svrl=""
 xmlns:xsd="" schemaVersion="" title="">

   <svrl:active-pattern document="" />
   <svrl:fired-rule context="chapter" />
   <svrl:failed-assert test="title" location="/doc[1]/chapter[1]">
      <svrl:text>A chapter should have a title</svrl:text>
   <svrl:fired-rule context="chapter" />
   <svrl:failed-assert test="title" location="/doc[1]/chapter[2]">
      <svrl:text>A chapter should have a title</svrl:text>
   <svrl:fired-rule context="chapter" />
Useful Links and resources * Introduction to Schematron by Mulleberry technologies. An excellent document in PDF to get you started on Schematron. * Schematron official site. This contains links to other resources