Questions tagged [schematron]

Schematron is a structural, rule-based validation language for XML documents. It uses XPath and XSLT to validate rules most other schemas can not.

Schematron is a rule-based validation language for XML documents. Schematron allows one to model complex relationships in XML content and to formulate rules that most other schema languages do not support. Schematron is not often used alone but is usually used along with another schema language. In this case, the other language is used to validate the grammar of the XML model and schematron is used to validate business rules.

One of its most powerful mechanisms is sch:assertion, that allows the author of the schema to assert arbitrary XPath expressions and report any content where this assertion failed. To date, XML Schema 1.1 is the only other schema language that supports assertions (while DTD, XML Schema 1.0 and RNG do not).

Although implementations exist that work directly with schematron schemas, the canonical model is to first transform the schema into an style sheet using stylesheets available at the schematron home page which can then be used to validate the input document by transforming it into Schematron Validation Report Language (SVRL), a language used for reporting the results of a schematron validation. Many of the implementations that work directly with schematron follow this canonical model internally.

An additional and highly positive feature of schematron is that the schema writer is free to write their own validation messages. This allows schematron to generate very clear explanatory error messages, a feature missing from other schema languages.

It was invented by Rick Jelliffe and is an ISO Standard. In addition to the main language, the same ISO standard defines the SVRL language used for reporting results of validations.

For a more thorough introduction to Schematron Erik Siegel's book "Schematron: A language for validating XML" might help.

255 questions
11
votes
1 answer

XML validation with Schematron/XSD in C#

I've been looking around for at a way to make some more advanced business rule validation of XML documents. So far Schematron seems to be able to do, what I need. I've been looking around, and the few libraries I've found was very old and seemingly…
asgerhallas
  • 16,890
  • 6
  • 50
  • 68
10
votes
4 answers

JSON: Is there an equivalent of Schematron for JSON and JSON Schema? (That is, a JSON technology to express co-constraints)

Here is a JSON instance showing the start-time and end-time for a meeting: { "start time": "2015-02-19T08:00:00Z", "end time": "2015-02-19T09:00:00Z" } I can specify the structure of that instance using JSON Schema: the instance must…
Roger Costello
  • 3,007
  • 1
  • 22
  • 43
7
votes
3 answers

How can I validate documents against Schematron schemas in Java?

As far as I can tell, JAXP by default supports W3C XML Schema and RelaxNG from Java 6. I can see a few APIs, mostly experimental or incomplete, on the schematron.com links page. Is there an approach on validating schematron in Java that's complete,…
brabster
  • 42,504
  • 27
  • 146
  • 186
6
votes
2 answers

How to perform schematron validation using Saxon java library command line tool?

Very basic question- I've a xml file and I want to validate it against a schematron file. How do I do it using Saxon command line? As per commandline reference I don't see any option to specify schematron file.
user837208
  • 2,487
  • 7
  • 37
  • 54
6
votes
2 answers

Understanding schematron validation

I am new to xml and I am having difficulties in understanding what is happening in the below statement. The Schematron file is from https://schemas.wmo.int/iwxxm/3.0.0/rule/iwxxm.sch
NJMR
  • 1,886
  • 1
  • 27
  • 46
6
votes
2 answers

Resolving relative paths when using ph-schematron

I'm using ph-schematron, a Java library that validates XML documents via ISO Schematron: This library provides 2 ways of XML document validation: Validation via XSLT Validation via Pure Schematron I would love to use the second type, but my…
Mathias G.
  • 4,875
  • 3
  • 39
  • 60
6
votes
1 answer

Schematron validation with lxml in Python: how to retrieve validation errors?

I'm trying to do some Schematron validation with lxml. For the specific application I'm working at, it's important that any tests that failed the validation are reported back. The lxml documentation mentions the presence of the validation_report…
johan
  • 764
  • 7
  • 17
6
votes
1 answer

Setting ANT CLASSPATH in build.xml

This particular question has been asked a few times, but not quite to my satisfaction. I'm not really interested in the workarounds proposed, but how to do what I actually want to do. Would like a satisfactory explanation for why this is not…
robert
  • 4,612
  • 2
  • 29
  • 39
6
votes
4 answers

Where can I find a Java implementation of an ISO Schematron validator?

The ISO Schematron standard has been out for two years now, but I'm still unable to find a Java implementation using ISO Schematron XSLT files (as opposed to files from an older version of Schematron, e.g. here:…
Chris
  • 4,212
  • 5
  • 37
  • 52
5
votes
1 answer

XML validation by XSLT or Schematron in Eclipse XML Editor?

How can we validate xml document by either schematron or xslt in Eclipse xml editor? The idea is to extend xml document live validation in eclipse xml editor with some rules based validation method.
WSK
  • 5,949
  • 8
  • 49
  • 74
5
votes
1 answer

ph-schematron validation error message

I'm using ph-schematron to validate my XML files. I'm able to validate the files correctly but I couldn't find how to generate reports about failing assertions. This is my context(point-of-interest):
GokcenG
  • 2,771
  • 2
  • 25
  • 40
5
votes
1 answer

xsd validation using schematron

I'm trying to add schematron validation to my xsd. This is my new xsd : xmlns:sch="http://www.ascc.net/xml/schematron" elementFormDefault="qualified" >
Idan
  • 5,717
  • 10
  • 47
  • 84
5
votes
2 answers

Validating XML doc results in "Invalid byte 1 of 1-byte UTF-8 sequence."

I'm validating some XML files against Schematron stylesheets by using Probatron4j, which uses Saxon internally. Most of the time, this works fine, but occasionally, processing crashes with the error org.xml.sax.SAXParseException: Invalid byte 1 of…
Pops
  • 30,199
  • 37
  • 136
  • 151
4
votes
2 answers

Perform checks against XML files, such as Oracle OSB files and Soap-UI test files

Looking for a way we can do checks on XML files, beyond just schema validation. Have found a few references to Schematron which looks interesting, but struggling to see how we can piece this all toegether: Problem Background We're dealing with…
Nathan
  • 51
  • 5
4
votes
1 answer

Validating large xml files with schematron

I'm using schematron for validating large xml files (several megabytes). Validation is quite fast if files are ok (if there is no errors). But when the error count increases so increases the execution time of the schematron validation time. Is there…
juhako
  • 489
  • 4
  • 7
1
2 3
16 17