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.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +63 -0
  3. data/.github/workflows/release.yml +8 -3
  4. data/.gitignore +11 -0
  5. data/.rubocop.yml +10 -7
  6. data/.rubocop_todo.yml +229 -23
  7. data/CHANGELOG.md +317 -0
  8. data/CLAUDE.md +139 -0
  9. data/Gemfile +11 -12
  10. data/README.adoc +1538 -11
  11. data/Rakefile +11 -3
  12. data/docs/Gemfile +8 -0
  13. data/docs/_config.yml +23 -0
  14. data/docs/getting-started/index.adoc +75 -0
  15. data/docs/guides/error-handling.adoc +137 -0
  16. data/docs/guides/external-references.adoc +128 -0
  17. data/docs/guides/index.adoc +24 -0
  18. data/docs/guides/parsing-rnc.adoc +141 -0
  19. data/docs/guides/parsing-rng-xml.adoc +81 -0
  20. data/docs/guides/rng-to-rnc.adoc +101 -0
  21. data/docs/guides/validation.adoc +85 -0
  22. data/docs/index.adoc +52 -0
  23. data/docs/reference/api.adoc +126 -0
  24. data/docs/reference/cli.adoc +182 -0
  25. data/docs/understanding/architecture.adoc +58 -0
  26. data/docs/understanding/rng-vs-rnc.adoc +118 -0
  27. data/exe/rng +5 -0
  28. data/lib/rng/any_name.rb +10 -8
  29. data/lib/rng/attribute.rb +28 -26
  30. data/lib/rng/choice.rb +24 -24
  31. data/lib/rng/cli.rb +607 -0
  32. data/lib/rng/data.rb +10 -10
  33. data/lib/rng/datatype_declaration.rb +26 -0
  34. data/lib/rng/define.rb +44 -41
  35. data/lib/rng/div.rb +36 -0
  36. data/lib/rng/documentation.rb +9 -0
  37. data/lib/rng/element.rb +39 -37
  38. data/lib/rng/empty.rb +7 -7
  39. data/lib/rng/except.rb +25 -25
  40. data/lib/rng/external_ref.rb +8 -8
  41. data/lib/rng/external_ref_resolver.rb +602 -0
  42. data/lib/rng/foreign_attribute.rb +26 -0
  43. data/lib/rng/foreign_element.rb +33 -0
  44. data/lib/rng/grammar.rb +14 -12
  45. data/lib/rng/group.rb +26 -24
  46. data/lib/rng/include.rb +5 -6
  47. data/lib/rng/include_processor.rb +461 -0
  48. data/lib/rng/interleave.rb +23 -23
  49. data/lib/rng/list.rb +22 -22
  50. data/lib/rng/mixed.rb +23 -23
  51. data/lib/rng/name.rb +6 -7
  52. data/lib/rng/namespace_declaration.rb +47 -0
  53. data/lib/rng/namespaces.rb +15 -0
  54. data/lib/rng/not_allowed.rb +7 -7
  55. data/lib/rng/ns_name.rb +9 -9
  56. data/lib/rng/one_or_more.rb +23 -23
  57. data/lib/rng/optional.rb +23 -23
  58. data/lib/rng/param.rb +7 -8
  59. data/lib/rng/parent_ref.rb +8 -8
  60. data/lib/rng/parse_tree_processor.rb +695 -0
  61. data/lib/rng/pattern.rb +7 -7
  62. data/lib/rng/ref.rb +8 -8
  63. data/lib/rng/rnc_builder.rb +927 -0
  64. data/lib/rng/rnc_parser.rb +605 -305
  65. data/lib/rng/rnc_to_rng_converter.rb +1408 -0
  66. data/lib/rng/schema_preamble.rb +73 -0
  67. data/lib/rng/schema_validator.rb +1622 -0
  68. data/lib/rng/start.rb +27 -25
  69. data/lib/rng/test_suite_parser.rb +168 -0
  70. data/lib/rng/text.rb +11 -8
  71. data/lib/rng/to_rnc.rb +4 -35
  72. data/lib/rng/value.rb +6 -7
  73. data/lib/rng/version.rb +1 -1
  74. data/lib/rng/zero_or_more.rb +23 -23
  75. data/lib/rng.rb +68 -17
  76. data/rng.gemspec +18 -19
  77. data/scripts/extract_spectest_resources.rb +96 -0
  78. data/spec/fixtures/compacttest.xml +2511 -0
  79. data/spec/fixtures/external/circular_a.rng +7 -0
  80. data/spec/fixtures/external/circular_b.rng +7 -0
  81. data/spec/fixtures/external/circular_main.rng +7 -0
  82. data/spec/fixtures/external/external_ref_lib.rng +7 -0
  83. data/spec/fixtures/external/external_ref_main.rng +7 -0
  84. data/spec/fixtures/external/include_lib.rng +7 -0
  85. data/spec/fixtures/external/include_main.rng +3 -0
  86. data/spec/fixtures/external/nested_chain.rng +6 -0
  87. data/spec/fixtures/external/nested_leaf.rng +7 -0
  88. data/spec/fixtures/external/nested_mid.rng +8 -0
  89. data/spec/fixtures/metanorma/3gpp.rnc +35 -0
  90. data/spec/fixtures/metanorma/3gpp.rng +105 -0
  91. data/spec/fixtures/metanorma/basicdoc.rnc +11 -0
  92. data/spec/fixtures/metanorma/bipm.rnc +148 -0
  93. data/spec/fixtures/metanorma/bipm.rng +376 -0
  94. data/spec/fixtures/metanorma/bsi.rnc +104 -0
  95. data/spec/fixtures/metanorma/bsi.rng +332 -0
  96. data/spec/fixtures/metanorma/csa.rnc +45 -0
  97. data/spec/fixtures/metanorma/csa.rng +131 -0
  98. data/spec/fixtures/metanorma/csd.rnc +43 -0
  99. data/spec/fixtures/metanorma/csd.rng +132 -0
  100. data/spec/fixtures/metanorma/gbstandard.rnc +99 -0
  101. data/spec/fixtures/metanorma/gbstandard.rng +316 -0
  102. data/spec/fixtures/metanorma/iec.rnc +49 -0
  103. data/spec/fixtures/metanorma/iec.rng +193 -0
  104. data/spec/fixtures/metanorma/ietf.rnc +275 -0
  105. data/spec/fixtures/metanorma/ietf.rng +925 -0
  106. data/spec/fixtures/metanorma/iho.rnc +58 -0
  107. data/spec/fixtures/metanorma/iho.rng +179 -0
  108. data/spec/fixtures/metanorma/isodoc.rnc +873 -0
  109. data/spec/fixtures/metanorma/isodoc.rng +2704 -0
  110. data/spec/fixtures/metanorma/isostandard-amd.rnc +43 -0
  111. data/spec/fixtures/metanorma/isostandard-amd.rng +108 -0
  112. data/spec/fixtures/metanorma/isostandard.rnc +166 -0
  113. data/spec/fixtures/metanorma/isostandard.rng +494 -0
  114. data/spec/fixtures/metanorma/itu.rnc +122 -0
  115. data/spec/fixtures/metanorma/itu.rng +377 -0
  116. data/spec/fixtures/metanorma/m3d.rnc +41 -0
  117. data/spec/fixtures/metanorma/m3d.rng +122 -0
  118. data/spec/fixtures/metanorma/mpfd.rnc +36 -0
  119. data/spec/fixtures/metanorma/mpfd.rng +95 -0
  120. data/spec/fixtures/metanorma/nist.rnc +77 -0
  121. data/spec/fixtures/metanorma/nist.rng +216 -0
  122. data/spec/fixtures/metanorma/ogc.rnc +51 -0
  123. data/spec/fixtures/metanorma/ogc.rng +151 -0
  124. data/spec/fixtures/metanorma/reqt.rnc +6 -0
  125. data/spec/fixtures/metanorma/rsd.rnc +36 -0
  126. data/spec/fixtures/metanorma/rsd.rng +95 -0
  127. data/spec/fixtures/metanorma/un.rnc +103 -0
  128. data/spec/fixtures/metanorma/un.rng +367 -0
  129. data/spec/fixtures/rnc/base.rnc +4 -0
  130. data/spec/fixtures/rnc/grammar_with_trailing.rnc +8 -0
  131. data/spec/fixtures/rnc/main_include_trailing.rnc +3 -0
  132. data/spec/fixtures/rnc/main_with_include.rnc +5 -0
  133. data/spec/fixtures/rnc/test_augment.rnc +10 -0
  134. data/spec/fixtures/rnc/test_isodoc_simple.rnc +9 -0
  135. data/spec/fixtures/rnc/top_level_include.rnc +8 -0
  136. data/spec/fixtures/spectest_external/case_10_4.7/x +3 -0
  137. data/spec/fixtures/spectest_external/case_10_4.7/y +7 -0
  138. data/spec/fixtures/spectest_external/case_11_4.7/x +3 -0
  139. data/spec/fixtures/spectest_external/case_12_4.7/x +3 -0
  140. data/spec/fixtures/spectest_external/case_13_4.7/x +3 -0
  141. data/spec/fixtures/spectest_external/case_13_4.7/y +3 -0
  142. data/spec/fixtures/spectest_external/case_14_4.7/x +7 -0
  143. data/spec/fixtures/spectest_external/case_15_4.7/x +7 -0
  144. data/spec/fixtures/spectest_external/case_16_4.7/x +5 -0
  145. data/spec/fixtures/spectest_external/case_17_4.7/x +5 -0
  146. data/spec/fixtures/spectest_external/case_18_4.7/x +7 -0
  147. data/spec/fixtures/spectest_external/case_19_4.7/level1.rng +9 -0
  148. data/spec/fixtures/spectest_external/case_19_4.7/level2.rng +7 -0
  149. data/spec/fixtures/spectest_external/case_1_4.5/sub1/x +3 -0
  150. data/spec/fixtures/spectest_external/case_1_4.5/sub3/x +3 -0
  151. data/spec/fixtures/spectest_external/case_1_4.5/x +3 -0
  152. data/spec/fixtures/spectest_external/case_20_4.6/x +3 -0
  153. data/spec/fixtures/spectest_external/case_2_4.5/x +3 -0
  154. data/spec/fixtures/spectest_external/case_3_4.6/x +3 -0
  155. data/spec/fixtures/spectest_external/case_4_4.6/x +3 -0
  156. data/spec/fixtures/spectest_external/case_5_4.6/x +1 -0
  157. data/spec/fixtures/spectest_external/case_6_4.6/x +5 -0
  158. data/spec/fixtures/spectest_external/case_7_4.6/x +1 -0
  159. data/spec/fixtures/spectest_external/case_7_4.6/y +1 -0
  160. data/spec/fixtures/spectest_external/case_8_4.7/x +7 -0
  161. data/spec/fixtures/spectest_external/case_9_4.7/x +7 -0
  162. data/spec/fixtures/spectest_external/resources.json +149 -0
  163. data/spec/rng/advanced_rnc_spec.rb +101 -0
  164. data/spec/rng/compacttest_spec.rb +197 -0
  165. data/spec/rng/datatype_declaration_spec.rb +28 -0
  166. data/spec/rng/div_spec.rb +207 -0
  167. data/spec/rng/external_ref_resolver_spec.rb +122 -0
  168. data/spec/rng/metanorma_conversion_spec.rb +159 -0
  169. data/spec/rng/namespace_declaration_spec.rb +60 -0
  170. data/spec/rng/namespace_support_spec.rb +199 -0
  171. data/spec/rng/rnc_parser_spec.rb +498 -22
  172. data/spec/rng/rnc_roundtrip_spec.rb +96 -82
  173. data/spec/rng/rng_generation_spec.rb +288 -0
  174. data/spec/rng/roundtrip_spec.rb +342 -0
  175. data/spec/rng/schema_preamble_spec.rb +145 -0
  176. data/spec/rng/schema_spec.rb +68 -64
  177. data/spec/rng/spectest_spec.rb +168 -90
  178. data/spec/rng_spec.rb +2 -2
  179. data/spec/spec_helper.rb +7 -42
  180. metadata +141 -8
data/lib/rng/list.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 List < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -24,33 +22,35 @@ module Rng
24
22
  attribute :notAllowed, NotAllowed, collection: true, initialize_empty: true
25
23
 
26
24
  xml do
27
- root "list", ordered: true
28
- namespace "http://relaxng.org/ns/structure/1.0"
25
+ element 'list'
26
+ ordered
27
+
28
+ namespace ::Rng::Namespaces::RngNamespace
29
29
 
30
- map_attribute "id", to: :id
31
- map_attribute "ns", to: :ns, value_map: {
30
+ map_attribute 'id', to: :id
31
+ map_attribute 'ns', to: :ns, value_map: {
32
32
  from: { empty: :empty, omitted: :omitted, nil: :nil },
33
33
  to: { empty: :empty, omitted: :omitted, nil: :nil }
34
34
  }
35
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
35
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
36
36
  from: { empty: :empty, omitted: :omitted, nil: :nil },
37
37
  to: { empty: :empty, omitted: :omitted, nil: :nil }
38
38
  }
39
- map_element "element", to: :element
40
- map_element "attribute", to: :attribute
41
- map_element "ref", to: :ref
42
- map_element "choice", to: :choice
43
- map_element "group", to: :group
44
- map_element "interleave", to: :interleave
45
- map_element "mixed", to: :mixed
46
- map_element "optional", to: :optional
47
- map_element "zeroOrMore", to: :zeroOrMore
48
- map_element "oneOrMore", to: :oneOrMore
49
- map_element "text", to: :text
50
- map_element "empty", to: :empty
51
- map_element "value", to: :value
52
- map_element "data", to: :data
53
- map_element "notAllowed", to: :notAllowed
39
+ map_element 'element', to: :element
40
+ map_element 'attribute', to: :attribute
41
+ map_element 'ref', to: :ref
42
+ map_element 'choice', to: :choice
43
+ map_element 'group', to: :group
44
+ map_element 'interleave', to: :interleave
45
+ map_element 'mixed', to: :mixed
46
+ map_element 'optional', to: :optional
47
+ map_element 'zeroOrMore', to: :zeroOrMore
48
+ map_element 'oneOrMore', to: :oneOrMore
49
+ map_element 'text', to: :text
50
+ map_element 'empty', to: :empty
51
+ map_element 'value', to: :value
52
+ map_element 'data', to: :data
53
+ map_element 'notAllowed', to: :notAllowed
54
54
  end
55
55
  end
56
56
  end
data/lib/rng/mixed.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 Mixed < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -25,34 +23,36 @@ module Rng
25
23
  attribute :notAllowed, NotAllowed, collection: true, initialize_empty: true
26
24
 
27
25
  xml do
28
- root "mixed", ordered: true
29
- namespace "http://relaxng.org/ns/structure/1.0"
26
+ element 'mixed'
27
+ ordered
28
+
29
+ namespace ::Rng::Namespaces::RngNamespace
30
30
 
31
- map_attribute "id", to: :id
32
- map_attribute "ns", to: :ns, value_map: {
31
+ map_attribute 'id', to: :id
32
+ map_attribute 'ns', to: :ns, value_map: {
33
33
  from: { empty: :empty, omitted: :omitted, nil: :nil },
34
34
  to: { empty: :empty, omitted: :omitted, nil: :nil }
35
35
  }
36
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
36
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
37
37
  from: { empty: :empty, omitted: :omitted, nil: :nil },
38
38
  to: { empty: :empty, omitted: :omitted, nil: :nil }
39
39
  }
40
- map_element "element", to: :element
41
- map_element "attribute", to: :attribute
42
- map_element "ref", to: :ref
43
- map_element "choice", to: :choice
44
- map_element "group", to: :group
45
- map_element "interleave", to: :interleave
46
- map_element "mixed", to: :mixed
47
- map_element "optional", to: :optional
48
- map_element "zeroOrMore", to: :zeroOrMore
49
- map_element "oneOrMore", to: :oneOrMore
50
- map_element "text", to: :text
51
- map_element "empty", to: :empty
52
- map_element "value", to: :value
53
- map_element "data", to: :data
54
- map_element "list", to: :list
55
- map_element "notAllowed", to: :notAllowed
40
+ map_element 'element', to: :element
41
+ map_element 'attribute', to: :attribute
42
+ map_element 'ref', to: :ref
43
+ map_element 'choice', to: :choice
44
+ map_element 'group', to: :group
45
+ map_element 'interleave', to: :interleave
46
+ map_element 'mixed', to: :mixed
47
+ map_element 'optional', to: :optional
48
+ map_element 'zeroOrMore', to: :zeroOrMore
49
+ map_element 'oneOrMore', to: :oneOrMore
50
+ map_element 'text', to: :text
51
+ map_element 'empty', to: :empty
52
+ map_element 'value', to: :value
53
+ map_element 'data', to: :data
54
+ map_element 'list', to: :list
55
+ map_element 'notAllowed', to: :notAllowed
56
56
  end
57
57
  end
58
58
  end
data/lib/rng/name.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 Name < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -10,15 +8,16 @@ module Rng
10
8
  attribute :value, :string
11
9
 
12
10
  xml do
13
- root "name", ordered: true
14
- namespace "http://relaxng.org/ns/structure/1.0"
11
+ element 'name'
12
+
13
+ namespace ::Rng::Namespaces::RngNamespace
15
14
 
16
- map_attribute "id", to: :id
17
- map_attribute "ns", to: :ns, value_map: {
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 "datatypeLibrary", to: :datatypeLibrary, value_map: {
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
  }
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rng
4
+ # Represents a namespace declaration in RNC
5
+ #
6
+ # Supports both default and prefixed namespace declarations:
7
+ # - default namespace = "uri"
8
+ # - default namespace prefix = "uri"
9
+ # - namespace prefix = "uri"
10
+ #
11
+ # @example Default namespace
12
+ # decl = NamespaceDeclaration.new(uri: "http://example.com", is_default: true)
13
+ # decl.default? #=> true
14
+ #
15
+ # @example Prefixed namespace
16
+ # decl = NamespaceDeclaration.new(prefix: "eg", uri: "http://example.com")
17
+ # decl.prefixed? #=> true
18
+ #
19
+ class NamespaceDeclaration
20
+ attr_reader :prefix, :uri, :is_default
21
+
22
+ # Initialize a namespace declaration
23
+ #
24
+ # @param prefix [String, nil] Namespace prefix (nil for unprefixed default)
25
+ # @param uri [String] Namespace URI
26
+ # @param is_default [Boolean] Whether this is the default namespace
27
+ def initialize(uri:, prefix: nil, is_default: false)
28
+ @prefix = prefix
29
+ @uri = uri
30
+ @is_default = is_default
31
+ end
32
+
33
+ # Check if this is the default namespace
34
+ #
35
+ # @return [Boolean]
36
+ def default?
37
+ @is_default
38
+ end
39
+
40
+ # Check if this namespace has a prefix
41
+ #
42
+ # @return [Boolean]
43
+ def prefixed?
44
+ !@prefix.nil?
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rng
4
+ module Namespaces
5
+ class RngNamespace < Lutaml::Xml::Namespace
6
+ uri 'http://relaxng.org/ns/structure/1.0'
7
+ prefix_default 'rng'
8
+ end
9
+
10
+ class AnnotationNamespace < Lutaml::Xml::Namespace
11
+ uri 'http://relaxng.org/ns/compatibility/annotations/1.0'
12
+ prefix_default 'a'
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/model"
4
-
5
3
  module Rng
6
4
  class NotAllowed < 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
- root "notAllowed", ordered: true
13
- namespace "http://relaxng.org/ns/structure/1.0"
10
+ element 'notAllowed'
11
+ ordered
12
+
13
+ namespace ::Rng::Namespaces::RngNamespace
14
14
 
15
- map_attribute "id", to: :id
16
- map_attribute "ns", to: :ns, value_map: {
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 "datatypeLibrary", to: :datatypeLibrary
20
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary
21
21
  end
22
22
  end
23
23
  end
data/lib/rng/ns_name.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 NsName < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -11,21 +9,23 @@ module Rng
11
9
  attribute :except, Except
12
10
 
13
11
  xml do
14
- root "nsName", ordered: true
15
- namespace "http://relaxng.org/ns/structure/1.0"
12
+ element 'nsName'
13
+ ordered
14
+
15
+ namespace ::Rng::Namespaces::RngNamespace
16
16
 
17
- map_attribute "id", to: :id
18
- map_attribute "ns", to: :ns, value_map: {
17
+ map_attribute 'id', to: :id
18
+ map_attribute 'ns', to: :ns, value_map: {
19
19
  from: { empty: :empty, omitted: :omitted, nil: :nil },
20
20
  to: { empty: :empty, omitted: :omitted, nil: :nil }
21
21
  }
22
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
22
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
23
23
  from: { empty: :empty, omitted: :omitted, nil: :nil },
24
24
  to: { empty: :empty, omitted: :omitted, nil: :nil }
25
25
  }
26
- map_attribute "name", to: :name
26
+ map_attribute 'name', to: :name
27
27
 
28
- map_element "except", to: :except
28
+ map_element 'except', to: :except
29
29
  end
30
30
  end
31
31
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/model"
4
-
5
3
  module Rng
6
4
  class OneOrMore < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -25,34 +23,36 @@ module Rng
25
23
  attribute :notAllowed, NotAllowed, collection: true, initialize_empty: true
26
24
 
27
25
  xml do
28
- root "oneOrMore", ordered: true
29
- namespace "http://relaxng.org/ns/structure/1.0"
26
+ element 'oneOrMore'
27
+ ordered
28
+
29
+ namespace ::Rng::Namespaces::RngNamespace
30
30
 
31
- map_attribute "id", to: :id
32
- map_attribute "ns", to: :ns, value_map: {
31
+ map_attribute 'id', to: :id
32
+ map_attribute 'ns', to: :ns, value_map: {
33
33
  from: { empty: :empty, omitted: :omitted, nil: :nil },
34
34
  to: { empty: :empty, omitted: :omitted, nil: :nil }
35
35
  }
36
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
36
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
37
37
  from: { empty: :empty, omitted: :omitted, nil: :nil },
38
38
  to: { empty: :empty, omitted: :omitted, nil: :nil }
39
39
  }
40
- map_element "element", to: :element
41
- map_element "attribute", to: :attribute
42
- map_element "ref", to: :ref
43
- map_element "choice", to: :choice
44
- map_element "group", to: :group
45
- map_element "interleave", to: :interleave
46
- map_element "mixed", to: :mixed
47
- map_element "optional", to: :optional
48
- map_element "zeroOrMore", to: :zeroOrMore
49
- map_element "oneOrMore", to: :oneOrMore
50
- map_element "text", to: :text
51
- map_element "empty", to: :empty
52
- map_element "value", to: :value
53
- map_element "data", to: :data
54
- map_element "list", to: :list
55
- map_element "notAllowed", to: :notAllowed
40
+ map_element 'element', to: :element
41
+ map_element 'attribute', to: :attribute
42
+ map_element 'ref', to: :ref
43
+ map_element 'choice', to: :choice
44
+ map_element 'group', to: :group
45
+ map_element 'interleave', to: :interleave
46
+ map_element 'mixed', to: :mixed
47
+ map_element 'optional', to: :optional
48
+ map_element 'zeroOrMore', to: :zeroOrMore
49
+ map_element 'oneOrMore', to: :oneOrMore
50
+ map_element 'text', to: :text
51
+ map_element 'empty', to: :empty
52
+ map_element 'value', to: :value
53
+ map_element 'data', to: :data
54
+ map_element 'list', to: :list
55
+ map_element 'notAllowed', to: :notAllowed
56
56
  end
57
57
  end
58
58
  end
data/lib/rng/optional.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 Optional < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -25,34 +23,36 @@ module Rng
25
23
  attribute :notAllowed, NotAllowed, collection: true, initialize_empty: true
26
24
 
27
25
  xml do
28
- root "optional", ordered: true
29
- namespace "http://relaxng.org/ns/structure/1.0"
26
+ element 'optional'
27
+ ordered
28
+
29
+ namespace ::Rng::Namespaces::RngNamespace
30
30
 
31
- map_attribute "id", to: :id
32
- map_attribute "ns", to: :ns, value_map: {
31
+ map_attribute 'id', to: :id
32
+ map_attribute 'ns', to: :ns, value_map: {
33
33
  from: { empty: :empty, omitted: :omitted, nil: :nil },
34
34
  to: { empty: :empty, omitted: :omitted, nil: :nil }
35
35
  }
36
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
36
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
37
37
  from: { empty: :empty, omitted: :omitted, nil: :nil },
38
38
  to: { empty: :empty, omitted: :omitted, nil: :nil }
39
39
  }
40
- map_element "element", to: :element
41
- map_element "attribute", to: :attribute
42
- map_element "ref", to: :ref
43
- map_element "choice", to: :choice
44
- map_element "group", to: :group
45
- map_element "interleave", to: :interleave
46
- map_element "mixed", to: :mixed
47
- map_element "optional", to: :optional
48
- map_element "zeroOrMore", to: :zeroOrMore
49
- map_element "oneOrMore", to: :oneOrMore
50
- map_element "text", to: :text
51
- map_element "empty", to: :empty
52
- map_element "value", to: :value
53
- map_element "data", to: :data
54
- map_element "list", to: :list
55
- map_element "notAllowed", to: :notAllowed
40
+ map_element 'element', to: :element
41
+ map_element 'attribute', to: :attribute
42
+ map_element 'ref', to: :ref
43
+ map_element 'choice', to: :choice
44
+ map_element 'group', to: :group
45
+ map_element 'interleave', to: :interleave
46
+ map_element 'mixed', to: :mixed
47
+ map_element 'optional', to: :optional
48
+ map_element 'zeroOrMore', to: :zeroOrMore
49
+ map_element 'oneOrMore', to: :oneOrMore
50
+ map_element 'text', to: :text
51
+ map_element 'empty', to: :empty
52
+ map_element 'value', to: :value
53
+ map_element 'data', to: :data
54
+ map_element 'list', to: :list
55
+ map_element 'notAllowed', to: :notAllowed
56
56
  end
57
57
  end
58
58
  end
data/lib/rng/param.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 Param < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -11,19 +9,20 @@ module Rng
11
9
  attribute :value, :string
12
10
 
13
11
  xml do
14
- root "param", ordered: true
15
- namespace "http://relaxng.org/ns/structure/1.0"
12
+ element 'param'
13
+
14
+ namespace ::Rng::Namespaces::RngNamespace
16
15
 
17
- map_attribute "id", to: :id
18
- map_attribute "ns", to: :ns, value_map: {
16
+ map_attribute 'id', to: :id
17
+ map_attribute 'ns', to: :ns, value_map: {
19
18
  from: { empty: :empty, omitted: :omitted, nil: :nil },
20
19
  to: { empty: :empty, omitted: :omitted, nil: :nil }
21
20
  }
22
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
21
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
23
22
  from: { empty: :empty, omitted: :omitted, nil: :nil },
24
23
  to: { empty: :empty, omitted: :omitted, nil: :nil }
25
24
  }
26
- map_attribute "name", to: :name
25
+ map_attribute 'name', to: :name
27
26
  map_content to: :value
28
27
  end
29
28
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/model"
4
-
5
3
  module Rng
6
4
  class ParentRef < Lutaml::Model::Serializable
7
5
  attribute :id, :string
@@ -10,19 +8,21 @@ module Rng
10
8
  attribute :name, :string
11
9
 
12
10
  xml do
13
- root "parentRef", ordered: true
14
- namespace "http://relaxng.org/ns/structure/1.0"
11
+ element 'parentRef'
12
+ ordered
13
+
14
+ namespace ::Rng::Namespaces::RngNamespace
15
15
 
16
- map_attribute "id", to: :id
17
- map_attribute "ns", to: :ns, value_map: {
16
+ map_attribute 'id', to: :id
17
+ map_attribute 'ns', to: :ns, value_map: {
18
18
  from: { empty: :empty, omitted: :omitted, nil: :nil },
19
19
  to: { empty: :empty, omitted: :omitted, nil: :nil }
20
20
  }
21
- map_attribute "datatypeLibrary", to: :datatypeLibrary, value_map: {
21
+ map_attribute 'datatypeLibrary', to: :datatypeLibrary, value_map: {
22
22
  from: { empty: :empty, omitted: :omitted, nil: :nil },
23
23
  to: { empty: :empty, omitted: :omitted, nil: :nil }
24
24
  }
25
- map_attribute "name", to: :name
25
+ map_attribute 'name', to: :name
26
26
  end
27
27
  end
28
28
  end