The validator is an XML validation-engine. It validates XML documents against XML Schema and Schematron Rules depending on self defined scenarios which are used to fully configure the validation process. The validator always outputs a validation report in XML including all validation errors and data about the validation.
See architecture for informations about the actual validation process.
The validator distribution contains the following artifacts:
- validationtool-
<version>
.jar: Java library for embedded use within an application - validationtool-
<version
>-standalone.jar: Uber-JAR for standalone usage containing all dependencies in one jar file. This file comes with JAXB embedded and can be used with Java 8 and Java >= 11) - validationtool-
<version
>-java8-standalone.jar: Uber-JAR for standalone usage with Java JDK 8 containing all dependencies in one jar file. This file file does not contain JAXB and depends on the bundled version of the JDK. - libs/*: directory containing all (incl. optional) dependencies of the validator
The validator is just an engine and does not know anything about XML Documents and has no own validation rules. Validation rules and details are defined in validation scenarios which are used to fully configure the validation process. All configurations are self-contained modules which are deployed and developed on their own.
Currently, there are two public third party validation configurations available.
- Validation Configuration for XRechnung:
- Validation Configuration for XGewerbeanzeige
The validator is designed to be used in three different ways:
- as standalone application running from the cli
- as library embedded within a custom application
- as a daemon providing a http interface
The general way using the CLI is:
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ...
The help option displays further CLI options to customize the process:
java -jar validationtool-<version>-standalone.jar --help
A concrete example with a specific validator configuration can be found on GitHub
The validator can also be used in own Java Applications via the API. An example use of the API as follows:
Path scenarios = Paths.get("scenarios.xml");
Configuration config = Configuration.load(scenarios.toUri());
Input document = InputFactory.read(testDocument);
Check validator = new DefaultCheck(config);
Result validationResult = validator.checkInput(document);
// examine the result here
The API documentation shows further configuration options.
You can also start the validator as a HTTP-Server. Just start it in Daemon-Mode with the -D
option.
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D
The daemon documentation shows more usage details and further configuration options.