Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I return Schematron validation results in a structured manner

Tags:

xml

schematron

I have created several Schematron assertations and they are all running fine against my XML instances. However, I would like to structure the output of my error messages in such a way, that I later can post-process them, with e.g., Java.

The output of my assertion error message should be

<error>
  <errorMessage>My error message</errorMessage>
  <violatingElement>The violating element</violatingElement>
</error>

However, a construct such as:

<pattern>
  <rule context="/p1:Document/p1:Delivery/p1:DeliveryDetails/p1:ShippingDate">
    <report test=".">
      <error>
       <errorMessage>My error message</errorMessage>
       <violatingElement>The violating element</violatingElement>
      </error>
    </report>
 </rule>
</pattern>

does not work. What is the correct way of returning Schematron results in a structured (XML-ified) manner?

like image 222
Philipp Avatar asked Dec 02 '25 03:12

Philipp


1 Answers

Actually to get a Schematron report as XML you should use SVRL. You can learn more about it here: Schematron Validation Report Language (SVRL)

The big advantage of using SVRL is that you can also get detailed information about where the assertion/report was triggered as an XPath.

like image 158
Clemens Avatar answered Dec 04 '25 01:12

Clemens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!