rexml 3.1.9.1 → 3.2.0
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 +4 -4
- data/NEWS.md +17 -2
- data/lib/rexml/attribute.rb +20 -7
- data/lib/rexml/doctype.rb +19 -52
- data/lib/rexml/element.rb +12 -10
- data/lib/rexml/parsers/baseparser.rb +39 -139
- data/lib/rexml/rexml.rb +1 -1
- data/lib/rexml/xpath_parser.rb +1 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c40b34860b0aa6a9f52ff95da6dc77900cec26b19aa2ff44f5273e8820925e0
|
4
|
+
data.tar.gz: cb09dfb7da77bb5ec5c6b2acbc810267898cdf33d5d54b7bdbebcf2452b9fee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc64cb9eaf9012bf1e7b5fe3b5801decced322ab4a44a19c9afffd8be8da25dd3dbdef7a7b9bba22c67d5f05b54c3fec800c73f5004d1c0e08d686ed18e96de2
|
7
|
+
data.tar.gz: ee8af8e28eb56469e2a27ee306d63b4dc345c4d54d11c3a44d6cae55c0bca73f613c61f95103a104082ffcaef8a38165410a73f0af779d884fe7ded558d0cbab
|
data/NEWS.md
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
-
## 3.
|
3
|
+
## 3.2.0 - 2018-01-01 {#version-3-2-0}
|
4
4
|
|
5
5
|
### Fixes
|
6
6
|
|
7
|
-
*
|
7
|
+
* Fixed a bug that no namespace attribute isn't matched with prefix.
|
8
|
+
|
9
|
+
[ruby-list:50731][Reported by Yasuhiro KIMURA]
|
10
|
+
|
11
|
+
* Fixed a bug that the default namespace is applied to attribute names.
|
12
|
+
|
13
|
+
NOTE: It's a backward incompatible change. If your program has any
|
14
|
+
problem with this change, please report it. We may revert this fix.
|
15
|
+
|
16
|
+
* `REXML::Attribute#prefix` returns `""` for no namespace attribute.
|
17
|
+
|
18
|
+
* `REXML::Attribute#namespace` returns `""` for no namespace attribute.
|
19
|
+
|
20
|
+
### Thanks
|
21
|
+
|
22
|
+
* Yasuhiro KIMURA
|
8
23
|
|
9
24
|
## 3.1.9 - 2018-12-20 {#version-3-1-9}
|
10
25
|
|
data/lib/rexml/attribute.rb
CHANGED
@@ -67,15 +67,11 @@ module REXML
|
|
67
67
|
# e.add_attribute( "nsa:a", "aval" )
|
68
68
|
# e.add_attribute( "b", "bval" )
|
69
69
|
# e.attributes.get_attribute( "a" ).prefix # -> "nsa"
|
70
|
-
# e.attributes.get_attribute( "b" ).prefix # -> "
|
70
|
+
# e.attributes.get_attribute( "b" ).prefix # -> ""
|
71
71
|
# a = Attribute.new( "x", "y" )
|
72
72
|
# a.prefix # -> ""
|
73
73
|
def prefix
|
74
|
-
|
75
|
-
if pf == ""
|
76
|
-
pf = @element.prefix if @element
|
77
|
-
end
|
78
|
-
pf
|
74
|
+
super
|
79
75
|
end
|
80
76
|
|
81
77
|
# Returns the namespace URL, if defined, or nil otherwise
|
@@ -86,9 +82,26 @@ module REXML
|
|
86
82
|
# e.add_attribute("nsx:a", "c")
|
87
83
|
# e.attribute("ns:a").namespace # => "http://url"
|
88
84
|
# e.attribute("nsx:a").namespace # => nil
|
85
|
+
#
|
86
|
+
# This method always returns "" for no namespace attribute. Because
|
87
|
+
# the default namespace doesn't apply to attribute names.
|
88
|
+
#
|
89
|
+
# From https://www.w3.org/TR/xml-names/#uniqAttrs
|
90
|
+
#
|
91
|
+
# > the default namespace does not apply to attribute names
|
92
|
+
#
|
93
|
+
# e = REXML::Element.new("el")
|
94
|
+
# e.add_namespace("", "http://example.com/")
|
95
|
+
# e.namespace # => "http://example.com/"
|
96
|
+
# e.add_attribute("a", "b")
|
97
|
+
# e.attribute("a").namespace # => ""
|
89
98
|
def namespace arg=nil
|
90
99
|
arg = prefix if arg.nil?
|
91
|
-
|
100
|
+
if arg == ""
|
101
|
+
""
|
102
|
+
else
|
103
|
+
@element.namespace(arg)
|
104
|
+
end
|
92
105
|
end
|
93
106
|
|
94
107
|
# Returns true if other is an Attribute and has the same name and value,
|
data/lib/rexml/doctype.rb
CHANGED
@@ -7,44 +7,6 @@ require_relative 'attlistdecl'
|
|
7
7
|
require_relative 'xmltokens'
|
8
8
|
|
9
9
|
module REXML
|
10
|
-
class ReferenceWriter
|
11
|
-
def initialize(id_type,
|
12
|
-
public_id_literal,
|
13
|
-
system_literal,
|
14
|
-
context=nil)
|
15
|
-
@id_type = id_type
|
16
|
-
@public_id_literal = public_id_literal
|
17
|
-
@system_literal = system_literal
|
18
|
-
if context and context[:prologue_quote] == :apostrophe
|
19
|
-
@default_quote = "'"
|
20
|
-
else
|
21
|
-
@default_quote = "\""
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def write(output)
|
26
|
-
output << " #{@id_type}"
|
27
|
-
if @public_id_literal
|
28
|
-
if @public_id_literal.include?("'")
|
29
|
-
quote = "\""
|
30
|
-
else
|
31
|
-
quote = @default_quote
|
32
|
-
end
|
33
|
-
output << " #{quote}#{@public_id_literal}#{quote}"
|
34
|
-
end
|
35
|
-
if @system_literal
|
36
|
-
if @system_literal.include?("'")
|
37
|
-
quote = "\""
|
38
|
-
elsif @system_literal.include?("\"")
|
39
|
-
quote = "'"
|
40
|
-
else
|
41
|
-
quote = @default_quote
|
42
|
-
end
|
43
|
-
output << " #{quote}#{@system_literal}#{quote}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
10
|
# Represents an XML DOCTYPE declaration; that is, the contents of <!DOCTYPE
|
49
11
|
# ... >. DOCTYPES can be used to declare the DTD of a document, as well as
|
50
12
|
# being used to declare entities used in the document.
|
@@ -88,8 +50,6 @@ module REXML
|
|
88
50
|
super( parent )
|
89
51
|
@name = first.name
|
90
52
|
@external_id = first.external_id
|
91
|
-
@long_name = first.instance_variable_get(:@long_name)
|
92
|
-
@uri = first.instance_variable_get(:@uri)
|
93
53
|
elsif first.kind_of? Array
|
94
54
|
super( parent )
|
95
55
|
@name = first[0]
|
@@ -148,17 +108,19 @@ module REXML
|
|
148
108
|
# Ignored
|
149
109
|
def write( output, indent=0, transitive=false, ie_hack=false )
|
150
110
|
f = REXML::Formatters::Default.new
|
111
|
+
c = context
|
112
|
+
if c and c[:prologue_quote] == :apostrophe
|
113
|
+
quote = "'"
|
114
|
+
else
|
115
|
+
quote = "\""
|
116
|
+
end
|
151
117
|
indent( output, indent )
|
152
118
|
output << START
|
153
119
|
output << ' '
|
154
120
|
output << @name
|
155
|
-
if @external_id
|
156
|
-
|
157
|
-
|
158
|
-
@uri,
|
159
|
-
context)
|
160
|
-
reference_writer.write(output)
|
161
|
-
end
|
121
|
+
output << " #{@external_id}" if @external_id
|
122
|
+
output << " #{quote}#{@long_name}#{quote}" if @long_name
|
123
|
+
output << " #{quote}#{@uri}#{quote}" if @uri
|
162
124
|
unless @children.empty?
|
163
125
|
output << ' ['
|
164
126
|
@children.each { |child|
|
@@ -297,11 +259,16 @@ module REXML
|
|
297
259
|
end
|
298
260
|
|
299
261
|
def to_s
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
262
|
+
c = nil
|
263
|
+
c = parent.context if parent
|
264
|
+
if c and c[:prologue_quote] == :apostrophe
|
265
|
+
quote = "'"
|
266
|
+
else
|
267
|
+
quote = "\""
|
268
|
+
end
|
269
|
+
notation = "<!NOTATION #{@name} #{@middle}"
|
270
|
+
notation << " #{quote}#{@public}#{quote}" if @public
|
271
|
+
notation << " #{quote}#{@system}#{quote}" if @system
|
305
272
|
notation << ">"
|
306
273
|
notation
|
307
274
|
end
|
data/lib/rexml/element.rb
CHANGED
@@ -1132,16 +1132,18 @@ module REXML
|
|
1132
1132
|
old_attr[value.prefix] = value
|
1133
1133
|
elsif old_attr.prefix != value.prefix
|
1134
1134
|
# Check for conflicting namespaces
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1135
|
+
if value.prefix != "xmlns" and old_attr.prefix != "xmlns"
|
1136
|
+
old_namespace = old_attr.namespace
|
1137
|
+
new_namespace = value.namespace
|
1138
|
+
if old_namespace == new_namespace
|
1139
|
+
raise ParseException.new(
|
1140
|
+
"Namespace conflict in adding attribute \"#{value.name}\": "+
|
1141
|
+
"Prefix \"#{old_attr.prefix}\" = \"#{old_namespace}\" and "+
|
1142
|
+
"prefix \"#{value.prefix}\" = \"#{new_namespace}\"")
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
store value.name, {old_attr.prefix => old_attr,
|
1146
|
+
value.prefix => value}
|
1145
1147
|
else
|
1146
1148
|
store value.name, value
|
1147
1149
|
end
|
@@ -50,6 +50,7 @@ module REXML
|
|
50
50
|
|
51
51
|
DOCTYPE_START = /\A\s*<!DOCTYPE\s/um
|
52
52
|
DOCTYPE_END = /\A\s*\]\s*>/um
|
53
|
+
DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/um
|
53
54
|
ATTRIBUTE_PATTERN = /\s*(#{QNAME_STR})\s*=\s*(["'])(.*?)\4/um
|
54
55
|
COMMENT_START = /\A<!--/u
|
55
56
|
COMMENT_PATTERN = /<!--(.*?)-->/um
|
@@ -60,14 +61,15 @@ module REXML
|
|
60
61
|
XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um
|
61
62
|
INSTRUCTION_START = /\A<\?/u
|
62
63
|
INSTRUCTION_PATTERN = /<\?#{NAME}(\s+.*?)?\?>/um
|
63
|
-
TAG_MATCH =
|
64
|
-
CLOSE_MATCH =
|
64
|
+
TAG_MATCH = /^<((?>#{QNAME_STR}))/um
|
65
|
+
CLOSE_MATCH = /^\s*<\/(#{QNAME_STR})\s*>/um
|
65
66
|
|
66
67
|
VERSION = /\bversion\s*=\s*["'](.*?)['"]/um
|
67
68
|
ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um
|
68
69
|
STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um
|
69
70
|
|
70
71
|
ENTITY_START = /\A\s*<!ENTITY/
|
72
|
+
IDENTITY = /^([!\*\w\-]+)(\s+#{NCNAME_STR})?(\s+["'](.*?)['"])?(\s+['"](.*?)["'])?/u
|
71
73
|
ELEMENTDECL_START = /\A\s*<!ELEMENT/um
|
72
74
|
ELEMENTDECL_PATTERN = /\A\s*(<!ELEMENT.*?)>/um
|
73
75
|
SYSTEMENTITY = /\A\s*(%.*?;)\s*$/um
|
@@ -81,6 +83,9 @@ module REXML
|
|
81
83
|
ATTDEF_RE = /#{ATTDEF}/
|
82
84
|
ATTLISTDECL_START = /\A\s*<!ATTLIST/um
|
83
85
|
ATTLISTDECL_PATTERN = /\A\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
|
86
|
+
NOTATIONDECL_START = /\A\s*<!NOTATION/um
|
87
|
+
PUBLIC = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
|
88
|
+
SYSTEM = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
|
84
89
|
|
85
90
|
TEXT_PATTERN = /\A([^<]*)/um
|
86
91
|
|
@@ -98,11 +103,6 @@ module REXML
|
|
98
103
|
GEDECL = "<!ENTITY\\s+#{NAME}\\s+#{ENTITYDEF}\\s*>"
|
99
104
|
ENTITYDECL = /\s*(?:#{GEDECL})|(?:#{PEDECL})/um
|
100
105
|
|
101
|
-
NOTATIONDECL_START = /\A\s*<!NOTATION/um
|
102
|
-
EXTERNAL_ID_PUBLIC = /\A\s*PUBLIC\s+#{PUBIDLITERAL}\s+#{SYSTEMLITERAL}\s*/um
|
103
|
-
EXTERNAL_ID_SYSTEM = /\A\s*SYSTEM\s+#{SYSTEMLITERAL}\s*/um
|
104
|
-
PUBLIC_ID = /\A\s*PUBLIC\s+#{PUBIDLITERAL}\s*/um
|
105
|
-
|
106
106
|
EREFERENCE = /&(?!#{NAME};)/
|
107
107
|
|
108
108
|
DEFAULT_ENTITIES = {
|
@@ -195,9 +195,11 @@ module REXML
|
|
195
195
|
return [ :end_document ] if empty?
|
196
196
|
return @stack.shift if @stack.size > 0
|
197
197
|
#STDERR.puts @source.encoding
|
198
|
+
@source.read if @source.buffer.size<2
|
198
199
|
#STDERR.puts "BUFFER = #{@source.buffer.inspect}"
|
199
200
|
if @document_status == nil
|
200
|
-
|
201
|
+
#@source.consume( /^\s*/um )
|
202
|
+
word = @source.match( /^((?:\s+)|(?:<[^>]*>))/um )
|
201
203
|
word = word[1] unless word.nil?
|
202
204
|
#STDERR.puts "WORD = #{word.inspect}"
|
203
205
|
case word
|
@@ -222,49 +224,38 @@ module REXML
|
|
222
224
|
when INSTRUCTION_START
|
223
225
|
return process_instruction
|
224
226
|
when DOCTYPE_START
|
225
|
-
|
226
|
-
@source.match(DOCTYPE_START, true)
|
227
|
+
md = @source.match( DOCTYPE_PATTERN, true )
|
227
228
|
@nsstack.unshift(curr_ns=Set.new)
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
229
|
+
identity = md[1]
|
230
|
+
close = md[2]
|
231
|
+
identity =~ IDENTITY
|
232
|
+
name = $1
|
233
|
+
raise REXML::ParseException.new("DOCTYPE is missing a name") if name.nil?
|
234
|
+
pub_sys = $2.nil? ? nil : $2.strip
|
235
|
+
long_name = $4.nil? ? nil : $4.strip
|
236
|
+
uri = $6.nil? ? nil : $6.strip
|
237
|
+
args = [ :start_doctype, name, pub_sys, long_name, uri ]
|
238
|
+
if close == ">"
|
234
239
|
@document_status = :after_doctype
|
235
|
-
|
236
|
-
|
237
|
-
accept_external_id: true,
|
238
|
-
accept_public_id: false)
|
239
|
-
if id[0] == "SYSTEM"
|
240
|
-
# For backward compatibility
|
241
|
-
id[1], id[2] = id[2], nil
|
242
|
-
end
|
243
|
-
if @source.match(/\A\s*\[/um, true)
|
244
|
-
@document_status = :in_doctype
|
245
|
-
elsif @source.match(/\A\s*>/um, true)
|
246
|
-
@document_status = :after_doctype
|
247
|
-
else
|
248
|
-
message = "#{base_error_message}: garbage after external ID"
|
249
|
-
raise REXML::ParseException.new(message, @source)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
args = [:start_doctype, name, *id]
|
253
|
-
if @document_status == :after_doctype
|
254
|
-
@source.match(/\A\s*/um, true)
|
240
|
+
@source.read if @source.buffer.size<2
|
241
|
+
md = @source.match(/^\s*/um, true)
|
255
242
|
@stack << [ :end_doctype ]
|
243
|
+
else
|
244
|
+
@document_status = :in_doctype
|
256
245
|
end
|
257
246
|
return args
|
258
|
-
when
|
247
|
+
when /^\s+/
|
259
248
|
else
|
260
249
|
@document_status = :after_doctype
|
250
|
+
@source.read if @source.buffer.size<2
|
251
|
+
md = @source.match(/\s*/um, true)
|
261
252
|
if @source.encoding == "UTF-8"
|
262
253
|
@source.buffer.force_encoding(::Encoding::UTF_8)
|
263
254
|
end
|
264
255
|
end
|
265
256
|
end
|
266
257
|
if @document_status == :in_doctype
|
267
|
-
md = @source.match(/\
|
258
|
+
md = @source.match(/\s*(.*?>)/um)
|
268
259
|
case md[1]
|
269
260
|
when SYSTEMENTITY
|
270
261
|
match = @source.match( SYSTEMENTITY, true )[1]
|
@@ -321,35 +312,24 @@ module REXML
|
|
321
312
|
end
|
322
313
|
return [ :attlistdecl, element, pairs, contents ]
|
323
314
|
when NOTATIONDECL_START
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
name = parse_name(base_error_message)
|
334
|
-
id = parse_id(base_error_message,
|
335
|
-
accept_external_id: true,
|
336
|
-
accept_public_id: true)
|
337
|
-
unless @source.match(/\A\s*>/um, true)
|
338
|
-
message = "#{base_error_message}: garbage before end >"
|
339
|
-
raise REXML::ParseException.new(message, @source)
|
315
|
+
md = nil
|
316
|
+
if @source.match( PUBLIC )
|
317
|
+
md = @source.match( PUBLIC, true )
|
318
|
+
vals = [md[1],md[2],md[4],md[6]]
|
319
|
+
elsif @source.match( SYSTEM )
|
320
|
+
md = @source.match( SYSTEM, true )
|
321
|
+
vals = [md[1],md[2],nil,md[4]]
|
322
|
+
else
|
323
|
+
raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source )
|
340
324
|
end
|
341
|
-
return [:notationdecl,
|
325
|
+
return [ :notationdecl, *vals ]
|
342
326
|
when DOCTYPE_END
|
343
327
|
@document_status = :after_doctype
|
344
328
|
@source.match( DOCTYPE_END, true )
|
345
329
|
return [ :end_doctype ]
|
346
330
|
end
|
347
331
|
end
|
348
|
-
if @document_status == :after_doctype
|
349
|
-
@source.match(/\A\s*/um, true)
|
350
|
-
end
|
351
332
|
begin
|
352
|
-
@source.read if @source.buffer.size<2
|
353
333
|
if @source.buffer[0] == ?<
|
354
334
|
if @source.buffer[1] == ?/
|
355
335
|
@nsstack.shift
|
@@ -388,7 +368,6 @@ module REXML
|
|
388
368
|
unless md
|
389
369
|
raise REXML::ParseException.new("malformed XML: missing tag start", @source)
|
390
370
|
end
|
391
|
-
@document_status = :in_element
|
392
371
|
prefixes = Set.new
|
393
372
|
prefixes << md[2] if md[2]
|
394
373
|
@nsstack.unshift(curr_ns=Set.new)
|
@@ -494,85 +473,6 @@ module REXML
|
|
494
473
|
true
|
495
474
|
end
|
496
475
|
|
497
|
-
def parse_name(base_error_message)
|
498
|
-
md = @source.match(/\A\s*#{NAME}/um, true)
|
499
|
-
unless md
|
500
|
-
if @source.match(/\A\s*\S/um)
|
501
|
-
message = "#{base_error_message}: invalid name"
|
502
|
-
else
|
503
|
-
message = "#{base_error_message}: name is missing"
|
504
|
-
end
|
505
|
-
raise REXML::ParseException.new(message, @source)
|
506
|
-
end
|
507
|
-
md[1]
|
508
|
-
end
|
509
|
-
|
510
|
-
def parse_id(base_error_message,
|
511
|
-
accept_external_id:,
|
512
|
-
accept_public_id:)
|
513
|
-
if accept_external_id and (md = @source.match(EXTERNAL_ID_PUBLIC, true))
|
514
|
-
pubid = system = nil
|
515
|
-
pubid_literal = md[1]
|
516
|
-
pubid = pubid_literal[1..-2] if pubid_literal # Remove quote
|
517
|
-
system_literal = md[2]
|
518
|
-
system = system_literal[1..-2] if system_literal # Remove quote
|
519
|
-
["PUBLIC", pubid, system]
|
520
|
-
elsif accept_public_id and (md = @source.match(PUBLIC_ID, true))
|
521
|
-
pubid = system = nil
|
522
|
-
pubid_literal = md[1]
|
523
|
-
pubid = pubid_literal[1..-2] if pubid_literal # Remove quote
|
524
|
-
["PUBLIC", pubid, nil]
|
525
|
-
elsif accept_external_id and (md = @source.match(EXTERNAL_ID_SYSTEM, true))
|
526
|
-
system = nil
|
527
|
-
system_literal = md[1]
|
528
|
-
system = system_literal[1..-2] if system_literal # Remove quote
|
529
|
-
["SYSTEM", nil, system]
|
530
|
-
else
|
531
|
-
details = parse_id_invalid_details(accept_external_id: accept_external_id,
|
532
|
-
accept_public_id: accept_public_id)
|
533
|
-
message = "#{base_error_message}: #{details}"
|
534
|
-
raise REXML::ParseException.new(message, @source)
|
535
|
-
end
|
536
|
-
end
|
537
|
-
|
538
|
-
def parse_id_invalid_details(accept_external_id:,
|
539
|
-
accept_public_id:)
|
540
|
-
public = /\A\s*PUBLIC/um
|
541
|
-
system = /\A\s*SYSTEM/um
|
542
|
-
if (accept_external_id or accept_public_id) and @source.match(/#{public}/um)
|
543
|
-
if @source.match(/#{public}(?:\s+[^'"]|\s*[\[>])/um)
|
544
|
-
return "public ID literal is missing"
|
545
|
-
end
|
546
|
-
unless @source.match(/#{public}\s+#{PUBIDLITERAL}/um)
|
547
|
-
return "invalid public ID literal"
|
548
|
-
end
|
549
|
-
if accept_public_id
|
550
|
-
if @source.match(/#{public}\s+#{PUBIDLITERAL}\s+[^'"]/um)
|
551
|
-
return "system ID literal is missing"
|
552
|
-
end
|
553
|
-
unless @source.match(/#{public}\s+#{PUBIDLITERAL}\s+#{SYSTEMLITERAL}/um)
|
554
|
-
return "invalid system literal"
|
555
|
-
end
|
556
|
-
"garbage after system literal"
|
557
|
-
else
|
558
|
-
"garbage after public ID literal"
|
559
|
-
end
|
560
|
-
elsif accept_external_id and @source.match(/#{system}/um)
|
561
|
-
if @source.match(/#{system}(?:\s+[^'"]|\s*[\[>])/um)
|
562
|
-
return "system literal is missing"
|
563
|
-
end
|
564
|
-
unless @source.match(/#{system}\s+#{SYSTEMLITERAL}/um)
|
565
|
-
return "invalid system literal"
|
566
|
-
end
|
567
|
-
"garbage after system literal"
|
568
|
-
else
|
569
|
-
unless @source.match(/\A\s*(?:PUBLIC|SYSTEM)\s/um)
|
570
|
-
return "invalid ID type"
|
571
|
-
end
|
572
|
-
"ID type is missing"
|
573
|
-
end
|
574
|
-
end
|
575
|
-
|
576
476
|
def process_instruction
|
577
477
|
match_data = @source.match(INSTRUCTION_PATTERN, true)
|
578
478
|
unless match_data
|
data/lib/rexml/rexml.rb
CHANGED
data/lib/rexml/xpath_parser.rb
CHANGED
@@ -493,9 +493,7 @@ module REXML
|
|
493
493
|
if prefix.nil?
|
494
494
|
raw_node.name == name
|
495
495
|
elsif prefix.empty?
|
496
|
-
|
497
|
-
raw_node.name == name and
|
498
|
-
raw_node.namespace == raw_node.element.namespace
|
496
|
+
raw_node.name == name and raw_node.namespace == ""
|
499
497
|
else
|
500
498
|
# FIXME: This DOUBLES the time XPath searches take
|
501
499
|
ns = get_namespace(raw_node.element, prefix)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.0.1
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: An XML toolkit for Ruby
|