canon 0.3.60 → 0.3.61
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/lib/canon/comparison/xml_comparator.rb +10 -4
- data/lib/canon/version.rb +1 -1
- data/lib/canon/xml/digest_gate.rb +27 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5b90b7fc1d45d8f8e58e804f3f67dae934cc225639f3196c64f43cdd84ae005
|
|
4
|
+
data.tar.gz: c6615312bb2ac6eba00700c60b7dfeeb18277b8677532f98f91e4ad24a29c562
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75e2773c9597d616988157bdd40f4df3478dfd5695c1b9c7b9fc3709a6b043e22e98d3a1d9f2221ad06f7d4bb249331b1356606dce4acf10ce4bdfd8c254d209
|
|
7
|
+
data.tar.gz: 2877cc2367ac8da5ef68ea9b2ba2cc94883754a47aaf7dba51aef1050d67b9f3d95027238a539e119c92704fa696bdd8de8412bf178098a00e03061fbbb48888
|
|
@@ -201,11 +201,17 @@ module Canon
|
|
|
201
201
|
# side answers both; any hit falls through to the pipeline.
|
|
202
202
|
def verbose_report_proven_empty?(n1, n2, opts)
|
|
203
203
|
return true unless opts[:verbose]
|
|
204
|
+
|
|
204
205
|
# Identical input parses identically — differences and
|
|
205
|
-
# attribute order coincide by construction
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
|
|
206
|
+
# attribute order coincide by construction. Recover errors
|
|
207
|
+
# ride the fingerprint's diag check when the engine exposes
|
|
208
|
+
# them (libleptris 1.9.205+, #1200); otherwise the one SAX
|
|
209
|
+
# scan covers the parse-error banner (issue #130).
|
|
210
|
+
if n1 == n2
|
|
211
|
+
return true if Xml::DigestGate.recover_diags_available?
|
|
212
|
+
|
|
213
|
+
return !Xml::Sax.probe(n1).saw_error?
|
|
214
|
+
end
|
|
209
215
|
|
|
210
216
|
left = Xml::Sax.probe(n1)
|
|
211
217
|
return false if left.saw_error?
|
data/lib/canon/version.rb
CHANGED
|
@@ -21,6 +21,28 @@ module Canon
|
|
|
21
21
|
module DigestGate
|
|
22
22
|
module_function
|
|
23
23
|
|
|
24
|
+
# libleptris 1.9.205+ records duplicate-attribute recover
|
|
25
|
+
# events on the parsed document (#1200): read through the
|
|
26
|
+
# FFI diag counter. Evaluated lazily at call time — a load-time
|
|
27
|
+
# constant would freeze before leptris loads (defined? never
|
|
28
|
+
# resolves pending autoloads). When the adapter is not leptris
|
|
29
|
+
# (or the binding predates the surface), the verbose lane
|
|
30
|
+
# falls back to the SAX probe for its error scan.
|
|
31
|
+
def recover_diags_available?
|
|
32
|
+
defined?(::Leptris::XML::FFI) &&
|
|
33
|
+
::Leptris::XML::FFI.respond_to?(:leptris_document_parse_diag_count)
|
|
34
|
+
rescue StandardError
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def recover_diags?(doc)
|
|
39
|
+
return false unless recover_diags_available?
|
|
40
|
+
|
|
41
|
+
native = doc.native
|
|
42
|
+
native = native.c_ptr if native.respond_to?(:c_ptr)
|
|
43
|
+
::Leptris::XML::FFI.leptris_document_parse_diag_count(native).positive?
|
|
44
|
+
end
|
|
45
|
+
|
|
24
46
|
def available?
|
|
25
47
|
return false if RUBY_ENGINE == "opal"
|
|
26
48
|
return false unless Canon::XmlBackend.moxml? &&
|
|
@@ -106,7 +128,11 @@ module Canon
|
|
|
106
128
|
doc = context.parse(xml, readonly: true, strict: false)
|
|
107
129
|
root = doc.root
|
|
108
130
|
return nil unless root
|
|
109
|
-
|
|
131
|
+
|
|
132
|
+
if clean
|
|
133
|
+
return nil if doc.parse_errors.any?
|
|
134
|
+
return nil if recover_diags?(doc)
|
|
135
|
+
end
|
|
110
136
|
|
|
111
137
|
skeleton = doc.children.filter_map do |child|
|
|
112
138
|
next if Canon::XmlParsing.same_engine_node?(child, root)
|