itplr-kosit / validator-configuration-xrechnung

Configuration for validating documents against the German XRechnung standard using the KoSIT validation tool

Home Page:https://xeinkauf.de/xrechnung/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage to be updated

wq9578 opened this issue · comments

The usage (current and permanent link) should be updated.

No. 1:

# download validator
curl -L "https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip" --output validator.zip

# download configuration (for 2.2.0)
curl -L "https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2022-11-15/validator-configuration-xrechnung_2.2.0_2022-11-15.zip" --output validator-configuration.zip

# download one most recent test document
curl -L "https://raw.githubusercontent.com/itplr-kosit/xrechnung-testsuite/master/src/test/business-cases/standard/01.01a-INVOICE_ubl.xml" --output ubl.xml

# show content of directory
ls
# should show something like this:
# ubl.xml validator.zip  validator-configuration.zip

Changes:
a) Using current v1.5.0 since v1.4.2 causes some problem: itplr-kosit/validator#94
b) Commented out last line causing an error when using copy + paste into the terminal, since 'ubl.xml' is output only, not an executable to run.

No. 3:

I had to add option '-r' with an absolute path. It didn't work with a relative path or without option '-r'.
This behaviour should be corrected. Specifying an absolute path should be avoided.

Success with absolute path:

➜  XR java -jar validationtool-1.5.0-standalone.jar -s scenarios.xml -r /Users/mac/tmp/XR -h ubl.xml
KoSIT Validator version 1.5.0
Loading scenarios from  file:///Users/mac/tmp/XR/scenarios.xml
Using repository  file:///Users/mac/tmp/XR/

Loaded "Validator Configuration XRechnung 2.2.0" by Coordination Office for IT Standards (KoSIT) from 2022-11-16 
The following scenarios are available:
  * EN16931 XRechnung (UBL Invoice)
  * EN16931 XRechnung Extension (UBL Invoice)
  * EN16931 XRechnung (UBL CreditNote)
  * EN16931 XRechnung (CII)
  * EN16931 XRechnung Extension (CII)
  * EN16931 (UBL Invoice)
  * EN16931 (UBL CreditNote)
  * EN16931 (CII)


Processing of 1 objects started
Processing of 1 objects completed in 165ms
Results:
-------------------------------------------------------------------------------------
|File                             |Schema |Schematron|Acceptance|Error/Description   |
|/Users/mac/tmp/XR/ubl.xml        |   Y   |    Y     |ACCEPTABLE|                    |
-------------------------------------------------------------------------------------
Acceptable:  1  Rejected:  0


##############################
#   Validation successful!   #
##############################

Failure with relative path:

➜  XR java -jar validationtool-1.5.0-standalone.jar -s scenarios.xml -r . -h ubl.xml
KoSIT Validator version 1.5.0
Loading scenarios from  file:///Users/mac/tmp/XR/scenarios.xml
Using repository  file:///Users/mac/tmp/XR/./

java.lang.IllegalStateException: Can not resolve resources/ubl/2.1/xsd/maindoc/UBL-Invoice-2.1.xsd in repository file:///Users/mac/tmp/XR/./
	at de.kosit.validationtool.impl.ContentRepository.resolveInRepository(ContentRepository.java:197)
	at de.kosit.validationtool.impl.ContentRepository.lambda$createSchema$2(ContentRepository.java:168)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at de.kosit.validationtool.impl.ContentRepository.createSchema(ContentRepository.java:168)
	at de.kosit.validationtool.impl.ContentRepository.createSchema(ContentRepository.java:181)
	at de.kosit.validationtool.config.ConfigurationLoader.initialize(ConfigurationLoader.java:134)
	at de.kosit.validationtool.config.ConfigurationLoader.lambda$initializeScenarios$0(ConfigurationLoader.java:128)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at de.kosit.validationtool.config.ConfigurationLoader.initializeScenarios(ConfigurationLoader.java:128)
	at de.kosit.validationtool.config.ConfigurationLoader.build(ConfigurationLoader.java:164)
	at de.kosit.validationtool.cmd.Validator.lambda$getConfiguration$0(Validator.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1858)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at de.kosit.validationtool.cmd.Validator.getConfiguration(Validator.java:200)
	at de.kosit.validationtool.cmd.Validator.processActions(Validator.java:133)
	at de.kosit.validationtool.cmd.Validator.mainProgram(Validator.java:87)
	at de.kosit.validationtool.cmd.CommandLineOptions.call(CommandLineOptions.java:173)
	at de.kosit.validationtool.cmd.CommandLineOptions.call(CommandLineOptions.java:40)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at de.kosit.validationtool.cmd.CommandLineApplication.mainProgram(CommandLineApplication.java:82)
	at de.kosit.validationtool.cmd.CommandLineApplication.main(CommandLineApplication.java:54)
Caused by: javax.xml.transform.TransformerException: The resolved transformation artifact file:/Users/mac/tmp/XR/resources/ubl/2.1/xsd/maindoc/UBL-Invoice-2.1.xsd is not within the configured repository file:///Users/mac/tmp/XR/./
	at de.kosit.validationtool.impl.xml.RelativeUriResolver.resolve(RelativeUriResolver.java:59)
	at de.kosit.validationtool.impl.ContentRepository.resolveInRepository(ContentRepository.java:194)
	... 44 more
Can not resolve resources/ubl/2.1/xsd/maindoc/UBL-Invoice-2.1.xsd in repository file:///Users/mac/tmp/XR/./
Usage: KoSIT Validator [-?dX] [-l <logLevel>] [-r repository-path]... -s
                       scenario.xml [-s scenario.xml]... [[-D] [-H <host>] [-P
                       <port>] [-T <workerCount>] [-G]] [[-o <outputPath>] [-h]
                       [--serialize-report-input] [-c assertions-file]
                       [--report-postfix <reportPostfix>] [--report-prefix
                       <reportPrefix>] [-m] [-p] <files>...]
Structural and semantic validation of xml files
  -?, --help            display this help message
  -d, --debug           Prints some more debug information
  -l, --log-level <logLevel>
                        Enables a certain log level for debugging purposes
  -r, --repository repository-path
                        Directory containing scenario content
  -s, --scenarios scenario.xml
                        Location of scenarios.xml
  -X, --debug-logging   Enables full debug log. Alias for -l debug
Daemon options
  -D, --daemon          Starts a daemon listing for validation requests
  -G, --disable-gui     Disables the GUI of the daemon mode
  -H, --host <host>     The hostname / IP address to bind the daemon.
                          Default: localhost
  -P, --port <port>     The port to bind the daemon.
                          Default: 8080
  -T, --threads <workerCount>
                        Number of threads processing validation requests.
                          Default depends on processor count
CLI usage options
      <files>...        Files to validate
  -c, --check-assertions assertions-file
                        Check the result using defined assertions
  -h, --html, --extract-html
                        Extract and save any html content within result as a
                          separate file
  -m, --memory-stats    Prints some memory stats
  -o, --output-directory <outputPath>
                        Defines the out directory for results.
  -p, --print           Prints the check result to stdout
      --report-postfix <reportPostfix>
                        Postfix of the generated report name
      --report-prefix <reportPrefix>
                        Prefix of the generated report name
      --serialize-report-input
                        Serializes the report input to the cwd

Failure without option '-r':

➜  XR java -jar validationtool-1.5.0-standalone.jar -s scenarios.xml -h ubl.xml 
KoSIT Validator version 1.5.0
java.lang.IllegalArgumentException: No repository location for scenario definition 'default_1' specified
	at de.kosit.validationtool.cmd.Validator.findRepository(Validator.java:214)
	at de.kosit.validationtool.cmd.Validator.lambda$getConfiguration$0(Validator.java:193)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1858)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at de.kosit.validationtool.cmd.Validator.getConfiguration(Validator.java:200)
	at de.kosit.validationtool.cmd.Validator.processActions(Validator.java:133)
	at de.kosit.validationtool.cmd.Validator.mainProgram(Validator.java:87)
	at de.kosit.validationtool.cmd.CommandLineOptions.call(CommandLineOptions.java:173)
	at de.kosit.validationtool.cmd.CommandLineOptions.call(CommandLineOptions.java:40)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at de.kosit.validationtool.cmd.CommandLineApplication.mainProgram(CommandLineApplication.java:82)
	at de.kosit.validationtool.cmd.CommandLineApplication.main(CommandLineApplication.java:54)
No repository location for scenario definition default_1 specified
Usage: KoSIT Validator [-?dX] [-l <logLevel>] [-r repository-path]... -s
                       scenario.xml [-s scenario.xml]... [[-D] [-H <host>] [-P
                       <port>] [-T <workerCount>] [-G]] [[-o <outputPath>] [-h]
                       [--serialize-report-input] [-c assertions-file]
                       [--report-postfix <reportPostfix>] [--report-prefix
                       <reportPrefix>] [-m] [-p] <files>...]
Structural and semantic validation of xml files
  -?, --help            display this help message
  -d, --debug           Prints some more debug information
  -l, --log-level <logLevel>
                        Enables a certain log level for debugging purposes
  -r, --repository repository-path
                        Directory containing scenario content
  -s, --scenarios scenario.xml
                        Location of scenarios.xml
  -X, --debug-logging   Enables full debug log. Alias for -l debug
Daemon options
  -D, --daemon          Starts a daemon listing for validation requests
  -G, --disable-gui     Disables the GUI of the daemon mode
  -H, --host <host>     The hostname / IP address to bind the daemon.
                          Default: localhost
  -P, --port <port>     The port to bind the daemon.
                          Default: 8080
  -T, --threads <workerCount>
                        Number of threads processing validation requests.
                          Default depends on processor count
CLI usage options
      <files>...        Files to validate
  -c, --check-assertions assertions-file
                        Check the result using defined assertions
  -h, --html, --extract-html
                        Extract and save any html content within result as a
                          separate file
  -m, --memory-stats    Prints some memory stats
  -o, --output-directory <outputPath>
                        Defines the out directory for results.
  -p, --print           Prints the check result to stdout
      --report-postfix <reportPostfix>
                        Postfix of the generated report name
      --report-prefix <reportPrefix>
                        Prefix of the generated report name
      --serialize-report-input
                        Serializes the report input to the cwd

@wq9578 the links in the usage.md were updated along with the implementation of validator v1.5.0 (4c6c1f2), taking your remark no. 1 into account. Thanks for pointing it out.
As no. 3 is not specific to validator-configuration-xrechnung, please create an issue in https://github.com/itplr-kosit/validator/issues. Thank you!