Compare commits

..

No commits in common. "1e6f96dfad5b32e63e5f8c0dc3acb2218b06b011" and "da7515a055d293a48a196cb40ac70d3f277ce26d" have entirely different histories.

4 changed files with 51 additions and 62 deletions

View file

@ -1,5 +1,4 @@
# KoSIT Validator # KoSIT Validator
- [Introduction](#introduction) - [Introduction](#introduction)
- [Validation Configurations](#validation-configurations) - [Validation Configurations](#validation-configurations)
* [Third Party Validation Configurations](#third-party-validation-configurations) * [Third Party Validation Configurations](#third-party-validation-configurations)
@ -10,18 +9,17 @@
- [Packages](#packages) - [Packages](#packages)
## Introduction ## Introduction
The validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order:
The validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order: 1. identify actual xml format
1. validate the xml file (using schema and schematron rules)
1. identify actual XML format 1. generate a custom report / extract custom data from the xml file
1. validate the XML file (using schema and schematron rules)
1. generate a custom report / extract custom data from the XML file
1. compute an acceptance status (according the supplied schema and rules) 1. compute an acceptance status (according the supplied schema and rules)
The validator depends on self defined [scenarios](docs/configurations.md) in order to fully configure the whole process. The validator depends on self defined [scenarios](docs/configurations.md) which are used to fully configure the process.
It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of the report can also be controlled by the scenario. It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of this is controlled by the scenario.
See [architecture](docs/architecture.md) for information about the whole validation process. See [architecture](docs/architecture.md) for information about the actual validation process.
## Validation configurations ## Validation configurations
@ -32,7 +30,7 @@ All configurations are self-contained modules which are deployed and developed o
### Third party validation configurations ### Third party validation configurations
Here are two public third party validation configurations available which might serve as examples: Currently, there are two public third party validation configurations available.
* Validation Configuration for [XRechnung](http://www.xoev.de/de/xrechnung): * Validation Configuration for [XRechnung](http://www.xoev.de/de/xrechnung):
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung) * Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
@ -45,31 +43,29 @@ Here are two public third party validation configurations available which might
The validator can be used in three different ways: The validator can be used in three different ways:
* as standalone application running from the CLI * as standalone application running from the cli
* as library embedded within a custom application * as library embedded within a custom application
* as a daemon providing a http interface * as a daemon providing a http interface
### Standalone Command Line Interface (CLI) ### Standalone Command-Line Interface
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
The general way using the CLI is: The general way using the CLI is:
```shell ```shell
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -r <repository-path> java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -r <repository-path>
[OPTIONS] [FILE] [FILE] [FILE] ... [OPTIONS] [FILE] [FILE] [FILE] ...
``` ```
The help option displays further CLI options to customize the process: The help option displays further CLI options to customize the process:
```shell ```shell
java -jar validator-<version>-standalone.jar --help java -jar validationtool-<version>-standalone.jar --help
``` ```
A concrete example with a specific validator configuration can be found on A concrete example with a specific validator configuration can be found on
[GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung) [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
The [CLI documentation](./docs/cli.md) shows further configuration options. The [CLI documentation](./docs/cli.md) shows further configuration options.
### Application User Interface (API / embedded usage) ### Application User Interface (API / embedded usage)
@ -97,7 +93,7 @@ will thus not be resolved transitively.
You can also start the validator as a HTTP-Server. Just start it in _Daemon-Mode_ with the `-D` option. You can also start the validator as a HTTP-Server. Just start it in _Daemon-Mode_ with the `-D` option.
```shell ```shell
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D
``` ```
@ -107,7 +103,7 @@ The [daemon documentation](./docs/daemon.md) shows more usage details and furthe
The validator distribution contains the following artifacts: The validator distribution contains the following artifacts:
1. **validator-`<version>`.jar**: Java library for embedded use within an application 1. **validationtool-`<version>`.jar**: Java library for embedded use within an application
1. **validator-`<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) 1. **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)
1. **validator-`<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. 1. **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.
1. **libs/***: directory containing all (incl. optional) dependencies of the validator 1. **libs/***: directory containing all (incl. optional) dependencies of the validator

View file

@ -1,29 +1,27 @@
# Validator Command Line Interface (CLI) # Validator CLI
The `validator` comes with a command line interface (CLI) which allows validating any number of input XML files. The validator comes with a commandline interface (CLI) which allows validating any number of input xml files.
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
The general way using the CLI is: The general way using the CLI is:
```shell ```shell
java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ... java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ...
``` ```
The validator can also read the XML file from the standard input The validator can also read the xml file from the standard input
```shell ```shell script
# via redirection # via redirection
java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml
# read from pipe # read from pipe
cat my-input.xml | validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] cat my-input.xml | validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS]
``` ```
The help option displays further CLI options: The help option displays further CLI options to customize the process:
```shell ```shell
java -jar validator-<version>-standalone.jar --help java -jar validationtool-<version>-standalone.jar --help
``` ```
You can also use multiple scenario configurations and multiple repositories with resources for these. The validator either supports You can also use multiple scenario configurations and multiple repositories with resources for these. The validator either supports
@ -31,17 +29,17 @@ supplying the parameters in order or using named configuration. Valid usages are
```shell ```shell
# multiple scenarios, implicit repository # multiple scenarios, implicit repository
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> [OPTIONS] [FILE] java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> [OPTIONS] [FILE]
# multiple scenarios, single defined repository # multiple scenarios, single defined repository
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo> [OPTIONS] [FILE] java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo> [OPTIONS] [FILE]
# multiple scenarios, multiple repositories ordered # multiple scenarios, multiple repositories ordered
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -r <path-to-repo1> -s <scenario-config-file2> -r <path-to-repo2> [OPTIONS] [FILE] java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -r <path-to-repo1> -s <scenario-config-file2> -r <path-to-repo2> [OPTIONS] [FILE]
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo1> -r <path-to-repo2> [OPTIONS] [FILE] java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo1> -r <path-to-repo2> [OPTIONS] [FILE]
# multiple scenarios, multiple repositories (named) # multiple scenarios, multiple repositories (named)
java -jar validator-<version>-standalone.jar -s "NAME1=<scenario-config-file1>" -s "NAME2=<scenario-config-file2>" -r "NAME1=<path-to-repo1>" -r "NAME2=<path-to-repo2>" [OPTIONS] [FILE] java -jar validationtool-<version>-standalone.jar -s "NAME1=<scenario-config-file1>" -s "NAME2=<scenario-config-file2>" -r "NAME1=<path-to-repo1>" -r "NAME2=<path-to-repo2>" [OPTIONS] [FILE]
``` ```
## Special features ## Special features
@ -59,7 +57,7 @@ generated reports. This is mainly useful for scenario developers. Ask KoSIT for
| code | description | | code | description |
|-|-| |-|-|
| 0 | All validated xml files are acceptable according to the scenario configurations or application usage was requested | | 0 | All validated xml files are acceptable according to the scenario configurations |
| positive integer | Number of rejected (e.g. not acceptable) xml files according to the scenario configurations| | positive integer | Number of rejected (e.g. not acceptable) xml files according to the scenario configurations|
| -1 | Parsing error. The commandline arguments specified are incorrect | | -1 | Parsing error. The commandline arguments specified are incorrect |
| -2 | Configuration error. There is an error loading the configuration and/or validation targets | | -2 | Configuration error. There is an error loading the configuration and/or validation targets |

View file

@ -8,10 +8,8 @@ and should work with OpenJDK based distributions. Keep this in mind, if you want
To use the validator daemon as is, start the _Daemon-Mode_ with the `-D` option and supply a suitable To use the validator daemon as is, start the _Daemon-Mode_ with the `-D` option and supply a suitable
[validator configuration](configurations.md). [validator configuration](configurations.md).
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
```shell ```shell
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D
``` ```
Per default the HTTP-Server listens on _localhost_ at Port 8080. Per default the HTTP-Server listens on _localhost_ at Port 8080.
@ -19,7 +17,7 @@ Per default the HTTP-Server listens on _localhost_ at Port 8080.
You can configure the daemon with `-H` for IP Adress and `-P` for port number: You can configure the daemon with `-H` for IP Adress and `-P` for port number:
```shell ```shell
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081 java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081
``` ```
## Customized usage ## Customized usage
@ -137,5 +135,5 @@ The daemon provides a simple GUI when issuing `GET` requests providing the follo
The GUI can be disabled using the API (see above) or via CLI: The GUI can be disabled using the API (see above) or via CLI:
```shell script ```shell script
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui
``` ```

33
pom.xml
View file

@ -15,15 +15,16 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>KoSIT XML Validator</name> <name>KoSIT XML Prüftool Implementierung</name>
<groupId>org.kosit</groupId> <groupId>org.kosit</groupId>
<artifactId>validator</artifactId> <artifactId>validator</artifactId>
<version>1.5.2-SNAPSHOT</version> <version>1.5.1-SNAPSHOT</version>
<description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description> <description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description>
<developers> <developers>
<!-- In alphabetical order by last name --> <!-- In alphabetical order by last name -->
@ -66,7 +67,7 @@
<version.saxon-he>12.8</version.saxon-he> <version.saxon-he>12.8</version.saxon-he>
<version.slf4j>2.0.17</version.slf4j> <version.slf4j>2.0.17</version.slf4j>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>project.local</id> <id>project.local</id>
@ -184,7 +185,7 @@
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
</resources> </resources>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
@ -201,13 +202,13 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>3.2.8</version> <version>3.2.8</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<!-- for PR 152 --> <!-- for PR 152 -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version> <version>3.3.1</version>
@ -215,7 +216,7 @@
<propertiesEncoding>ISO-8859-1</propertiesEncoding> <propertiesEncoding>ISO-8859-1</propertiesEncoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId> <artifactId>build-helper-maven-plugin</artifactId>
@ -463,14 +464,14 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.5.3</version> <version>3.5.3</version>
<configuration> <configuration>
<!--suppress MavenModelInspection -->
<argLine>-Dfile.encoding=UTF-8 ${jacocoSurefire}</argLine>
<systemProperties> <systemProperties>
<property> <property>
<name>java.net.useSystemProxies</name> <name>java.net.useSystemProxies</name>
<value>true</value> <value>true</value>
</property> </property>
</systemProperties> </systemProperties>
<!--suppress MavenModelInspection -->
<argLine>-Dfile.encoding=UTF-8 ${jacocoSurefire}</argLine>
</configuration> </configuration>
</plugin> </plugin>
@ -638,10 +639,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
@ -726,9 +723,9 @@
<tag>release/1.5.x</tag> <tag>release/1.5.x</tag>
<url>https://github.com/itplr-kosit/validator</url> <url>https://github.com/itplr-kosit/validator</url>
</scm> </scm>
<url>https://github.com/itplr-kosit/validator</url> <url>https://github.com/itplr-kosit/validator</url>
<licenses> <licenses>
<license> <license>
<name>Apache License, Version 2.0</name> <name>Apache License, Version 2.0</name>