rexml 3.2.6 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rexml might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2583ae302aa5e698f0887a689c416e5debe0533ac472a9f96fce6a8912040fd8
4
- data.tar.gz: b0ffa6301fd899969a78e060ccaeafebfc2169e3c63ff499ebc6170468866475
3
+ metadata.gz: afaa8e7d5241253a1c36a218f94eeff525cc19378d2ed104f738abfc01693889
4
+ data.tar.gz: 665e18c0db75cce5e3db16c674c02e986ff9141df54fd7ff3da704b4403a928d
5
5
  SHA512:
6
- metadata.gz: f63fb0b84ef51e790cc6310244f2106d8c47ec9a00687c58c743afda82b60be9986d503c6f56f947db06f6758707facccd03405c4d1009376e856080aa26d0e4
7
- data.tar.gz: db62bea7391837a7ab4cfc5cb5a412ed4deb8d232653ca66d93a323a5a76383eed520cd4ced5b20204f29b04e84678791cd6f807195868f5d4a5e519a73d2aaf
6
+ metadata.gz: 86ea7a0ce4847b320f297b1eb03158003c2931847c07ea118f0a7413f476660dcf40baec8b59a92a2e7096eb665ace359b04c5d8e82617b7162305465472c88d
7
+ data.tar.gz: ae248f28516ab6c76170623bcc5e5a30389596823133fd0a13cb74235d6101dd469235bab8b1e15bcbd7a7795f04b44e4674dfdcb1712109dce58001cea01648
data/NEWS.md CHANGED
@@ -1,5 +1,156 @@
1
1
  # News
2
2
 
3
+ ## 3.3.1 - 2024-06-25 {#version-3-3-1}
4
+
5
+ ### Improvements
6
+
7
+ * Added support for detecting malformed top-level comments.
8
+ * GH-145
9
+ * Patch by Hiroya Fujinami.
10
+
11
+ * Improved `REXML::Element#attribute` performance.
12
+ * GH-146
13
+ * Patch by Hiroya Fujinami.
14
+
15
+ * Added support for detecting malformed `<!-->` comments.
16
+ * GH-147
17
+ * Patch by Hiroya Fujinami.
18
+
19
+ * Added support for detecting unclosed `DOCTYPE`.
20
+ * GH-152
21
+ * Patch by Hiroya Fujinami.
22
+
23
+ * Added `changlog_uri` metadata to gemspec.
24
+ * GH-156
25
+ * Patch by fynsta.
26
+
27
+ * Improved parse performance.
28
+ * GH-157
29
+ * GH-158
30
+ * Patch by NAITOH Jun.
31
+
32
+ ### Fixes
33
+
34
+ * Fixed a bug that large XML can't be parsed.
35
+ * GH-154
36
+ * Patch by NAITOH Jun.
37
+
38
+ * Fixed a bug that private constants are visible.
39
+ * GH-155
40
+ * Patch by NAITOH Jun.
41
+
42
+ ### Thanks
43
+
44
+ * Hiroya Fujinami
45
+
46
+ * NAITOH Jun
47
+
48
+ * fynsta
49
+
50
+ ## 3.3.0 - 2024-06-11 {#version-3-3-0}
51
+
52
+ ### Improvements
53
+
54
+ * Added support for strscan 0.7.0 installed with Ruby 2.6.
55
+ * GH-142
56
+ * Reported by Fernando Trigoso.
57
+
58
+ ### Thanks
59
+
60
+ * Fernando Trigoso
61
+
62
+ ## 3.2.9 - 2024-06-09 {#version-3-2-9}
63
+
64
+ ### Improvements
65
+
66
+ * Added support for old strscan.
67
+ * GH-132
68
+ * Reported by Adam.
69
+
70
+ * Improved attribute value parse performance.
71
+ * GH-135
72
+ * Patch by NAITOH Jun.
73
+
74
+ * Improved `REXML::Node#each_recursive` performance.
75
+ * GH-134
76
+ * GH-139
77
+ * Patch by Hiroya Fujinami.
78
+
79
+ * Improved text parse performance.
80
+ * Reported by mprogrammer.
81
+
82
+ ### Thanks
83
+
84
+ * Adam
85
+ * NAITOH Jun
86
+ * Hiroya Fujinami
87
+ * mprogrammer
88
+
89
+ ## 3.2.8 - 2024-05-16 {#version-3-2-8}
90
+
91
+ ### Fixes
92
+
93
+ * Suppressed a warning
94
+
95
+ ## 3.2.7 - 2024-05-16 {#version-3-2-7}
96
+
97
+ ### Improvements
98
+
99
+ * Improve parse performance by using `StringScanner`.
100
+
101
+ * GH-106
102
+ * GH-107
103
+ * GH-108
104
+ * GH-109
105
+ * GH-112
106
+ * GH-113
107
+ * GH-114
108
+ * GH-115
109
+ * GH-116
110
+ * GH-117
111
+ * GH-118
112
+ * GH-119
113
+ * GH-121
114
+
115
+ * Patch by NAITOH Jun.
116
+
117
+ * Improved parse performance when an attribute has many `<`s.
118
+
119
+ * GH-126
120
+
121
+ ### Fixes
122
+
123
+ * XPath: Fixed a bug of `normalize_space(array)`.
124
+
125
+ * GH-110
126
+ * GH-111
127
+
128
+ * Patch by flatisland.
129
+
130
+ * XPath: Fixed a bug that wrong position is used with nested path.
131
+
132
+ * GH-110
133
+ * GH-122
134
+
135
+ * Reported by jcavalieri.
136
+ * Patch by NAITOH Jun.
137
+
138
+ * Fixed a bug that an exception message can't be generated for
139
+ invalid encoding XML.
140
+
141
+ * GH-29
142
+ * GH-123
143
+
144
+ * Reported by DuKewu.
145
+ * Patch by NAITOH Jun.
146
+
147
+ ### Thanks
148
+
149
+ * NAITOH Jun
150
+ * flatisland
151
+ * jcavalieri
152
+ * DuKewu
153
+
3
154
  ## 3.2.6 - 2023-07-27 {#version-3-2-6}
4
155
 
5
156
  ### Improvements
data/lib/rexml/element.rb CHANGED
@@ -7,14 +7,6 @@ require_relative "xpath"
7
7
  require_relative "parseexception"
8
8
 
9
9
  module REXML
10
- # An implementation note about namespaces:
11
- # As we parse, when we find namespaces we put them in a hash and assign
12
- # them a unique ID. We then convert the namespace prefix for the node
13
- # to the unique ID. This makes namespace lookup much faster for the
14
- # cost of extra memory use. We save the namespace prefix for the
15
- # context node and convert it back when we write it.
16
- @@namespaces = {}
17
-
18
10
  # An \REXML::Element object represents an XML element.
19
11
  #
20
12
  # An element:
@@ -1284,16 +1276,11 @@ module REXML
1284
1276
  # document.root.attribute("x", "a") # => a:x='a:x'
1285
1277
  #
1286
1278
  def attribute( name, namespace=nil )
1287
- prefix = nil
1288
- if namespaces.respond_to? :key
1289
- prefix = namespaces.key(namespace) if namespace
1290
- else
1291
- prefix = namespaces.index(namespace) if namespace
1292
- end
1279
+ prefix = namespaces.key(namespace) if namespace
1293
1280
  prefix = nil if prefix == 'xmlns'
1294
1281
 
1295
1282
  ret_val =
1296
- attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" )
1283
+ attributes.get_attribute( prefix ? "#{prefix}:#{name}" : name )
1297
1284
 
1298
1285
  return ret_val unless ret_val.nil?
1299
1286
  return nil if prefix.nil?
@@ -262,11 +262,10 @@ module REXML
262
262
  string(string).length
263
263
  end
264
264
 
265
- # UNTESTED
266
265
  def Functions::normalize_space( string=nil )
267
266
  string = string(@@context[:node]) if string.nil?
268
267
  if string.kind_of? Array
269
- string.collect{|x| string.to_s.strip.gsub(/\s+/um, ' ') if string}
268
+ string.collect{|x| x.to_s.strip.gsub(/\s+/um, ' ') if x}
270
269
  else
271
270
  string.to_s.strip.gsub(/\s+/um, ' ')
272
271
  end
data/lib/rexml/node.rb CHANGED
@@ -52,10 +52,14 @@ module REXML
52
52
 
53
53
  # Visit all subnodes of +self+ recursively
54
54
  def each_recursive(&block) # :yields: node
55
- self.elements.each {|node|
56
- block.call(node)
57
- node.each_recursive(&block)
58
- }
55
+ stack = []
56
+ each { |child| stack.unshift child if child.node_type == :element }
57
+ until stack.empty?
58
+ child = stack.pop
59
+ yield child
60
+ n = stack.size
61
+ child.each { |grandchild| stack.insert n, grandchild if grandchild.node_type == :element }
62
+ end
59
63
  end
60
64
 
61
65
  # Find (and return) first subnode (recursively) for which the block
@@ -29,6 +29,7 @@ module REXML
29
29
  err << "\nLine: #{line}\n"
30
30
  err << "Position: #{position}\n"
31
31
  err << "Last 80 unconsumed characters:\n"
32
+ err.force_encoding("ASCII-8BIT")
32
33
  err << @source.buffer[0..80].force_encoding("ASCII-8BIT").gsub(/\n/, ' ')
33
34
  end
34
35