rng 0.1.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/docs.yml +63 -0
- data/.github/workflows/release.yml +8 -3
- data/.gitignore +11 -0
- data/.rubocop.yml +10 -7
- data/.rubocop_todo.yml +229 -23
- data/CHANGELOG.md +317 -0
- data/CLAUDE.md +139 -0
- data/Gemfile +11 -12
- data/README.adoc +1538 -11
- data/Rakefile +11 -3
- data/docs/Gemfile +8 -0
- data/docs/_config.yml +23 -0
- data/docs/getting-started/index.adoc +75 -0
- data/docs/guides/error-handling.adoc +137 -0
- data/docs/guides/external-references.adoc +128 -0
- data/docs/guides/index.adoc +24 -0
- data/docs/guides/parsing-rnc.adoc +141 -0
- data/docs/guides/parsing-rng-xml.adoc +81 -0
- data/docs/guides/rng-to-rnc.adoc +101 -0
- data/docs/guides/validation.adoc +85 -0
- data/docs/index.adoc +52 -0
- data/docs/reference/api.adoc +126 -0
- data/docs/reference/cli.adoc +182 -0
- data/docs/understanding/architecture.adoc +58 -0
- data/docs/understanding/rng-vs-rnc.adoc +118 -0
- data/exe/rng +5 -0
- data/lib/rng/any_name.rb +10 -8
- data/lib/rng/attribute.rb +28 -26
- data/lib/rng/choice.rb +24 -24
- data/lib/rng/cli.rb +607 -0
- data/lib/rng/data.rb +10 -10
- data/lib/rng/datatype_declaration.rb +26 -0
- data/lib/rng/define.rb +44 -41
- data/lib/rng/div.rb +36 -0
- data/lib/rng/documentation.rb +9 -0
- data/lib/rng/element.rb +39 -37
- data/lib/rng/empty.rb +7 -7
- data/lib/rng/except.rb +25 -25
- data/lib/rng/external_ref.rb +8 -8
- data/lib/rng/external_ref_resolver.rb +602 -0
- data/lib/rng/foreign_attribute.rb +26 -0
- data/lib/rng/foreign_element.rb +33 -0
- data/lib/rng/grammar.rb +14 -12
- data/lib/rng/group.rb +26 -24
- data/lib/rng/include.rb +5 -6
- data/lib/rng/include_processor.rb +461 -0
- data/lib/rng/interleave.rb +23 -23
- data/lib/rng/list.rb +22 -22
- data/lib/rng/mixed.rb +23 -23
- data/lib/rng/name.rb +6 -7
- data/lib/rng/namespace_declaration.rb +47 -0
- data/lib/rng/namespaces.rb +15 -0
- data/lib/rng/not_allowed.rb +7 -7
- data/lib/rng/ns_name.rb +9 -9
- data/lib/rng/one_or_more.rb +23 -23
- data/lib/rng/optional.rb +23 -23
- data/lib/rng/param.rb +7 -8
- data/lib/rng/parent_ref.rb +8 -8
- data/lib/rng/parse_tree_processor.rb +695 -0
- data/lib/rng/pattern.rb +7 -7
- data/lib/rng/ref.rb +8 -8
- data/lib/rng/rnc_builder.rb +927 -0
- data/lib/rng/rnc_parser.rb +605 -305
- data/lib/rng/rnc_to_rng_converter.rb +1408 -0
- data/lib/rng/schema_preamble.rb +73 -0
- data/lib/rng/schema_validator.rb +1622 -0
- data/lib/rng/start.rb +27 -25
- data/lib/rng/test_suite_parser.rb +168 -0
- data/lib/rng/text.rb +11 -8
- data/lib/rng/to_rnc.rb +4 -35
- data/lib/rng/value.rb +6 -7
- data/lib/rng/version.rb +1 -1
- data/lib/rng/zero_or_more.rb +23 -23
- data/lib/rng.rb +68 -17
- data/rng.gemspec +18 -19
- data/scripts/extract_spectest_resources.rb +96 -0
- data/spec/fixtures/compacttest.xml +2511 -0
- data/spec/fixtures/external/circular_a.rng +7 -0
- data/spec/fixtures/external/circular_b.rng +7 -0
- data/spec/fixtures/external/circular_main.rng +7 -0
- data/spec/fixtures/external/external_ref_lib.rng +7 -0
- data/spec/fixtures/external/external_ref_main.rng +7 -0
- data/spec/fixtures/external/include_lib.rng +7 -0
- data/spec/fixtures/external/include_main.rng +3 -0
- data/spec/fixtures/external/nested_chain.rng +6 -0
- data/spec/fixtures/external/nested_leaf.rng +7 -0
- data/spec/fixtures/external/nested_mid.rng +8 -0
- data/spec/fixtures/metanorma/3gpp.rnc +35 -0
- data/spec/fixtures/metanorma/3gpp.rng +105 -0
- data/spec/fixtures/metanorma/basicdoc.rnc +11 -0
- data/spec/fixtures/metanorma/bipm.rnc +148 -0
- data/spec/fixtures/metanorma/bipm.rng +376 -0
- data/spec/fixtures/metanorma/bsi.rnc +104 -0
- data/spec/fixtures/metanorma/bsi.rng +332 -0
- data/spec/fixtures/metanorma/csa.rnc +45 -0
- data/spec/fixtures/metanorma/csa.rng +131 -0
- data/spec/fixtures/metanorma/csd.rnc +43 -0
- data/spec/fixtures/metanorma/csd.rng +132 -0
- data/spec/fixtures/metanorma/gbstandard.rnc +99 -0
- data/spec/fixtures/metanorma/gbstandard.rng +316 -0
- data/spec/fixtures/metanorma/iec.rnc +49 -0
- data/spec/fixtures/metanorma/iec.rng +193 -0
- data/spec/fixtures/metanorma/ietf.rnc +275 -0
- data/spec/fixtures/metanorma/ietf.rng +925 -0
- data/spec/fixtures/metanorma/iho.rnc +58 -0
- data/spec/fixtures/metanorma/iho.rng +179 -0
- data/spec/fixtures/metanorma/isodoc.rnc +873 -0
- data/spec/fixtures/metanorma/isodoc.rng +2704 -0
- data/spec/fixtures/metanorma/isostandard-amd.rnc +43 -0
- data/spec/fixtures/metanorma/isostandard-amd.rng +108 -0
- data/spec/fixtures/metanorma/isostandard.rnc +166 -0
- data/spec/fixtures/metanorma/isostandard.rng +494 -0
- data/spec/fixtures/metanorma/itu.rnc +122 -0
- data/spec/fixtures/metanorma/itu.rng +377 -0
- data/spec/fixtures/metanorma/m3d.rnc +41 -0
- data/spec/fixtures/metanorma/m3d.rng +122 -0
- data/spec/fixtures/metanorma/mpfd.rnc +36 -0
- data/spec/fixtures/metanorma/mpfd.rng +95 -0
- data/spec/fixtures/metanorma/nist.rnc +77 -0
- data/spec/fixtures/metanorma/nist.rng +216 -0
- data/spec/fixtures/metanorma/ogc.rnc +51 -0
- data/spec/fixtures/metanorma/ogc.rng +151 -0
- data/spec/fixtures/metanorma/reqt.rnc +6 -0
- data/spec/fixtures/metanorma/rsd.rnc +36 -0
- data/spec/fixtures/metanorma/rsd.rng +95 -0
- data/spec/fixtures/metanorma/un.rnc +103 -0
- data/spec/fixtures/metanorma/un.rng +367 -0
- data/spec/fixtures/rnc/base.rnc +4 -0
- data/spec/fixtures/rnc/grammar_with_trailing.rnc +8 -0
- data/spec/fixtures/rnc/main_include_trailing.rnc +3 -0
- data/spec/fixtures/rnc/main_with_include.rnc +5 -0
- data/spec/fixtures/rnc/test_augment.rnc +10 -0
- data/spec/fixtures/rnc/test_isodoc_simple.rnc +9 -0
- data/spec/fixtures/rnc/top_level_include.rnc +8 -0
- data/spec/fixtures/spectest_external/case_10_4.7/x +3 -0
- data/spec/fixtures/spectest_external/case_10_4.7/y +7 -0
- data/spec/fixtures/spectest_external/case_11_4.7/x +3 -0
- data/spec/fixtures/spectest_external/case_12_4.7/x +3 -0
- data/spec/fixtures/spectest_external/case_13_4.7/x +3 -0
- data/spec/fixtures/spectest_external/case_13_4.7/y +3 -0
- data/spec/fixtures/spectest_external/case_14_4.7/x +7 -0
- data/spec/fixtures/spectest_external/case_15_4.7/x +7 -0
- data/spec/fixtures/spectest_external/case_16_4.7/x +5 -0
- data/spec/fixtures/spectest_external/case_17_4.7/x +5 -0
- data/spec/fixtures/spectest_external/case_18_4.7/x +7 -0
- data/spec/fixtures/spectest_external/case_19_4.7/level1.rng +9 -0
- data/spec/fixtures/spectest_external/case_19_4.7/level2.rng +7 -0
- data/spec/fixtures/spectest_external/case_1_4.5/sub1/x +3 -0
- data/spec/fixtures/spectest_external/case_1_4.5/sub3/x +3 -0
- data/spec/fixtures/spectest_external/case_1_4.5/x +3 -0
- data/spec/fixtures/spectest_external/case_20_4.6/x +3 -0
- data/spec/fixtures/spectest_external/case_2_4.5/x +3 -0
- data/spec/fixtures/spectest_external/case_3_4.6/x +3 -0
- data/spec/fixtures/spectest_external/case_4_4.6/x +3 -0
- data/spec/fixtures/spectest_external/case_5_4.6/x +1 -0
- data/spec/fixtures/spectest_external/case_6_4.6/x +5 -0
- data/spec/fixtures/spectest_external/case_7_4.6/x +1 -0
- data/spec/fixtures/spectest_external/case_7_4.6/y +1 -0
- data/spec/fixtures/spectest_external/case_8_4.7/x +7 -0
- data/spec/fixtures/spectest_external/case_9_4.7/x +7 -0
- data/spec/fixtures/spectest_external/resources.json +149 -0
- data/spec/rng/advanced_rnc_spec.rb +101 -0
- data/spec/rng/compacttest_spec.rb +197 -0
- data/spec/rng/datatype_declaration_spec.rb +28 -0
- data/spec/rng/div_spec.rb +207 -0
- data/spec/rng/external_ref_resolver_spec.rb +122 -0
- data/spec/rng/metanorma_conversion_spec.rb +159 -0
- data/spec/rng/namespace_declaration_spec.rb +60 -0
- data/spec/rng/namespace_support_spec.rb +199 -0
- data/spec/rng/rnc_parser_spec.rb +498 -22
- data/spec/rng/rnc_roundtrip_spec.rb +96 -82
- data/spec/rng/rng_generation_spec.rb +288 -0
- data/spec/rng/roundtrip_spec.rb +342 -0
- data/spec/rng/schema_preamble_spec.rb +145 -0
- data/spec/rng/schema_spec.rb +68 -64
- data/spec/rng/spectest_spec.rb +168 -90
- data/spec/rng_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -42
- metadata +141 -8
data/lib/rng/define.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lutaml/model"
|
|
4
|
-
|
|
5
3
|
module Rng
|
|
6
4
|
class Define < Lutaml::Model::Serializable
|
|
7
5
|
attribute :name, :string
|
|
@@ -9,54 +7,59 @@ module Rng
|
|
|
9
7
|
attribute :id, :string
|
|
10
8
|
attribute :ns, :string
|
|
11
9
|
attribute :datatypeLibrary, :string
|
|
12
|
-
attribute :ref, Ref
|
|
10
|
+
attribute :ref, Ref, collection: true
|
|
13
11
|
attribute :element, Element, collection: true
|
|
14
|
-
attribute :choice, Choice
|
|
15
|
-
attribute :group, Group
|
|
16
|
-
attribute :interleave, Interleave
|
|
17
|
-
attribute :mixed, Mixed
|
|
18
|
-
attribute :optional, Optional
|
|
19
|
-
attribute :zeroOrMore, ZeroOrMore
|
|
20
|
-
attribute :oneOrMore, OneOrMore
|
|
21
|
-
attribute :text, Text
|
|
22
|
-
attribute :empty, Empty
|
|
23
|
-
attribute :value, Value
|
|
24
|
-
attribute :data, Data
|
|
25
|
-
attribute :list, List
|
|
26
|
-
attribute :notAllowed, NotAllowed
|
|
27
|
-
attribute :attribute, Attribute
|
|
28
|
-
attribute :grammar, Grammar
|
|
12
|
+
attribute :choice, Choice, collection: true
|
|
13
|
+
attribute :group, Group, collection: true
|
|
14
|
+
attribute :interleave, Interleave, collection: true
|
|
15
|
+
attribute :mixed, Mixed, collection: true
|
|
16
|
+
attribute :optional, Optional, collection: true
|
|
17
|
+
attribute :zeroOrMore, ZeroOrMore, collection: true
|
|
18
|
+
attribute :oneOrMore, OneOrMore, collection: true
|
|
19
|
+
attribute :text, Text, collection: true
|
|
20
|
+
attribute :empty, Empty, collection: true
|
|
21
|
+
attribute :value, Value, collection: true
|
|
22
|
+
attribute :data, Data, collection: true
|
|
23
|
+
attribute :list, List, collection: true
|
|
24
|
+
attribute :notAllowed, NotAllowed, collection: true
|
|
25
|
+
attribute :attribute, Attribute, collection: true
|
|
26
|
+
attribute :grammar, Grammar, collection: true
|
|
27
|
+
attribute :documentation, Documentation, collection: true
|
|
29
28
|
|
|
30
29
|
xml do
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
map_attribute
|
|
30
|
+
element 'define'
|
|
31
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
32
|
+
ordered
|
|
33
|
+
|
|
34
|
+
map_attribute 'name', to: :name
|
|
35
|
+
map_attribute 'combine', to: :combine
|
|
36
|
+
map_attribute 'id', to: :id
|
|
37
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
36
38
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
37
39
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
38
40
|
}
|
|
39
|
-
map_attribute
|
|
41
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
|
|
40
42
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
41
43
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
42
44
|
}
|
|
43
|
-
map_element
|
|
44
|
-
map_element
|
|
45
|
-
map_element
|
|
46
|
-
map_element
|
|
47
|
-
map_element
|
|
48
|
-
map_element
|
|
49
|
-
map_element
|
|
50
|
-
map_element
|
|
51
|
-
map_element
|
|
52
|
-
map_element
|
|
53
|
-
map_element
|
|
54
|
-
map_element
|
|
55
|
-
map_element
|
|
56
|
-
map_element
|
|
57
|
-
map_element
|
|
58
|
-
map_element
|
|
59
|
-
map_element
|
|
45
|
+
map_element 'ref', to: :ref
|
|
46
|
+
map_element 'element', to: :element
|
|
47
|
+
map_element 'choice', to: :choice
|
|
48
|
+
map_element 'group', to: :group
|
|
49
|
+
map_element 'interleave', to: :interleave
|
|
50
|
+
map_element 'mixed', to: :mixed
|
|
51
|
+
map_element 'optional', to: :optional
|
|
52
|
+
map_element 'zeroOrMore', to: :zeroOrMore
|
|
53
|
+
map_element 'oneOrMore', to: :oneOrMore
|
|
54
|
+
map_element 'text', to: :text
|
|
55
|
+
map_element 'empty', to: :empty
|
|
56
|
+
map_element 'value', to: :value
|
|
57
|
+
map_element 'data', to: :data
|
|
58
|
+
map_element 'list', to: :list
|
|
59
|
+
map_element 'notAllowed', to: :notAllowed
|
|
60
|
+
map_element 'attribute', to: :attribute
|
|
61
|
+
map_element 'grammar', to: :grammar
|
|
62
|
+
map_element 'documentation', to: :documentation
|
|
60
63
|
end
|
|
61
64
|
end
|
|
62
65
|
end
|
data/lib/rng/div.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rng
|
|
4
|
+
# Div element for documentation and grouping in RELAX NG schemas
|
|
5
|
+
class Div < Lutaml::Model::Serializable
|
|
6
|
+
attribute :id, :string
|
|
7
|
+
attribute :ns, :string
|
|
8
|
+
attribute :datatypeLibrary, :string
|
|
9
|
+
attribute :start, Start, collection: true, initialize_empty: true
|
|
10
|
+
attribute :define, Define, collection: true, initialize_empty: true
|
|
11
|
+
attribute :div, Div, collection: true, initialize_empty: true
|
|
12
|
+
attribute :include, Include, collection: true, initialize_empty: true
|
|
13
|
+
|
|
14
|
+
xml do
|
|
15
|
+
element 'div'
|
|
16
|
+
ordered
|
|
17
|
+
|
|
18
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
19
|
+
|
|
20
|
+
map_attribute 'id', to: :id
|
|
21
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
22
|
+
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
23
|
+
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
24
|
+
}
|
|
25
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
|
|
26
|
+
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
27
|
+
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
map_element 'start', to: :start
|
|
31
|
+
map_element 'define', to: :define
|
|
32
|
+
map_element 'div', to: :div
|
|
33
|
+
map_element 'include', to: :include
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/rng/element.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lutaml/model"
|
|
4
|
-
|
|
5
3
|
module Rng
|
|
6
4
|
class Element < Lutaml::Model::Serializable
|
|
7
5
|
attribute :attr_name, :string
|
|
@@ -10,14 +8,14 @@ module Rng
|
|
|
10
8
|
attribute :ns_name, NsName
|
|
11
9
|
attribute :datatypeLibrary, :string
|
|
12
10
|
attribute :id, :string
|
|
13
|
-
attribute :attribute, Attribute
|
|
11
|
+
attribute :attribute, Attribute, collection: true
|
|
14
12
|
attribute :ref, Ref, collection: true
|
|
15
|
-
attribute :choice, Choice
|
|
16
|
-
attribute :group, Group
|
|
17
|
-
attribute :interleave, Interleave
|
|
18
|
-
attribute :mixed, Mixed
|
|
19
|
-
attribute :optional, Optional
|
|
20
|
-
attribute :zeroOrMore, ZeroOrMore
|
|
13
|
+
attribute :choice, Choice, collection: true, initialize_empty: true
|
|
14
|
+
attribute :group, Group, collection: true, initialize_empty: true
|
|
15
|
+
attribute :interleave, Interleave, collection: true, initialize_empty: true
|
|
16
|
+
attribute :mixed, Mixed, collection: true, initialize_empty: true
|
|
17
|
+
attribute :optional, Optional, collection: true, initialize_empty: true
|
|
18
|
+
attribute :zeroOrMore, ZeroOrMore, collection: true, initialize_empty: true
|
|
21
19
|
attribute :oneOrMore, OneOrMore, collection: true
|
|
22
20
|
attribute :anyName, AnyName
|
|
23
21
|
attribute :text, Text
|
|
@@ -30,43 +28,47 @@ module Rng
|
|
|
30
28
|
attribute :grammar, Grammar
|
|
31
29
|
attribute :parent_ref, ParentRef
|
|
32
30
|
attribute :external_ref, ExternalRef
|
|
31
|
+
attribute :documentation, Documentation
|
|
33
32
|
|
|
34
33
|
xml do
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
element 'element'
|
|
35
|
+
ordered
|
|
36
|
+
|
|
37
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
37
38
|
|
|
38
|
-
map_attribute
|
|
39
|
-
map_attribute
|
|
39
|
+
map_attribute 'name', to: :attr_name
|
|
40
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
40
41
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
41
42
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
42
43
|
}
|
|
43
|
-
map_attribute
|
|
44
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
|
|
44
45
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
45
46
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
46
47
|
}
|
|
47
|
-
map_attribute
|
|
48
|
-
map_element
|
|
49
|
-
map_element
|
|
50
|
-
map_element
|
|
51
|
-
map_element
|
|
52
|
-
map_element
|
|
53
|
-
map_element
|
|
54
|
-
map_element
|
|
55
|
-
map_element
|
|
56
|
-
map_element
|
|
57
|
-
map_element
|
|
58
|
-
map_element
|
|
59
|
-
map_element
|
|
60
|
-
map_element
|
|
61
|
-
map_element
|
|
62
|
-
map_element
|
|
63
|
-
map_element
|
|
64
|
-
map_element
|
|
65
|
-
map_element
|
|
66
|
-
map_element
|
|
67
|
-
map_element
|
|
68
|
-
map_element
|
|
69
|
-
map_element
|
|
48
|
+
map_attribute 'id', to: :id
|
|
49
|
+
map_element 'name', to: :name
|
|
50
|
+
map_element 'nsName', to: :ns_name
|
|
51
|
+
map_element 'attribute', to: :attribute
|
|
52
|
+
map_element 'ref', to: :ref
|
|
53
|
+
map_element 'choice', to: :choice
|
|
54
|
+
map_element 'group', to: :group
|
|
55
|
+
map_element 'interleave', to: :interleave
|
|
56
|
+
map_element 'mixed', to: :mixed
|
|
57
|
+
map_element 'optional', to: :optional
|
|
58
|
+
map_element 'zeroOrMore', to: :zeroOrMore
|
|
59
|
+
map_element 'oneOrMore', to: :oneOrMore
|
|
60
|
+
map_element 'anyName', to: :anyName
|
|
61
|
+
map_element 'text', to: :text
|
|
62
|
+
map_element 'empty', to: :empty
|
|
63
|
+
map_element 'value', to: :value
|
|
64
|
+
map_element 'data', to: :data
|
|
65
|
+
map_element 'list', to: :list
|
|
66
|
+
map_element 'notAllowed', to: :notAllowed
|
|
67
|
+
map_element 'element', to: :element
|
|
68
|
+
map_element 'grammar', to: :grammar
|
|
69
|
+
map_element 'parentRef', to: :parent_ref
|
|
70
|
+
map_element 'externalRef', to: :external_ref
|
|
71
|
+
map_element 'documentation', to: :documentation
|
|
70
72
|
end
|
|
71
73
|
end
|
|
72
74
|
end
|
data/lib/rng/empty.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lutaml/model"
|
|
4
|
-
|
|
5
3
|
module Rng
|
|
6
4
|
class Empty < Lutaml::Model::Serializable
|
|
7
5
|
attribute :id, :string
|
|
@@ -9,15 +7,17 @@ module Rng
|
|
|
9
7
|
attribute :datatypeLibrary, :string
|
|
10
8
|
|
|
11
9
|
xml do
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
element 'empty'
|
|
11
|
+
ordered
|
|
12
|
+
|
|
13
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
14
14
|
|
|
15
|
-
map_attribute
|
|
16
|
-
map_attribute
|
|
15
|
+
map_attribute 'id', to: :id
|
|
16
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
17
17
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
18
18
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
19
19
|
}
|
|
20
|
-
map_attribute
|
|
20
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
data/lib/rng/except.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lutaml/model"
|
|
4
|
-
|
|
5
3
|
module Rng
|
|
6
4
|
class Except < Lutaml::Model::Serializable
|
|
7
5
|
attribute :id, :string
|
|
@@ -27,36 +25,38 @@ module Rng
|
|
|
27
25
|
attribute :notAllowed, NotAllowed, collection: true, initialize_empty: true
|
|
28
26
|
|
|
29
27
|
xml do
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
element 'except'
|
|
29
|
+
ordered
|
|
30
|
+
|
|
31
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
32
32
|
|
|
33
|
-
map_attribute
|
|
34
|
-
map_attribute
|
|
33
|
+
map_attribute 'id', to: :id
|
|
34
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
35
35
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
36
36
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
37
37
|
}
|
|
38
|
-
map_attribute
|
|
38
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
|
|
39
39
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
40
40
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
41
41
|
}
|
|
42
|
-
map_element
|
|
43
|
-
map_element
|
|
44
|
-
map_element
|
|
45
|
-
map_element
|
|
46
|
-
map_element
|
|
47
|
-
map_element
|
|
48
|
-
map_element
|
|
49
|
-
map_element
|
|
50
|
-
map_element
|
|
51
|
-
map_element
|
|
52
|
-
map_element
|
|
53
|
-
map_element
|
|
54
|
-
map_element
|
|
55
|
-
map_element
|
|
56
|
-
map_element
|
|
57
|
-
map_element
|
|
58
|
-
map_element
|
|
59
|
-
map_element
|
|
42
|
+
map_element 'name', to: :name
|
|
43
|
+
map_element 'element', to: :element
|
|
44
|
+
map_element 'attribute', to: :attribute
|
|
45
|
+
map_element 'ref', to: :ref
|
|
46
|
+
map_element 'choice', to: :choice
|
|
47
|
+
map_element 'group', to: :group
|
|
48
|
+
map_element 'interleave', to: :interleave
|
|
49
|
+
map_element 'mixed', to: :mixed
|
|
50
|
+
map_element 'optional', to: :optional
|
|
51
|
+
map_element 'zeroOrMore', to: :zeroOrMore
|
|
52
|
+
map_element 'oneOrMore', to: :oneOrMore
|
|
53
|
+
map_element 'text', to: :text
|
|
54
|
+
map_element 'empty', to: :empty
|
|
55
|
+
map_element 'value', to: :value
|
|
56
|
+
map_element 'data', to: :data
|
|
57
|
+
map_element 'list', to: :list
|
|
58
|
+
map_element 'notAllowed', to: :notAllowed
|
|
59
|
+
map_element 'nsName', to: :ns_name
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
data/lib/rng/external_ref.rb
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "lutaml/model"
|
|
4
|
-
|
|
5
3
|
module Rng
|
|
6
4
|
class ExternalRef < Lutaml::Model::Serializable
|
|
7
5
|
attribute :id, :string
|
|
8
6
|
attribute :ns, :string
|
|
9
7
|
attribute :datatypeLibrary, :string
|
|
10
8
|
attribute :href, :string
|
|
9
|
+
attribute :base, Lutaml::Xml::W3c::XmlBaseType
|
|
11
10
|
|
|
12
11
|
xml do
|
|
13
|
-
|
|
14
|
-
namespace
|
|
12
|
+
element 'externalRef'
|
|
13
|
+
namespace ::Rng::Namespaces::RngNamespace
|
|
15
14
|
|
|
16
|
-
map_attribute
|
|
17
|
-
map_attribute
|
|
15
|
+
map_attribute 'id', to: :id
|
|
16
|
+
map_attribute 'ns', to: :ns, value_map: {
|
|
18
17
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
19
18
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
20
19
|
}
|
|
21
|
-
map_attribute
|
|
20
|
+
map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
|
|
22
21
|
from: { empty: :empty, omitted: :omitted, nil: :nil },
|
|
23
22
|
to: { empty: :empty, omitted: :omitted, nil: :nil }
|
|
24
23
|
}
|
|
25
|
-
map_attribute
|
|
24
|
+
map_attribute 'href', to: :href
|
|
25
|
+
w3c_attributes :base
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|