secretariat 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/bin/schxslt-cli.jar +0 -0
- data/lib/secretariat/validator.rb +12 -13
- data/lib/secretariat/version.rb +1 -1
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931.sch +2905 -0
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931.xsd +20 -0
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931_codedb.xml +5812 -0
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd +94 -0
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931_urn_un_unece_uncefact_data_standard_RABIE_100.xsd +318 -0
- data/schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd +84 -0
- data/schemas/zugferd_1/ZUGFeRD1p0.sch +25085 -0
- data/schemas/zugferd_1/ZUGFeRD1p0.xsd +20 -0
- data/schemas/zugferd_1/ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd +76 -0
- data/schemas/zugferd_1/ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_12.xsd +352 -0
- data/schemas/zugferd_1/ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd +95 -0
- metadata +24 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6d3c5177f9a94e1341b1b533cfe34b91f9babe7eafa5d483cbf4b5f489509c0
|
4
|
+
data.tar.gz: d51e684d34ac4fc61007cd6243c26cc8cfd31df95799b39079841d6e23b352f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c7ea742126169c1b97b0ce347d8d7f6830f5eabb5542b814ae9313c9a0c4d904076124fccd18a182e217ce1a4e87008bc6e5350f7f53b562fee8795855486e
|
7
|
+
data.tar.gz: f228bac7b78241d5437b61fb1d9505c0ebb2ed2608f7489cf5145da34a662b5efd50a87090cf3b9ca27af9e2af6708865e3cf7039e0c466fc48711f3347017cb
|
data/README.md
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
# A ZUGFeRD xml generator and validator
|
2
2
|
|
3
|
-
|
3
|
+
See tests for examples.
|
4
4
|
|
5
5
|
# Some words of caution
|
6
6
|
|
7
7
|
1. This is an opinionated library optimised for my very specific usecase
|
8
8
|
2. While I did start to add some validations to make sure you can't input absolute garbage into this, I cannot guarantee factual (as in taxation law) correctness of the resulting XML.
|
9
|
-
|
9
|
+
1. The library, for ZUGFeRD 2.x, currently only supports the EN16931 variant. This is probably what you want as well. PRs welcome.
|
10
|
+
3. This does not contain any code to attach the XML to a PDF file, mainly because I have yet to find a ruby library to do that. For software that does this, take a look at [this python library](https://github.com/akretion/factur-x).
|
10
11
|
|
11
12
|
# LICENSE
|
12
13
|
|
13
14
|
See [LICENSE](LICENSE).
|
14
15
|
|
15
|
-
Additionally, this project contains material, such as the schema files, which,
|
16
|
-
according to the ZUGFeRD documentation, are also licensed under the Apache
|
17
|
-
License.
|
16
|
+
Additionally, this project contains material, such as the schema files, which, according to the ZUGFeRD documentation, are also licensed under the Apache License.
|
18
17
|
|
19
|
-
Additionally, this project uses nokogiri and
|
20
|
-
licensed unter the MIT license.
|
18
|
+
Additionally, this project uses nokogiri and [SchXslt](https://github.com/schxslt/schxslt), both licensed unter the MIT license.
|
21
19
|
|
22
20
|
|
data/bin/schxslt-cli.jar
ADDED
Binary file
|
@@ -15,25 +15,24 @@ limitations under the License.
|
|
15
15
|
=end
|
16
16
|
|
17
17
|
require 'nokogiri'
|
18
|
-
require 'schematron-nokogiri'
|
19
|
-
require 'open-uri'
|
20
18
|
|
21
19
|
module Secretariat
|
22
20
|
class Validator
|
23
21
|
SCHEMATRON = [
|
24
22
|
'../../schemas/zugferd_1/ZUGFeRD1p0.sch',
|
25
|
-
'../../schemas/
|
23
|
+
'../../schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931.sch'
|
26
24
|
]
|
27
25
|
|
28
26
|
SCHEMA = [
|
29
27
|
'../../schemas/zugferd_1/ZUGFeRD1p0.xsd',
|
30
|
-
'../../schemas/
|
28
|
+
'../../schemas/factur-x_1.0.0.7/Factur-X_1.0.07_EN16931.xsd'
|
31
29
|
]
|
32
30
|
|
33
31
|
SCHEMA_DIR = [
|
34
32
|
'../../schemas/zugferd_1',
|
35
|
-
'../../schemas/
|
33
|
+
'../../schemas/factur-x_1.0.0.7/'
|
36
34
|
]
|
35
|
+
|
37
36
|
attr_accessor :doc, :version
|
38
37
|
def initialize(io_or_str, version: 1)
|
39
38
|
@doc = Nokogiri.XML(io_or_str)
|
@@ -44,10 +43,8 @@ module Secretariat
|
|
44
43
|
Nokogiri::XML.Schema open(File.join(__dir__, SCHEMA[version - 1]))
|
45
44
|
end
|
46
45
|
|
47
|
-
def
|
48
|
-
|
49
|
-
Nokogiri::XML(open(File.join(__dir__, SCHEMATRON[version - 1])))
|
50
|
-
)
|
46
|
+
def schematron_path
|
47
|
+
File.join(__dir__, SCHEMATRON[version - 1])
|
51
48
|
end
|
52
49
|
|
53
50
|
def validate_against_schema
|
@@ -55,11 +52,13 @@ module Secretariat
|
|
55
52
|
end
|
56
53
|
|
57
54
|
def validate_against_schematron
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
Dir.mktmpdir do |dir|
|
56
|
+
docpath = File.join(dir, 'doc.xml')
|
57
|
+
File.write(docpath, doc, mode: 'wb')
|
58
|
+
out = `java -jar bin/schxslt-cli.jar -v -d #{docpath} -s #{schematron_path}`
|
59
|
+
return [] if out.match("[valid]")
|
60
|
+
out.lines
|
61
61
|
end
|
62
|
-
result
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
data/lib/secretariat/version.rb
CHANGED