saxerator 0.9.1 → 0.9.2
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/saxerator/parser/latched_accumulator.rb +10 -2
- data/lib/saxerator/version.rb +1 -1
- data/spec/lib/saxerator_spec.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65e8c906e3b63d2bc0968eb8efbf8e737827a0f6
|
4
|
+
data.tar.gz: ef9f928056120981840202ea4c19e3778c8c5424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee3f52630eda84e56596e0972369e902f28ddf4a20fd23cd10fbda360bec551aae51d5045267f98007017d08e3880b59c5ad566fdeb9546bc76c054cd349bd0
|
7
|
+
data.tar.gz: e535bd0e982ec499187b39864851237923d909852c5ce86f75412a62c597823e9be6a6f2c92abb6958ee2ed5f06857d1b97de3e04340d849b8ca6abe35349b3d
|
@@ -36,12 +36,20 @@ module Saxerator
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = [])
|
39
|
-
|
39
|
+
if @ignore_namespaces
|
40
|
+
prefix, uri, ns = nil, nil, []
|
41
|
+
attrs.each do |attr|
|
42
|
+
attr.prefix = nil if attr.respond_to? :prefix
|
43
|
+
attr.uri = nil if attr.respond_to? :uri
|
44
|
+
end
|
45
|
+
end
|
40
46
|
check_latches_and_passthrough(:start_element_namespace, name, attrs, prefix, uri, ns)
|
41
47
|
end
|
42
48
|
|
43
49
|
def end_element_namespace(name, prefix = nil, uri = nil)
|
44
|
-
|
50
|
+
if @ignore_namespaces
|
51
|
+
prefix, uri = nil
|
52
|
+
end
|
45
53
|
check_latches_and_passthrough(:end_element_namespace, name, prefix, uri)
|
46
54
|
end
|
47
55
|
|
data/lib/saxerator/version.rb
CHANGED
data/spec/lib/saxerator_spec.rb
CHANGED
@@ -66,9 +66,18 @@ describe Saxerator do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
context "with ignore namespaces" do
|
69
|
-
let(:xml) {
|
69
|
+
let(:xml) { <<-eos
|
70
|
+
<ns1:foo xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns1="http://foo.com" xmlns:ns3="http://bar.com">
|
71
|
+
<ns3:bar>baz</ns3:bar>
|
72
|
+
<ns3:bar bar="bar" ns1:foo="foo" class="class">bax</ns3:bar>
|
73
|
+
</ns1:foo>
|
74
|
+
eos
|
75
|
+
}
|
76
|
+
|
70
77
|
subject(:parser) do
|
71
|
-
Saxerator.parser(xml) { |config|
|
78
|
+
Saxerator.parser(xml) { |config|
|
79
|
+
config.ignore_namespaces!
|
80
|
+
}
|
72
81
|
end
|
73
82
|
|
74
83
|
specify {
|
@@ -76,8 +85,7 @@ describe Saxerator do
|
|
76
85
|
parser.for_tag("bar").each do |tag|
|
77
86
|
bar_count += 1
|
78
87
|
end
|
79
|
-
|
80
|
-
bar_count.should == 1
|
88
|
+
bar_count.should == 2
|
81
89
|
}
|
82
90
|
end
|
83
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saxerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Schaefer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|