moxml 0.5.170 → 0.5.172
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/README.adoc +6 -7
- data/Rakefile +23 -0
- data/conformance/moxml-conformance.json +413 -0
- data/lib/moxml/adapter/customized_leptris/declaration.rb +9 -0
- data/lib/moxml/adapter/customized_leptris/doctype.rb +8 -0
- data/lib/moxml/adapter/customized_leptris/entity_reference.rb +8 -0
- data/lib/moxml/adapter/customized_leptris/text_segment.rb +8 -0
- data/lib/moxml/adapter/customized_leptris.rb +5 -0
- data/lib/moxml/adapter/customized_libxml/cdata.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/comment.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/declaration.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/element.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/entity_reference.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/node.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/processing_instruction.rb +2 -0
- data/lib/moxml/adapter/customized_libxml/text.rb +2 -0
- data/lib/moxml/adapter/customized_libxml.rb +3 -0
- data/lib/moxml/adapter/customized_oga/entity_decoder.rb +8 -0
- data/lib/moxml/adapter/customized_oga/raw_value_override.rb +8 -0
- data/lib/moxml/adapter/customized_oga/xml_declaration.rb +8 -0
- data/lib/moxml/adapter/customized_oga/xml_generator.rb +1 -1
- data/lib/moxml/adapter/customized_oga.rb +4 -0
- data/lib/moxml/adapter/customized_ox/attribute.rb +5 -0
- data/lib/moxml/adapter/customized_ox/entity_reference.rb +5 -0
- data/lib/moxml/adapter/customized_ox/namespace.rb +5 -0
- data/lib/moxml/adapter/customized_ox/text.rb +6 -0
- data/lib/moxml/adapter/customized_ox.rb +3 -0
- data/lib/moxml/adapter/customized_rexml/entity_reference.rb +5 -0
- data/lib/moxml/adapter/customized_rexml/formatter.rb +6 -0
- data/lib/moxml/adapter/customized_rexml.rb +4 -0
- data/lib/moxml/adapter/leptris.rb +15 -32
- data/lib/moxml/adapter/nokogiri.rb +12 -4
- data/lib/moxml/adapter.rb +33 -0
- data/lib/moxml/context.rb +1 -0
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xsd/builtin_lexical.rb +100 -0
- data/spec/moxml/adapter/customized_lifecycle_audit_spec.rb +49 -0
- data/spec/moxml/adapter_deprecation_spec.rb +49 -0
- data/spec/moxml/adapter_registry_spec.rb +44 -0
- data/spec/moxml/customized_lifecycle_spec.rb +47 -0
- data/spec/moxml/sax_entity_parity_spec.rb +27 -2
- data/spec/moxml/xsd_conformance_cases_spec.rb +37 -0
- metadata +8 -2
|
@@ -15,16 +15,18 @@ require "spec_helper"
|
|
|
15
15
|
# the RSpec/* cops that forbid local-variable use inside examples.
|
|
16
16
|
module SaxEntityParityFixtures
|
|
17
17
|
class CaptureHandler < Moxml::SAX::ElementHandler
|
|
18
|
-
attr_reader :first_attrs, :text
|
|
18
|
+
attr_reader :first_attrs, :first_namespaces, :text
|
|
19
19
|
|
|
20
20
|
def initialize
|
|
21
21
|
super
|
|
22
22
|
@first_attrs = nil
|
|
23
|
+
@first_namespaces = nil
|
|
23
24
|
@text = +""
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
def on_start_element(_name, attrs = {},
|
|
27
|
+
def on_start_element(_name, attrs = {}, namespaces = {})
|
|
27
28
|
@first_attrs = attrs.dup if @first_attrs.nil?
|
|
29
|
+
@first_namespaces = namespaces.dup if @first_namespaces.nil?
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def on_characters(chunk)
|
|
@@ -51,6 +53,19 @@ module SaxEntityParityFixtures
|
|
|
51
53
|
"no entities" => ['<doc x="plain"/>', "plain", "plain"],
|
|
52
54
|
}.freeze
|
|
53
55
|
|
|
56
|
+
# Adapters whose SAX bridge reports namespace declarations in the
|
|
57
|
+
# handler's namespaces hash with the URI decoded exactly once.
|
|
58
|
+
SAX_NAMESPACE_ADAPTERS = %i[nokogiri ox rexml headed_ox].freeze
|
|
59
|
+
|
|
60
|
+
# Each row: [input XML, decoded namespace URI]. The parser decodes a
|
|
61
|
+
# declaration's URI exactly once; a decoded "&" is data and must
|
|
62
|
+
# reach the handler as-is.
|
|
63
|
+
NAMESPACE_CASES = {
|
|
64
|
+
"wrapped amp + decimal ref" => ['<f:doc xmlns:f="http://f/?x=1&#38;y"/>', "http://f/?x=1&y"],
|
|
65
|
+
"wrapped amp + amp" => ['<f:doc xmlns:f="http://f/?x=&amp;"/>', "http://f/?x=&"],
|
|
66
|
+
"plain amp" => ['<f:doc xmlns:f="http://f/?x=1&y=2"/>', "http://f/?x=1&y=2"],
|
|
67
|
+
}.freeze
|
|
68
|
+
|
|
54
69
|
# Each row: [input XML, decoded text, expected text as it appears in
|
|
55
70
|
# serialized XML].
|
|
56
71
|
TEXT_CASES = {
|
|
@@ -138,6 +153,16 @@ RSpec.describe "SAX/DOM entity parity" do
|
|
|
138
153
|
end
|
|
139
154
|
end
|
|
140
155
|
|
|
156
|
+
if SaxEntityParityFixtures::SAX_NAMESPACE_ADAPTERS.include?(adapter)
|
|
157
|
+
SaxEntityParityFixtures::NAMESPACE_CASES.each do |label, (xml, expected)|
|
|
158
|
+
it "decodes namespace URI once via SAX: #{label}" do
|
|
159
|
+
handler = SaxEntityParityFixtures::CaptureHandler.new
|
|
160
|
+
ctx.sax_parse(xml, handler)
|
|
161
|
+
expect(handler.first_namespaces["f"]).to eq(expected)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
141
166
|
SaxEntityParityFixtures::TEXT_CASES.each do |label, (xml, expected, expected_serialized)|
|
|
142
167
|
it "decodes text via SAX: #{label}" do
|
|
143
168
|
handler = SaxEntityParityFixtures::CaptureHandler.new
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Processing model §Validation (normative): pinned here.
|
|
4
|
+
|
|
5
|
+
require "spec_helper"
|
|
6
|
+
|
|
7
|
+
# The conformance dataset is the model's builtin-lexical answers AS
|
|
8
|
+
# DATA (#496): the Ruby suite pins every row here, and the exported
|
|
9
|
+
# JSON (rake conformance:export) is what moxml-rs and moxml-ts run.
|
|
10
|
+
# A row that fails here breaks the cross-language contract, not just
|
|
11
|
+
# this implementation.
|
|
12
|
+
RSpec.describe "builtin lexical conformance dataset" do
|
|
13
|
+
def valid_lexical?(type, lexical)
|
|
14
|
+
Moxml::XSD.builtin_valid?(Moxml.new(:leptris), type, lexical)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "carries the dataset" do
|
|
18
|
+
expect(Moxml::XSD::BuiltinLexical::CONFORMANCE_CASES.size).to be >= 80
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "answers every row exactly as the dataset expects" do
|
|
22
|
+
Moxml::XSD::BuiltinLexical::CONFORMANCE_CASES.each do |type, lexical, expected|
|
|
23
|
+
answer = valid_lexical?(type, lexical)
|
|
24
|
+
expect(answer).to eql(expected),
|
|
25
|
+
"#{type} #{lexical.inspect}: got #{answer.inspect}, " \
|
|
26
|
+
"dataset expects #{expected.inspect}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "keeps every dataset type in the table" do
|
|
31
|
+
Moxml::XSD::BuiltinLexical::CONFORMANCE_CASES.each do |type, _lexical, _expected|
|
|
32
|
+
expect do
|
|
33
|
+
valid_lexical?(type, "")
|
|
34
|
+
end.not_to raise_error
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.172
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|
|
@@ -53,6 +53,7 @@ files:
|
|
|
53
53
|
- bin/console
|
|
54
54
|
- bin/generate-model-coverage
|
|
55
55
|
- bin/setup
|
|
56
|
+
- conformance/moxml-conformance.json
|
|
56
57
|
- data/w3c_entities.json
|
|
57
58
|
- docs/ENTITY_SUPPORT_FOR_LUTAML_MODEL.md
|
|
58
59
|
- docs/Gemfile
|
|
@@ -479,6 +480,7 @@ files:
|
|
|
479
480
|
- spec/moxml/adapter/README.md
|
|
480
481
|
- spec/moxml/adapter/base_spec.rb
|
|
481
482
|
- spec/moxml/adapter/columnar_invalidation_spec.rb
|
|
483
|
+
- spec/moxml/adapter/customized_lifecycle_audit_spec.rb
|
|
482
484
|
- spec/moxml/adapter/entity_restoration_spec.rb
|
|
483
485
|
- spec/moxml/adapter/headed_ox_spec.rb
|
|
484
486
|
- spec/moxml/adapter/leptris_adoption_spec.rb
|
|
@@ -512,6 +514,8 @@ files:
|
|
|
512
514
|
- spec/moxml/adapter/rexml_spec.rb
|
|
513
515
|
- spec/moxml/adapter/shared_examples/.gitkeep
|
|
514
516
|
- spec/moxml/adapter/shared_examples/adapter_contract.rb
|
|
517
|
+
- spec/moxml/adapter_deprecation_spec.rb
|
|
518
|
+
- spec/moxml/adapter_registry_spec.rb
|
|
515
519
|
- spec/moxml/adapter_spec.rb
|
|
516
520
|
- spec/moxml/allocation_benchmark_spec.rb
|
|
517
521
|
- spec/moxml/allocation_guard_spec.rb
|
|
@@ -537,6 +541,7 @@ files:
|
|
|
537
541
|
- spec/moxml/config_spec.rb
|
|
538
542
|
- spec/moxml/context_spec.rb
|
|
539
543
|
- spec/moxml/css_spec.rb
|
|
544
|
+
- spec/moxml/customized_lifecycle_spec.rb
|
|
540
545
|
- spec/moxml/cycle_rejection_spec.rb
|
|
541
546
|
- spec/moxml/declaration_preservation_spec.rb
|
|
542
547
|
- spec/moxml/declaration_spec.rb
|
|
@@ -633,6 +638,7 @@ files:
|
|
|
633
638
|
- spec/moxml/xpath_capabilities_spec.rb
|
|
634
639
|
- spec/moxml/xpath_spec.rb
|
|
635
640
|
- spec/moxml/xsd_builtin_lexical_spec.rb
|
|
641
|
+
- spec/moxml/xsd_conformance_cases_spec.rb
|
|
636
642
|
- spec/moxml/xsd_engine_meta_spec.rb
|
|
637
643
|
- spec/moxml/xsd_error_contract_spec.rb
|
|
638
644
|
- spec/moxml/xsd_handle_mismatch_spec.rb
|