How to return Schematron validation results in a structured way

I have created several Schematron statements and all of them work fine against my XML instances. Nevertheless, I would like to structure the output of my error messages in such a way that later I can process them, for example, using Java.

The output of my approval error message should be

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

However, a design 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 to return Schematron to a structured (XML-ified) manner?

+3
source share
3 answers

Actually, to get a Schematron report as XML, you must use SVRL. Learn more about this here: Schematron Validation Report Language (SVRL)

SVRL , , / XPath.

+1

Schematron . ( ) . :

. , , .

<diagonstic> ( < a > ) ID/IDREF.

, G .

+1

You can also use your own schematic mechanism rather than the XSL stylesheet to determine if statements are satisfied. I am working with one for .NET / C # here .

0
source

All Articles