moxml 0.5.82 → 0.5.83
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/moxml/version.rb +1 -1
- data/spec/moxml/adapter/leptris_sax_dup_attr_spec.rb +50 -0
- 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: 47eeb00aed4df2a6ea9474713ed65ba577889375e2ea7a49a8b36ee7fde86090
|
|
4
|
+
data.tar.gz: 947e4a25bd867ce42a52015ceea6fe576ded8b1ccf9a232cc5b1a69e1c22b166
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: daaf3e2d077a2fee6b710d61b512a1e8c89922727cbf147aca2fb69147602aa3c50369bdc990cb385e3522296151102fa5498f0df5e11955d1b16424fa18c2b1
|
|
7
|
+
data.tar.gz: 55f51e85aa61abcb1bc9ab735cd1e863152c46f284a85ff78355306b0698305772b968c1690d7c0c991715afdd433911ac70fce6ce0fde5f133fa27001748ffc
|
data/lib/moxml/version.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# Duplicate attributes are a fatal XML 1.0 §3.1 error (moxml#281,
|
|
6
|
+
# issue #130 banner semantics): the SAX lane must surface them via
|
|
7
|
+
# on_error exactly like the DOM lane's parse_diagnostics. On
|
|
8
|
+
# bindings whose drain claims dup-containing documents (engine <
|
|
9
|
+
# 1.9.242 — leptris#1374), the drain swallows the error; those
|
|
10
|
+
# bindings skip this spec until the ride lands.
|
|
11
|
+
module SaxDupAttrHandlers
|
|
12
|
+
class ErrorCollector < Moxml::SAX::Handler
|
|
13
|
+
attr_reader :errors, :elements
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
super
|
|
17
|
+
@errors = []
|
|
18
|
+
@elements = 0
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def on_error(error)
|
|
22
|
+
@errors << error.message
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def on_start_element(_name, _attrs = {}, _namespaces = {})
|
|
26
|
+
@elements += 1
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
RSpec.describe "SAX duplicate-attribute error surfacing" do
|
|
32
|
+
let(:context) { Moxml.new(:leptris) }
|
|
33
|
+
let(:dup_xml) do
|
|
34
|
+
'<body lang="en" xml:lang="en" xml:lang="en"><div>x</div></body>'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "surfaces the redefined-attribute error through sax_parse" do
|
|
38
|
+
if defined?(Leptris::XML::SAX::Records) &&
|
|
39
|
+
!Leptris::XML::SAX::Records.open(dup_xml).nil?
|
|
40
|
+
skip "engine < 1.9.242 — the drain claims dup-attr documents " \
|
|
41
|
+
"(leptris#1374)"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
handler = SaxDupAttrHandlers::ErrorCollector.new
|
|
45
|
+
context.sax_parse(dup_xml, handler)
|
|
46
|
+
|
|
47
|
+
expect(handler.errors.join).to include("xml:lang redefined")
|
|
48
|
+
expect(handler.elements).to eq(2)
|
|
49
|
+
end
|
|
50
|
+
end
|
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.5.
|
|
4
|
+
version: 0.5.83
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -438,6 +438,7 @@ files:
|
|
|
438
438
|
- spec/moxml/adapter/entity_restoration_spec.rb
|
|
439
439
|
- spec/moxml/adapter/headed_ox_spec.rb
|
|
440
440
|
- spec/moxml/adapter/leptris_doc_parts_spec.rb
|
|
441
|
+
- spec/moxml/adapter/leptris_sax_dup_attr_spec.rb
|
|
441
442
|
- spec/moxml/adapter/leptris_sax_records_spec.rb
|
|
442
443
|
- spec/moxml/adapter/leptris_spec.rb
|
|
443
444
|
- spec/moxml/adapter/libxml_internals_spec.rb
|