moxml 0.6.11 → 0.6.13
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 +7 -5
- data/lib/moxml/adapter/leptris.rb +21 -52
- data/lib/moxml/adapter.rb +5 -0
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml/xsd/schema_rules.rb +71 -3
- data/spec/moxml/adapter/platform_spec.rb +2 -2
- data/spec/moxml/adapter_deprecation_spec.rb +6 -0
- data/spec/moxml/xsd_assert_spec.rb +90 -0
- data/spec/moxml/xsd_version_spec.rb +4 -4
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: adf6e5f1ca76598320e65ebac94a1e9bbd062cbf1174ede7291bf59fff917e03
|
|
4
|
+
data.tar.gz: e59147df518ce7edf4bd02ecbabe183dd2cd5aef8824069ce2b49b44b41db52c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 313b2865b50d5180b39d387c8f3fbf36d31e0df383a9a3e2b573eac31a43f582363ae71e525c9a850f7db4dfcb49f719ea8aff60562d87c59df9098e2ce79f9a
|
|
7
|
+
data.tar.gz: 1e558f7beb60d77b082b28e8aeb79f1c91549d7e4207c5aa5e7c40ba2ef9f619503427b07a129d8c1cf78ad05ca4fa93041fe4876c988ebebbc98734e682c593
|
data/README.adoc
CHANGED
|
@@ -77,7 +77,7 @@ https://github.com/leptris/leptris-ruby[leptris-ruby] FFI binding
|
|
|
77
77
|
every measured bulk operation — parse, XPath, serialization, SAX, and
|
|
78
78
|
the compiled Moxml::Plan / Moxml::StructPlan materialization paths
|
|
79
79
|
(StructPlan runs 2.3-2.6x raw Nokogiri on the benchmark shape);
|
|
80
|
-
requires leptris >= 1.9.420.
|
|
80
|
+
requires leptris >= 1.9.420.3 (see version table below).
|
|
81
81
|
|
|
82
82
|
=== Underlying library versions
|
|
83
83
|
|
|
@@ -105,8 +105,10 @@ or :nokogiri. Removal after the deprecation cycle.
|
|
|
105
105
|
|
|
106
106
|
|Oga
|
|
107
107
|
|3.4 / 3.5
|
|
108
|
-
|
|
|
109
|
-
and
|
|
108
|
+
|DEPRECATED (#552) — warned at configuration; use :leptris (primary)
|
|
109
|
+
or :nokogiri. Nothing in the metanorma stack selects Oga, and the gem
|
|
110
|
+
is a source-only C extension with no Ruby 4.0 build path. Removal
|
|
111
|
+
after the deprecation cycle.
|
|
110
112
|
|
|
111
113
|
|LibXML (libxml-ruby)
|
|
112
114
|
|>= 5.0
|
|
@@ -115,9 +117,9 @@ same libxml2 engine, governed by the consistency suite). Removal
|
|
|
115
117
|
after the deprecation cycle.
|
|
116
118
|
|
|
117
119
|
|Leptris (leptris-ruby)
|
|
118
|
-
|>= 1.9.420.
|
|
120
|
+
|>= 1.9.420.3
|
|
119
121
|
|ENFORCED hard floor — `MINIMUM_BINDING_VERSION`; the adapter refuses
|
|
120
|
-
to load below it. Raised 1.9.32 → 1.9.194.1 (2026-09-20) → 1.9.386.0 (2026-10-30) → 1.9.410.0 (2026-11-10) → 1.9.420.2 (2026-11-14)
|
|
122
|
+
to load below it. Raised 1.9.32 → 1.9.194.1 (2026-09-20) → 1.9.386.0 (2026-10-30) → 1.9.410.0 (2026-11-10) → 1.9.420.2 (2026-11-14) → 1.9.420.3 (2026-11-15)
|
|
121
123
|
(2026-10-30, the tested pair): every accommodation path below it is
|
|
122
124
|
deleted and all native faces through the 1.9.385 parent-axis train
|
|
123
125
|
are unconditional. The capability report
|
|
@@ -40,7 +40,13 @@ module Moxml
|
|
|
40
40
|
# (leptris#1964, 1.9.409) and the schG2 child-typing fix
|
|
41
41
|
# (leptris#1979, 1.9.410) - the XSD conformance answers the
|
|
42
42
|
# dataset and the suite now pin REQUIRE this wave.
|
|
43
|
-
|
|
43
|
+
# Raised 1.9.420.2 -> 1.9.420.3 (2026-11-15, lutaml/moxml#551):
|
|
44
|
+
# the LaneAttribute namespace face (c1838b9) - 420.3's native
|
|
45
|
+
# factory supplies the 4-arg LaneAttribute call, and the released
|
|
46
|
+
# 0.6.10 adapter's 2..3 arity hard-fails against it ("wrong
|
|
47
|
+
# number of arguments (given 4, expected 2..3)"). The floor encodes
|
|
48
|
+
# the pairing so the load refuses the broken combination.
|
|
49
|
+
MINIMUM_BINDING_VERSION = "1.9.420.3"
|
|
44
50
|
|
|
45
51
|
# Snapshot-backed attribute listing native (moxml#520): the
|
|
46
52
|
# listing face serves reads from the binding's flat packet face —
|
|
@@ -111,32 +117,6 @@ module Moxml
|
|
|
111
117
|
end
|
|
112
118
|
end
|
|
113
119
|
|
|
114
|
-
# The consumer-contract lane's attribute object
|
|
115
|
-
# (leptris-ruby#635): the shape the bound C factory constructs -
|
|
116
|
-
# (name, value, owner). Covers the walk+read contract
|
|
117
|
-
# (.name/.value); full attribute-node faces stay on the contract
|
|
118
|
-
# classes.
|
|
119
|
-
class LaneAttribute
|
|
120
|
-
attr_reader :name, :value, :owner, :ns_uri
|
|
121
|
-
|
|
122
|
-
# ns_uri: the attribute's in-scope namespace URI from the
|
|
123
|
-
# engine (nil for bare attributes). The lane builds its own
|
|
124
|
-
# Namespace struct - the full wrapper namespace stays on the
|
|
125
|
-
# contract classes.
|
|
126
|
-
LaneNamespace = Struct.new(:uri)
|
|
127
|
-
|
|
128
|
-
def initialize(name, value, owner = nil, ns_uri = nil)
|
|
129
|
-
@name = name
|
|
130
|
-
@value = value
|
|
131
|
-
@owner = owner
|
|
132
|
-
@ns_uri = ns_uri
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def namespace
|
|
136
|
-
@ns_uri ? LaneNamespace.new(@ns_uri) : nil
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
120
|
if Gem::Version.new(::Leptris::VERSION.to_s) <
|
|
141
121
|
Gem::Version.new(MINIMUM_BINDING_VERSION)
|
|
142
122
|
raise Moxml::AdapterError.new(
|
|
@@ -2153,12 +2133,6 @@ module Moxml
|
|
|
2153
2133
|
if NATIVE_READ_LAYER &&
|
|
2154
2134
|
defined?(::Leptris::XML::Native) &&
|
|
2155
2135
|
::Leptris::XML::Native.respond_to?(:define_hot_readers)
|
|
2156
|
-
# Elements: name + content (the C bodies ARE the
|
|
2157
|
-
# contract answers for clean documents). Text: content
|
|
2158
|
-
# only (the text-payload read). Comment/cdata/PI keep
|
|
2159
|
-
# the contract classes outright - their payload reads
|
|
2160
|
-
# are contract-shaped (the reference differential pins
|
|
2161
|
-
# them), so hot classes for those kinds answer wrongly.
|
|
2162
2136
|
hot_el = Class.new(Identity::ELEMENT)
|
|
2163
2137
|
::Leptris::XML::Native.define_hot_readers(hot_el)
|
|
2164
2138
|
hot_el.remove_method(:attribute)
|
|
@@ -2166,29 +2140,24 @@ module Moxml
|
|
|
2166
2140
|
::Leptris::XML::Native.define_hot_readers(hot_tx)
|
|
2167
2141
|
hot_tx.remove_method(:attribute)
|
|
2168
2142
|
hot_tx.remove_method(:name)
|
|
2169
|
-
#
|
|
2170
|
-
#
|
|
2171
|
-
#
|
|
2172
|
-
#
|
|
2173
|
-
#
|
|
2174
|
-
#
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
)
|
|
2180
|
-
end
|
|
2143
|
+
# REVERTED (measured, the pinned runner): the
|
|
2144
|
+
# consumer-contract binding (leptris-ruby#635) was
|
|
2145
|
+
# bound here in 0.6.10 - the C children/attribute
|
|
2146
|
+
# SHADOWED the facade's tuned lanes (the address-token
|
|
2147
|
+
# children and the attribute packet) and every
|
|
2148
|
+
# structural row regressed: walk warm 0.67x -> 0.49x,
|
|
2149
|
+
# attr pairs 8.18x -> 6.65x, xpath count 2.13x -> 1.48x.
|
|
2150
|
+
# The faces remain available to row-shaped consumers
|
|
2151
|
+
# via the moxml-rs data plane; the facade dispatch
|
|
2152
|
+
# keeps its tuned lanes.
|
|
2181
2153
|
hot_set = [hot_el, hot_tx, Identity::COMMENT,
|
|
2182
2154
|
Identity::CDATA,
|
|
2183
2155
|
Identity::PROCESSING_INSTRUCTION].freeze
|
|
2184
2156
|
# The klass-propagating reads (#246) mint through the
|
|
2185
|
-
# RECEIVER class's child map - the hot classes need
|
|
2186
|
-
# own, or the C visit mint yields nil for their
|
|
2187
|
-
# (the root-level
|
|
2188
|
-
# while the C children read stayed correct).
|
|
2189
|
-
# Install ONLY on the hot classes: the contract kinds'
|
|
2190
|
-
# maps are the load-time installation - overwriting them
|
|
2191
|
-
# here would re-route the contract kinds' children mints.
|
|
2157
|
+
# RECEIVER class's child map - the hot classes need
|
|
2158
|
+
# their own, or the C visit mint yields nil for their
|
|
2159
|
+
# entries (the root-level // gather truncated at depth
|
|
2160
|
+
# >= 2 while the C children read stayed correct).
|
|
2192
2161
|
if NATIVE_KLASS_CHILDREN
|
|
2193
2162
|
hot_set.first(2).each do |klass|
|
|
2194
2163
|
klass.install_child_klasses(hot_set)
|
data/lib/moxml/adapter.rb
CHANGED
|
@@ -38,6 +38,11 @@ module Moxml
|
|
|
38
38
|
headed_ox: "use :leptris (primary) or :nokogiri; headed_ox is a pure alias of :ox",
|
|
39
39
|
libxml: "use :nokogiri — the same libxml2 engine, governed by the consistency suite",
|
|
40
40
|
ox: "use :leptris (primary) or :nokogiri",
|
|
41
|
+
# #552 (2026-11-15): nothing in the metanorma stack selects Oga,
|
|
42
|
+
# and the gem is a source-only C extension with no Ruby 4.0
|
|
43
|
+
# build path — keeping it selectable invites a broken install
|
|
44
|
+
# for zero benefit.
|
|
45
|
+
oga: "use :leptris (primary) or :nokogiri; the oga gem has no precompiled builds and no Ruby 4.0 support path",
|
|
41
46
|
}.freeze
|
|
42
47
|
|
|
43
48
|
class << self
|
data/lib/moxml/version.rb
CHANGED
|
@@ -192,7 +192,7 @@ module Moxml
|
|
|
192
192
|
|
|
193
193
|
ContentModel = Struct.new(:declared_children, :any,
|
|
194
194
|
:declared_attributes, :any_attribute,
|
|
195
|
-
:particles, :pure_sequence)
|
|
195
|
+
:particles, :pure_sequence, :asserts)
|
|
196
196
|
SchemaIndex = Struct.new(:target_namespace, :element_default,
|
|
197
197
|
:attribute_default, :elements,
|
|
198
198
|
:attributes, :contents, :version,
|
|
@@ -208,6 +208,22 @@ module Moxml
|
|
|
208
208
|
# adapter. Unresolvable prefixes yield "".
|
|
209
209
|
module_function
|
|
210
210
|
|
|
211
|
+
# The FULL in-scope bindings map for an element (the #246
|
|
212
|
+
# walk prefix_uri uses, returning the map instead of one
|
|
213
|
+
# answer): per-node definitions merged along the ancestor
|
|
214
|
+
# axis, deeper overriding shallower.
|
|
215
|
+
def in_scope_bindings(element)
|
|
216
|
+
bindings = {}
|
|
217
|
+
node = element
|
|
218
|
+
while node
|
|
219
|
+
node.namespaces.each do |namespace|
|
|
220
|
+
bindings[namespace.prefix] = namespace.uri
|
|
221
|
+
end
|
|
222
|
+
node = node.parent&.element? ? node.parent : nil
|
|
223
|
+
end
|
|
224
|
+
bindings
|
|
225
|
+
end
|
|
226
|
+
|
|
211
227
|
def prefix_uri(prefix, element)
|
|
212
228
|
bindings = {}
|
|
213
229
|
node = element
|
|
@@ -222,7 +238,7 @@ module Moxml
|
|
|
222
238
|
|
|
223
239
|
# The XSD 1.1 version-tagging namespace (Structures §C.3):
|
|
224
240
|
# vc:minVersion / vc:maxVersion gate 1.1 constructs.
|
|
225
|
-
VC_NS = "http://www.w3.org/
|
|
241
|
+
VC_NS = "http://www.w3.org/2007/XMLSchema-versioning"
|
|
226
242
|
|
|
227
243
|
# XSD pattern-facet dialect → Ruby regex, bounded to the
|
|
228
244
|
# subset the facade vouches for (Datatypes Appendix F). Block
|
|
@@ -637,11 +653,60 @@ module Moxml
|
|
|
637
653
|
if index.self_contained
|
|
638
654
|
findings.concat(attribute_findings(root, model, index))
|
|
639
655
|
end
|
|
656
|
+
if index.version == "1.1" && model && index.self_contained
|
|
657
|
+
findings.concat(assert_findings(root, model))
|
|
658
|
+
end
|
|
640
659
|
findings.compact
|
|
641
660
|
end
|
|
642
661
|
|
|
643
662
|
private
|
|
644
663
|
|
|
664
|
+
# XSD 1.1 asserts (#556): each xs:assert test evaluates as an
|
|
665
|
+
# effective boolean over the element context; false/empty is a
|
|
666
|
+
# finding. The test's prefixes bind against the SCHEMA's
|
|
667
|
+
# in-scope namespaces (collected at index time), and the
|
|
668
|
+
# evaluation rides the pure-Ruby XPath compiler — the engine
|
|
669
|
+
# sees the 1.1 syntax but does not evaluate asserts (#556).
|
|
670
|
+
# An unevaluatable test (an XPath 2.0 construct the compiler
|
|
671
|
+
# does not carry) under-reports: the one-directional contract
|
|
672
|
+
# never false-reports, so a compile failure skips the row.
|
|
673
|
+
def assert_findings(element, model)
|
|
674
|
+
Array(model.asserts).flat_map do |assert|
|
|
675
|
+
begin
|
|
676
|
+
ast = Moxml::XPath::Parser.parse(assert["test"])
|
|
677
|
+
proc_ = Moxml::XPath::Compiler.compile_with_cache(
|
|
678
|
+
ast, namespaces: assert["ns"]
|
|
679
|
+
)
|
|
680
|
+
result = proc_.call(element)
|
|
681
|
+
rescue StandardError
|
|
682
|
+
next []
|
|
683
|
+
end
|
|
684
|
+
if effective_boolean(result)
|
|
685
|
+
[]
|
|
686
|
+
else
|
|
687
|
+
[
|
|
688
|
+
Moxml::XSD::ValidationError.new(
|
|
689
|
+
message: "element <#{element.name}> fails the " \
|
|
690
|
+
"assertion #{assert['test'].inspect}",
|
|
691
|
+
path: path_of(element),
|
|
692
|
+
),
|
|
693
|
+
]
|
|
694
|
+
end
|
|
695
|
+
end
|
|
696
|
+
end
|
|
697
|
+
|
|
698
|
+
# The XPath effective boolean (the 1.0 rules: a non-empty
|
|
699
|
+
# node-set, a non-zero number, a non-empty string, true).
|
|
700
|
+
def effective_boolean(value)
|
|
701
|
+
case value
|
|
702
|
+
when true, false then value
|
|
703
|
+
when Moxml::NodeSet, Array then !value.empty?
|
|
704
|
+
when Numeric then value != 0
|
|
705
|
+
when String, nil then !value.to_s.empty?
|
|
706
|
+
else !value.nil?
|
|
707
|
+
end
|
|
708
|
+
end
|
|
709
|
+
|
|
645
710
|
def index_global_element(decl, index)
|
|
646
711
|
name = decl["name"] or return
|
|
647
712
|
qname = "{#{index.target_namespace}}#{name}"
|
|
@@ -700,7 +765,7 @@ module Moxml
|
|
|
700
765
|
end
|
|
701
766
|
|
|
702
767
|
def content_model(type_node, index)
|
|
703
|
-
model = ContentModel.new([], nil, [], nil, [], true)
|
|
768
|
+
model = ContentModel.new([], nil, [], nil, [], true, [])
|
|
704
769
|
collect_model(type_node, index, model)
|
|
705
770
|
model
|
|
706
771
|
end
|
|
@@ -729,6 +794,9 @@ module Moxml
|
|
|
729
794
|
if (qname = particle_qname(child, index))
|
|
730
795
|
model.declared_attributes << qname
|
|
731
796
|
end
|
|
797
|
+
when "assert"
|
|
798
|
+
model.asserts << { "test" => child["test"].to_s,
|
|
799
|
+
"ns" => in_scope_bindings(child) }
|
|
732
800
|
when "any"
|
|
733
801
|
model.any ||= wildcard_from(child)
|
|
734
802
|
when "anyAttribute"
|
|
@@ -62,11 +62,11 @@ RSpec.describe Moxml::Adapter do
|
|
|
62
62
|
Moxml::Config.default_adapter = ambient
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
it "pins the leptris binding floor at 1.9.420.
|
|
65
|
+
it "pins the leptris binding floor at 1.9.420.3 (raised 2026-09-20, 2026-10-30, 2026-11-10, 2026-11-14, and 2026-11-15; enforced at load)" do
|
|
66
66
|
skip "leptris not installed" unless described_class.available?(:leptris)
|
|
67
67
|
|
|
68
68
|
adapter = described_class.load(:leptris)
|
|
69
|
-
expect(adapter::MINIMUM_BINDING_VERSION).to eq("1.9.420.
|
|
69
|
+
expect(adapter::MINIMUM_BINDING_VERSION).to eq("1.9.420.3")
|
|
70
70
|
expect(Gem::Version.new(Leptris::VERSION))
|
|
71
71
|
.to be >= Gem::Version.new(adapter::MINIMUM_BINDING_VERSION)
|
|
72
72
|
end
|
|
@@ -21,6 +21,12 @@ RSpec.describe Moxml::Adapter do
|
|
|
21
21
|
end.not_to output.to_stderr
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
it "warns for :oga at configuration, before the adapter load (#552)" do
|
|
25
|
+
expect do
|
|
26
|
+
Moxml.new(:oga)
|
|
27
|
+
end.to output(%r{:oga adapter is deprecated}).to_stderr
|
|
28
|
+
end
|
|
29
|
+
|
|
24
30
|
it "guides every deprecated adapter toward the governed matrix" do
|
|
25
31
|
described_class::DEPRECATED_ADAPTERS.each_value do |guidance|
|
|
26
32
|
expect(guidance).to match(/:nokogiri|:leptris/)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# moxml#556: XSD 1.1 xs:assert was compiled but never evaluated —
|
|
6
|
+
# assertion-violating instances validated clean. Two defects: the
|
|
7
|
+
# versioning namespace constant read 2001 (the spec says 2007), so
|
|
8
|
+
# vc:minVersion="1.1" never triggered 1.1 semantics, and the asserts
|
|
9
|
+
# were indexed but not evaluated. The evaluation rides the pure-Ruby
|
|
10
|
+
# XPath compiler over the element context; an unevaluatable test
|
|
11
|
+
# (an XPath 2.0 construct the compiler does not carry) under-reports
|
|
12
|
+
# silently — the one-directional contract never false-reports.
|
|
13
|
+
# The engine-compile lane has a separate finding: an assert-carrying
|
|
14
|
+
# schema compiled under rspec's boot state fails (status -2, both
|
|
15
|
+
# attempts) - filed to leptris-ruby. The evaluation contract is
|
|
16
|
+
# engine-free: SchemaRules.findings evaluates the indexed asserts via
|
|
17
|
+
# the pure-Ruby XPath compiler.
|
|
18
|
+
RSpec.describe "XSD 1.1 xs:assert evaluation" do
|
|
19
|
+
let(:ctx) { Moxml::Context.new(:leptris) }
|
|
20
|
+
|
|
21
|
+
let(:schema) do
|
|
22
|
+
<<~XSD
|
|
23
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" vc:minVersion="1.1"
|
|
24
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
|
|
25
|
+
<xs:element name="doc">
|
|
26
|
+
<xs:complexType>
|
|
27
|
+
<xs:sequence><xs:element name="a" type="xs:int" maxOccurs="unbounded"/></xs:sequence>
|
|
28
|
+
<xs:assert test="sum(a) > 0"/>
|
|
29
|
+
</xs:complexType>
|
|
30
|
+
</xs:element>
|
|
31
|
+
</xs:schema>
|
|
32
|
+
XSD
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def findings_for(instance_xml, schema_xml = schema)
|
|
36
|
+
index = Moxml::XSD::SchemaRules.index(schema_xml, ctx)
|
|
37
|
+
doc = ctx.parse(instance_xml)
|
|
38
|
+
Moxml::XSD::SchemaRules.findings(doc, index)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "indexes the schema version as 1.1 for the 2007 namespace" do
|
|
42
|
+
index = Moxml::XSD::SchemaRules.index(schema, ctx)
|
|
43
|
+
expect(index.version).to eq("1.1")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "accepts an instance the assertion holds for" do
|
|
47
|
+
expect(findings_for("<doc><a>5</a></doc>")).to be_empty
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "rejects an instance the assertion fails for" do
|
|
51
|
+
errors = findings_for("<doc><a>-5</a></doc>")
|
|
52
|
+
expect(errors).not_to be_empty
|
|
53
|
+
expect(errors.first.message).to include("assertion")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "binds the assert's prefixes against the schema's namespaces" do
|
|
57
|
+
prefixed_schema = <<~XSD
|
|
58
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
59
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
|
|
60
|
+
xmlns:t="urn:t" vc:minVersion="1.1" targetNamespace="urn:t"
|
|
61
|
+
elementFormDefault="qualified">
|
|
62
|
+
<xs:element name="doc">
|
|
63
|
+
<xs:complexType>
|
|
64
|
+
<xs:sequence><xs:element name="a" type="xs:int"/></xs:sequence>
|
|
65
|
+
<xs:assert test="t:a[@t:k]"/>
|
|
66
|
+
</xs:complexType>
|
|
67
|
+
</xs:element>
|
|
68
|
+
</xs:schema>
|
|
69
|
+
XSD
|
|
70
|
+
expect(findings_for('<t:doc xmlns:t="urn:t"><t:a t:k="present"/></t:doc>',
|
|
71
|
+
prefixed_schema)).to be_empty
|
|
72
|
+
expect(findings_for('<t:doc xmlns:t="urn:t"><t:a/></t:doc>',
|
|
73
|
+
prefixed_schema)).not_to be_empty
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "under-reports silently when the test is unevaluatable" do
|
|
77
|
+
unevaluatable = <<~XSD
|
|
78
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
79
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
|
|
80
|
+
<xs:element name="doc">
|
|
81
|
+
<xs:complexType>
|
|
82
|
+
<xs:sequence><xs:element name="a" type="xs:int"/></xs:sequence>
|
|
83
|
+
<xs:assert test="for $x in a return $x"/>
|
|
84
|
+
</xs:complexType>
|
|
85
|
+
</xs:element>
|
|
86
|
+
</xs:schema>
|
|
87
|
+
XSD
|
|
88
|
+
expect(findings_for("<doc><a>5</a></doc>", unevaluatable)).to be_empty
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -23,7 +23,7 @@ RSpec.describe "Moxml::XSD::Schema#version (#460 item 2)" do
|
|
|
23
23
|
it "reports 1.1 when the root declares vc:minVersion=1.1" do
|
|
24
24
|
schema = ctx.xsd(<<~XSD)
|
|
25
25
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
26
|
-
xmlns:vc="http://www.w3.org/
|
|
26
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
|
|
27
27
|
vc:minVersion="1.1">
|
|
28
28
|
<xs:element name="note" type="xs:string"/>
|
|
29
29
|
</xs:schema>
|
|
@@ -34,7 +34,7 @@ RSpec.describe "Moxml::XSD::Schema#version (#460 item 2)" do
|
|
|
34
34
|
it "detects the versioning namespace, not the prefix" do
|
|
35
35
|
schema = ctx.xsd(<<~XSD)
|
|
36
36
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
37
|
-
xmlns:vcx="http://www.w3.org/
|
|
37
|
+
xmlns:vcx="http://www.w3.org/2007/XMLSchema-versioning"
|
|
38
38
|
vcx:minVersion="1.1">
|
|
39
39
|
<xs:element name="note" type="xs:string"/>
|
|
40
40
|
</xs:schema>
|
|
@@ -54,7 +54,7 @@ RSpec.describe "Moxml::XSD::Schema#version (#460 item 2)" do
|
|
|
54
54
|
it "reports 1.0 for an explicit root vc:minVersion=1.0" do
|
|
55
55
|
schema = ctx.xsd(<<~XSD)
|
|
56
56
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
57
|
-
xmlns:vc="http://www.w3.org/
|
|
57
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
|
|
58
58
|
vc:minVersion="1.0">
|
|
59
59
|
<xs:element name="note" type="xs:string"/>
|
|
60
60
|
</xs:schema>
|
|
@@ -65,7 +65,7 @@ RSpec.describe "Moxml::XSD::Schema#version (#460 item 2)" do
|
|
|
65
65
|
it "reports 1.0 when only a construct carries vc:minVersion" do
|
|
66
66
|
schema = ctx.xsd(<<~XSD)
|
|
67
67
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
68
|
-
xmlns:vc="http://www.w3.org/
|
|
68
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
|
|
69
69
|
<xs:element name="note">
|
|
70
70
|
<xs:complexType>
|
|
71
71
|
<xs:sequence vc:minVersion="1.1">
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -633,6 +633,7 @@ files:
|
|
|
633
633
|
- spec/moxml/xpath/union_spec.rb
|
|
634
634
|
- spec/moxml/xpath_capabilities_spec.rb
|
|
635
635
|
- spec/moxml/xpath_spec.rb
|
|
636
|
+
- spec/moxml/xsd_assert_spec.rb
|
|
636
637
|
- spec/moxml/xsd_builtin_lexical_spec.rb
|
|
637
638
|
- spec/moxml/xsd_composed_spec.rb
|
|
638
639
|
- spec/moxml/xsd_conformance_cases_spec.rb
|