lutaml-model 0.8.201 → 0.8.202
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/scripts/test_installed_gem.rb +1 -13
- data/.github/workflows/downstream-performance.yml +1 -22
- data/.github/workflows/performance.yml +1 -33
- data/.github/workflows/rake.yml +2 -6
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -4
- data/Gemfile +0 -23
- data/README.adoc +25 -86
- data/Rakefile +2 -167
- data/docs/_guides/advanced-mapping.adoc +6 -6
- data/docs/_guides/character-encoding.adoc +0 -3
- data/docs/_guides/gem-integration.adoc +1 -1
- data/docs/_guides/index.adoc +0 -4
- data/docs/_guides/xml/type-namespaces.adoc +1 -1
- data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
- data/docs/_guides/xml-namespaces.adoc +2 -3
- data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
- data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
- data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
- data/docs/_pages/comparison-with-shale.adoc +1 -1
- data/docs/_pages/configuration.adoc +6 -40
- data/docs/_pages/index.adoc +0 -1
- data/docs/_pages/serialization_adapters.adoc +4 -16
- data/docs/_references/architecture.adoc +1 -1
- data/docs/_references/lutaml-namespace-planning.md +1 -1
- data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
- data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
- data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
- data/docs/architecture.md +7 -11
- data/docs/conversion_caching.adoc +1 -1
- data/docs/index.adoc +0 -1
- data/docs/key_value_data_model.adoc +1 -1
- data/docs/namespace-management.adoc +4 -10
- data/lib/lutaml/json/format.rb +0 -1
- data/lib/lutaml/json/generator_options.rb +0 -1
- data/lib/lutaml/key_value/transform.rb +9 -16
- data/lib/lutaml/lml/document_builder.rb +2 -2
- data/lib/lutaml/lml/entity_types.rb +2 -2
- data/lib/lutaml/model/adapter_resolver.rb +5 -15
- data/lib/lutaml/model/cached_type_resolver.rb +1 -7
- data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
- data/lib/lutaml/model/global_context.rb +3 -5
- data/lib/lutaml/model/instrumentation.rb +0 -3
- data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
- data/lib/lutaml/model/register.rb +20 -31
- data/lib/lutaml/model/runtime_compatibility.rb +0 -92
- data/lib/lutaml/model/schema/class_loader.rb +2 -4
- data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
- data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
- data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
- data/lib/lutaml/model/serialize/model_import.rb +0 -5
- data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
- data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
- data/lib/lutaml/model/store.rb +10 -17
- data/lib/lutaml/model/toml.rb +0 -2
- data/lib/lutaml/model/transformation_registry.rb +3 -7
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model.rb +3 -19
- data/lib/lutaml/toml/format.rb +4 -8
- data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
- data/lib/lutaml/xml/adapter.rb +0 -4
- data/lib/lutaml/xml/adapter_loader.rb +1 -6
- data/lib/lutaml/xml/builder/base.rb +0 -3
- data/lib/lutaml/xml/builder.rb +0 -8
- data/lib/lutaml/xml/data_model.rb +1 -1
- data/lib/lutaml/xml/doctype_extractor.rb +3 -3
- data/lib/lutaml/xml/format.rb +22 -74
- data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
- data/lib/lutaml/xml/model_transform.rb +14 -24
- data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
- data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
- data/lib/lutaml/xml/schema/builder.rb +6 -9
- data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
- data/lib/lutaml/xml/xml_element.rb +3 -2
- data/lib/lutaml/xml/xsd_validator.rb +4 -11
- data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
- data/lib/lutaml/yamls/adapter_loader.rb +1 -5
- data/lib/tasks/performance_comparator.rb +1 -1
- data/lutaml-model.gemspec +3 -8
- data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
- data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
- data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
- data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
- data/spec/lutaml/model/cdata_spec.rb +2 -15
- data/spec/lutaml/model/encoding_spec.rb +0 -9
- data/spec/lutaml/model/except_spec.rb +0 -7
- data/spec/lutaml/model/json_spec.rb +0 -14
- data/spec/lutaml/model/mixed_content_spec.rb +6 -46
- data/spec/lutaml/model/ordered_content_spec.rb +0 -7
- data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
- data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
- data/spec/lutaml/model/serializable_spec.rb +0 -2
- data/spec/lutaml/model/toml_spec.rb +0 -23
- data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
- data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
- data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
- data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
- data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
- data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
- data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
- data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
- data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
- data/spec/lutaml/xml/mapping_spec.rb +8 -15
- data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
- data/spec/lutaml/xml/namespace_spec.rb +0 -13
- data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
- data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
- data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
- data/spec/lutaml/xml/xml_spec.rb +2 -88
- data/spec/spec_helper.rb +5 -24
- data/spec/support/test_adapter_config.rb +6 -6
- metadata +1 -32
- data/.github/workflows/js-pr-check.yml +0 -106
- data/.github/workflows/js-sync.yml +0 -55
- data/.github/workflows/opal.yml +0 -65
- data/.gitmodules +0 -6
- data/.rspec-opal +0 -5
- data/docs/_guides/opal.adoc +0 -232
- data/lib/compat/opal/generate_boot.rb +0 -137
- data/lib/compat/opal/js_bundle_entry.rb +0 -42
- data/lib/compat/opal/lutaml_model_boot.rb +0 -638
- data/lib/compat/opal/monitor.rb +0 -31
- data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
- data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
- data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
- data/lib/compat/opal/moxml_boot.rb +0 -68
- data/lib/compat/opal/objectspace_shim.rb +0 -23
- data/lib/compat/opal/rexml/namespace.rb +0 -59
- data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
- data/lib/compat/opal/rexml/source.rb +0 -214
- data/lib/compat/opal/rexml/text.rb +0 -426
- data/lib/compat/opal/rexml/xmltokens.rb +0 -45
- data/lib/compat/opal/rexml_compat.rb +0 -85
- data/lib/compat/opal/yaml_compat.rb +0 -32
- data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
- data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
- data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
- data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
- data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
- data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
- data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
- data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
- data/spec/support/opal.rb +0 -9
data/lib/compat/opal/monitor.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Opal shim: the monitor stdlib (MonitorMixin) is not packaged for
|
|
4
|
-
# Opal, and moxml 0.6's NativeAttachment requires it at load time.
|
|
5
|
-
# The JS runtime is single-threaded, so the monitor contract reduces
|
|
6
|
-
# to pass-through: synchronize yields, lock/try_lock succeed, unlock
|
|
7
|
-
# is a no-op. Aliases cover the MonitorMixin spellings.
|
|
8
|
-
#
|
|
9
|
-
class Monitor # rubocop:disable Naming/PredicateMethod -- stdlib spellings
|
|
10
|
-
def synchronize
|
|
11
|
-
yield
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def lock; end
|
|
15
|
-
|
|
16
|
-
def try_lock
|
|
17
|
-
true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def unlock; end
|
|
21
|
-
|
|
22
|
-
def locked?
|
|
23
|
-
false
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
alias mon_enter lock
|
|
27
|
-
alias mon_exit unlock
|
|
28
|
-
alias mon_synchronize synchronize
|
|
29
|
-
alias mon_locked? locked?
|
|
30
|
-
alias mon_try_lock try_lock
|
|
31
|
-
end
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rexml/formatters/pretty"
|
|
4
|
-
|
|
5
|
-
module Moxml
|
|
6
|
-
module Adapter
|
|
7
|
-
module CustomizedRexml
|
|
8
|
-
# Custom REXML formatter that fixes indentation and wrapping issues
|
|
9
|
-
class Formatter < ::REXML::Formatters::Pretty
|
|
10
|
-
def initialize(indentation: 2, self_close_empty: false, adapter: nil)
|
|
11
|
-
@indentation = " " * indentation
|
|
12
|
-
@level = 0
|
|
13
|
-
@compact = true
|
|
14
|
-
@width = -1 # Disable line wrapping
|
|
15
|
-
@self_close_empty = self_close_empty
|
|
16
|
-
@adapter = adapter
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def write(node, output)
|
|
20
|
-
case node
|
|
21
|
-
when ::REXML::XMLDecl
|
|
22
|
-
write_declaration(node, output)
|
|
23
|
-
when ::Moxml::Adapter::CustomizedRexml::EntityReference
|
|
24
|
-
output << "&#{node.name};"
|
|
25
|
-
else
|
|
26
|
-
super
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def indented?
|
|
31
|
-
!@indentation.empty?
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def write_element(node, output)
|
|
35
|
-
output << "<#{node.expanded_name}"
|
|
36
|
-
write_attributes(node, output)
|
|
37
|
-
|
|
38
|
-
# Check for entity refs stored in adapter attachments
|
|
39
|
-
entity_refs = @adapter&.attachments&.get(node, :entity_refs)
|
|
40
|
-
child_sequence = @adapter&.attachments&.get(node, :child_sequence)
|
|
41
|
-
|
|
42
|
-
has_no_children = node.children.empty? && !(entity_refs && !entity_refs.empty?)
|
|
43
|
-
|
|
44
|
-
if has_no_children && @self_close_empty
|
|
45
|
-
output << "/>"
|
|
46
|
-
return
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
output << ">"
|
|
50
|
-
|
|
51
|
-
has_text = node.children.any? { |c| c.is_a?(::REXML::Text) && !c.to_s.strip.empty? }
|
|
52
|
-
has_elements = node.children.any?(::REXML::Element)
|
|
53
|
-
indent_children = indented? && has_elements && !has_text
|
|
54
|
-
|
|
55
|
-
# Handle children based on content type
|
|
56
|
-
all_children_empty = node.children.empty? && !(entity_refs && !entity_refs.empty?)
|
|
57
|
-
unless all_children_empty
|
|
58
|
-
@level += @indentation.length if indent_children
|
|
59
|
-
|
|
60
|
-
if entity_refs && !entity_refs.empty? && child_sequence
|
|
61
|
-
eref_idx = 0
|
|
62
|
-
native_idx = 0
|
|
63
|
-
child_sequence.each do |type|
|
|
64
|
-
case type
|
|
65
|
-
when :native
|
|
66
|
-
if native_idx < node.children.size
|
|
67
|
-
child = node.children[native_idx]
|
|
68
|
-
native_idx += 1
|
|
69
|
-
next if child.is_a?(::REXML::Text) &&
|
|
70
|
-
child.to_s.strip.empty? &&
|
|
71
|
-
!(child.next_sibling.nil? && child.previous_sibling.nil?)
|
|
72
|
-
|
|
73
|
-
output << "\n" << (" " * @level) if indent_children
|
|
74
|
-
write(child, output)
|
|
75
|
-
end
|
|
76
|
-
when :eref
|
|
77
|
-
if eref_idx < entity_refs.size
|
|
78
|
-
output << "\n" << (" " * @level) if indent_children
|
|
79
|
-
write(entity_refs[eref_idx], output)
|
|
80
|
-
eref_idx += 1
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
else
|
|
85
|
-
node.children.each_with_index do |child, _index|
|
|
86
|
-
next if child.is_a?(::REXML::Text) &&
|
|
87
|
-
child.to_s.strip.empty? &&
|
|
88
|
-
!(child.next_sibling.nil? && child.previous_sibling.nil?)
|
|
89
|
-
|
|
90
|
-
output << "\n" << (" " * @level) if indent_children
|
|
91
|
-
write(child, output)
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
if indent_children
|
|
96
|
-
@level -= @indentation.length
|
|
97
|
-
output << "\n" << (" " * @level)
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
output << "</#{node.expanded_name}>"
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def write_text(node, output)
|
|
105
|
-
text = node.value
|
|
106
|
-
return if text.empty?
|
|
107
|
-
|
|
108
|
-
output << escape_text(text)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def escape_text(text)
|
|
112
|
-
text.to_s.gsub(/[<>&]/) do |match|
|
|
113
|
-
case match
|
|
114
|
-
when "<" then "<"
|
|
115
|
-
when ">" then ">"
|
|
116
|
-
when "&" then "&"
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
private
|
|
122
|
-
|
|
123
|
-
def find_significant_sibling(node, direction)
|
|
124
|
-
method = direction == :next ? :next_sibling : :previous_sibling
|
|
125
|
-
sibling = node.send(method)
|
|
126
|
-
sibling = sibling.send(method) while sibling.is_a?(::REXML::Text) && sibling.to_s.strip.empty?
|
|
127
|
-
sibling
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def write_cdata(node, output)
|
|
131
|
-
# output << ' ' * @level
|
|
132
|
-
output << ::REXML::CData::START
|
|
133
|
-
output << node.to_s.gsub(::REXML::CData::STOP, "]]]]><![CDATA[>")
|
|
134
|
-
output << ::REXML::CData::STOP
|
|
135
|
-
# output << "\n"
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def write_comment(node, output)
|
|
139
|
-
# output << ' ' * @level
|
|
140
|
-
output << "<!--"
|
|
141
|
-
output << node.to_s
|
|
142
|
-
output << "-->"
|
|
143
|
-
# output << "\n"
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
def write_instruction(node, output)
|
|
147
|
-
# output << ' ' * @level
|
|
148
|
-
output << "<?"
|
|
149
|
-
output << node.target
|
|
150
|
-
output << " "
|
|
151
|
-
output << node.content if node.content
|
|
152
|
-
output << "?>"
|
|
153
|
-
# output << "\n"
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def write_document(node, output)
|
|
157
|
-
node.children.each do |child|
|
|
158
|
-
write(child, output)
|
|
159
|
-
# output << "\n" unless child == node.children.last
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def write_doctype(node, output)
|
|
164
|
-
output << "<!DOCTYPE "
|
|
165
|
-
output << node.name
|
|
166
|
-
output << " "
|
|
167
|
-
output << node.external_id if node.external_id
|
|
168
|
-
output << ">"
|
|
169
|
-
# output << "\n"
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def write_declaration(node, output)
|
|
173
|
-
output << "<?xml"
|
|
174
|
-
output << %( version="#{node.version}") if node.version
|
|
175
|
-
if node.writeencoding
|
|
176
|
-
output << %( encoding="#{node.encoding.to_s.upcase}")
|
|
177
|
-
end
|
|
178
|
-
output << %( standalone="#{node.standalone}") if node.standalone
|
|
179
|
-
output << "?>"
|
|
180
|
-
# output << "\n"
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
def write_attributes(node, output)
|
|
184
|
-
# First write namespace declarations
|
|
185
|
-
node.attributes.each do |name, attr|
|
|
186
|
-
next unless name.to_s.start_with?("xmlns:") || name.to_s == "xmlns"
|
|
187
|
-
|
|
188
|
-
name = "xmlns" if name.to_s == "xmlns:"
|
|
189
|
-
value = attr.is_a?(::REXML::Attribute) ? attr.value : attr
|
|
190
|
-
output << " #{name}=\"#{value}\""
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
# Then write regular attributes
|
|
194
|
-
node.attributes.each do |name, attr| # rubocop:disable Style/CombinableLoops
|
|
195
|
-
next if name.to_s.start_with?("xmlns:") || name.to_s == "xmlns"
|
|
196
|
-
|
|
197
|
-
output << " "
|
|
198
|
-
output << if attr.is_a?(::REXML::Attribute) && attr.prefix
|
|
199
|
-
"#{attr.prefix}:#{attr.name}"
|
|
200
|
-
else
|
|
201
|
-
name.to_s
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
output << "=\""
|
|
205
|
-
value = attr.is_a?(::REXML::Attribute) ? attr.value : attr
|
|
206
|
-
output << escape_attribute_value(value.to_s)
|
|
207
|
-
output << "\""
|
|
208
|
-
end # rubocop:enable Style/CombinableLoops
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
def escape_attribute_value(value)
|
|
212
|
-
value.to_s.gsub(/[<>&"]/) do |match|
|
|
213
|
-
case match
|
|
214
|
-
when "<" then "<"
|
|
215
|
-
when ">" then ">"
|
|
216
|
-
when "&" then "&"
|
|
217
|
-
when '"' then """
|
|
218
|
-
# when "'" then '''
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
end
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
require "moxml/version"
|
|
2
|
-
|
|
3
|
-
# ObjectSpace shim: moxml 0.6 registers GC finalizers on Opal, which
|
|
4
|
-
# carries no ObjectSpace constant; the shim is a guarded no-op there.
|
|
5
|
-
require "objectspace_shim"
|
|
6
|
-
|
|
7
|
-
# The monitor shim must load before moxml files: moxml 0.6's
|
|
8
|
-
# NativeAttachment requires "monitor" at load time.
|
|
9
|
-
require "monitor"
|
|
10
|
-
require "moxml/error"
|
|
11
|
-
require "moxml/native_attachment"
|
|
12
|
-
require "moxml/xml_utils"
|
|
13
|
-
require "moxml/xml_utils/encoder"
|
|
14
|
-
require "moxml/node"
|
|
15
|
-
require "moxml/node_set"
|
|
16
|
-
require "moxml/lazy_node_set"
|
|
17
|
-
require "moxml/document"
|
|
18
|
-
require "moxml/element"
|
|
19
|
-
require "moxml/attribute"
|
|
20
|
-
require "moxml/text"
|
|
21
|
-
require "moxml/cdata"
|
|
22
|
-
require "moxml/comment"
|
|
23
|
-
require "moxml/processing_instruction"
|
|
24
|
-
require "moxml/declaration"
|
|
25
|
-
require "moxml/namespace"
|
|
26
|
-
require "moxml/doctype"
|
|
27
|
-
require "moxml/entity_reference"
|
|
28
|
-
require "moxml/entity_registry"
|
|
29
|
-
require "moxml/entity"
|
|
30
|
-
require "moxml/entity/restorer"
|
|
31
|
-
require "moxml/entity/reference"
|
|
32
|
-
require "moxml/xml_emitter"
|
|
33
|
-
require "moxml/adapter"
|
|
34
|
-
require "moxml/adapter/base"
|
|
35
|
-
require "moxml/adapter/customized_rexml"
|
|
36
|
-
require "moxml/adapter/customized_rexml/entity_reference"
|
|
37
|
-
require "moxml/adapter/customized_rexml/formatter"
|
|
38
|
-
require "moxml/sax"
|
|
39
|
-
require "moxml/sax/handler"
|
|
40
|
-
require "moxml/sax/element_handler"
|
|
41
|
-
require "moxml/sax/block_handler"
|
|
42
|
-
require "moxml/sax/namespace_splitter"
|
|
43
|
-
require "moxml/adapter/rexml"
|
|
44
|
-
require "moxml/adapter/customized_oga"
|
|
45
|
-
require "moxml/adapter/customized_oga/entity_decoder"
|
|
46
|
-
require "moxml/adapter/customized_oga/raw_value_override"
|
|
47
|
-
require "moxml/adapter/customized_oga/xml_declaration"
|
|
48
|
-
require "moxml/adapter/customized_oga/xml_generator"
|
|
49
|
-
require "moxml/adapter/oga"
|
|
50
|
-
require "moxml/builder"
|
|
51
|
-
require "moxml/context"
|
|
52
|
-
require "moxml/config"
|
|
53
|
-
require "moxml/xpath"
|
|
54
|
-
require "moxml/xpath/engine"
|
|
55
|
-
require "moxml/xpath/context"
|
|
56
|
-
require "moxml/xpath/conversion"
|
|
57
|
-
require "moxml/xpath/cache"
|
|
58
|
-
require "moxml/xpath/lexer"
|
|
59
|
-
require "moxml/xpath/parser"
|
|
60
|
-
require "moxml/xpath/compiler"
|
|
61
|
-
require "moxml/xpath/errors"
|
|
62
|
-
require "moxml/xpath/ast/node"
|
|
63
|
-
require "moxml/xpath/ruby/node"
|
|
64
|
-
require "moxml/xpath/ruby/generator"
|
|
65
|
-
require "moxml/reference"
|
|
66
|
-
require "moxml/reference/parser"
|
|
67
|
-
require "moxml/reference/writer"
|
|
68
|
-
require "moxml/reference/normalizer"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Opal shim: moxml 0.6's NativeAttachment::Native registers GC
|
|
4
|
-
# finalizers through ObjectSpace; JS has no finalization hook, and the
|
|
5
|
-
# Opal runtime does not carry an ObjectSpace at all (the constant is
|
|
6
|
-
# simply absent, so the call site NameErrors). A stubbed ObjectSpace
|
|
7
|
-
# degrades finalizer cleanup — attachments live for the process
|
|
8
|
-
# lifetime, which on the single-threaded JS runtime is the page's
|
|
9
|
-
# lifetime anyway. Existing runtimes that do define ObjectSpace are
|
|
10
|
-
# left untouched.
|
|
11
|
-
unless defined?(ObjectSpace)
|
|
12
|
-
module ObjectSpace
|
|
13
|
-
class << self
|
|
14
|
-
def define_finalizer(_obj, _proc = nil)
|
|
15
|
-
nil
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def undefine_finalizer(_obj)
|
|
19
|
-
nil
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rexml/xmltokens"
|
|
4
|
-
|
|
5
|
-
module REXML
|
|
6
|
-
module Namespace
|
|
7
|
-
attr_reader :name, :expanded_name
|
|
8
|
-
attr_accessor :prefix
|
|
9
|
-
|
|
10
|
-
include XMLTokens
|
|
11
|
-
|
|
12
|
-
NAME_WITHOUT_NAMESPACE = /^#{NCNAME_STR}$/
|
|
13
|
-
NAMESPLIT = /^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
|
|
14
|
-
|
|
15
|
-
def name=(name)
|
|
16
|
-
@expanded_name = name
|
|
17
|
-
if name.match?(NAME_WITHOUT_NAMESPACE)
|
|
18
|
-
@prefix = ""
|
|
19
|
-
@namespace = ""
|
|
20
|
-
@name = name
|
|
21
|
-
elsif name =~ NAMESPLIT
|
|
22
|
-
if $1
|
|
23
|
-
@prefix = $1
|
|
24
|
-
else
|
|
25
|
-
@prefix = ""
|
|
26
|
-
@namespace = ""
|
|
27
|
-
end
|
|
28
|
-
@name = $2
|
|
29
|
-
elsif name == ""
|
|
30
|
-
@prefix = nil
|
|
31
|
-
@namespace = nil
|
|
32
|
-
@name = nil
|
|
33
|
-
else
|
|
34
|
-
message = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: "
|
|
35
|
-
message += "<#{name.inspect}>"
|
|
36
|
-
raise ArgumentError, message
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def has_name?(other, ns = nil)
|
|
41
|
-
if ns
|
|
42
|
-
namespace == ns and name == other
|
|
43
|
-
elsif other.include? ":"
|
|
44
|
-
fully_expanded_name == other
|
|
45
|
-
else
|
|
46
|
-
name == other
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
alias :local_name :name
|
|
51
|
-
|
|
52
|
-
def fully_expanded_name
|
|
53
|
-
ns = prefix
|
|
54
|
-
return "#{ns}:#@name" if ns.size.positive?
|
|
55
|
-
|
|
56
|
-
@name
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|