rexml 3.1.7.3 → 3.1.8
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/.travis.yml +21 -7
- data/README.md +1 -1
- data/Rakefile +3 -5
- data/lib/rexml/doctype.rb +23 -6
- data/lib/rexml/formatters/default.rb +10 -6
- data/lib/rexml/instruction.rb +18 -10
- data/lib/rexml/namespace.rb +17 -6
- data/lib/rexml/rexml.rb +2 -2
- data/lib/rexml/xmldecl.rb +24 -11
- data/rexml.gemspec +60 -17
- data/run-test.rb +9 -0
- metadata +4 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcadd127823192aacae193e64382c9fa13744416ac0f390d94d0f3b1edf178c
|
4
|
+
data.tar.gz: 56aa2b4cfd0e6b47f8f30ab116740d4eef9bf89dd65939f0c961918bdaa0ae16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0085d9c56f4e45cdefc403839714e0dfc5ca77c98cc75edd9d547b4d5510c38cccd32eacc2037e54becc307944fda7de9b85ce5873f85bcedee3f5c8952b9bf4'
|
7
|
+
data.tar.gz: eeb2c83c8ad9f335e6a7193bf2323ef811dd5fff1776681dd78d7728dfa4a4c65b805657cda6766ec8ba67f93cac22c7497b04247945f0693b083492e78b214b
|
data/.travis.yml
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
notifications:
|
2
2
|
webhooks:
|
3
3
|
- https://webhook.commit-email.info/
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
matrix:
|
5
|
+
include:
|
6
|
+
- name: "2.3"
|
7
|
+
rvm: 2.3
|
8
|
+
- name: "2.4"
|
9
|
+
rvm: 2.4.5
|
10
|
+
- name: "2.5"
|
11
|
+
rvm: 2.5.2
|
12
|
+
- name: "2.6"
|
13
|
+
rvm: 2.6.0-rc2
|
14
|
+
- name: "trunk"
|
15
|
+
rvm: ruby-head
|
16
|
+
- name: "gem"
|
17
|
+
rvm: 2.6
|
18
|
+
install:
|
19
|
+
- rake install
|
20
|
+
script:
|
21
|
+
- mkdir -p tmp
|
22
|
+
- cd tmp
|
23
|
+
- cp -a ../test/ ./
|
24
|
+
- ../run-test.rb
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ So parsing a string is just as easy as parsing a file.
|
|
47
47
|
|
48
48
|
## Development
|
49
49
|
|
50
|
-
After checking out the repo, run `
|
50
|
+
After checking out the repo, run `rake test` to run the tests.
|
51
51
|
|
52
52
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
53
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
3
|
+
desc "Run test"
|
4
|
+
task :test do
|
5
|
+
ruby("run-test.rb")
|
8
6
|
end
|
9
7
|
|
10
8
|
task :default => :test
|
data/lib/rexml/doctype.rb
CHANGED
@@ -108,13 +108,19 @@ module REXML
|
|
108
108
|
# Ignored
|
109
109
|
def write( output, indent=0, transitive=false, ie_hack=false )
|
110
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
|
111
117
|
indent( output, indent )
|
112
118
|
output << START
|
113
119
|
output << ' '
|
114
120
|
output << @name
|
115
|
-
output << "
|
116
|
-
output << " #{@long_name
|
117
|
-
output << " #{@uri
|
121
|
+
output << " #{@external_id}" if @external_id
|
122
|
+
output << " #{quote}#{@long_name}#{quote}" if @long_name
|
123
|
+
output << " #{quote}#{@uri}#{quote}" if @uri
|
118
124
|
unless @children.empty?
|
119
125
|
output << ' ['
|
120
126
|
@children.each { |child|
|
@@ -127,7 +133,11 @@ module REXML
|
|
127
133
|
end
|
128
134
|
|
129
135
|
def context
|
130
|
-
@parent
|
136
|
+
if @parent
|
137
|
+
@parent.context
|
138
|
+
else
|
139
|
+
nil
|
140
|
+
end
|
131
141
|
end
|
132
142
|
|
133
143
|
def entity( name )
|
@@ -249,9 +259,16 @@ module REXML
|
|
249
259
|
end
|
250
260
|
|
251
261
|
def to_s
|
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
|
252
269
|
notation = "<!NOTATION #{@name} #{@middle}"
|
253
|
-
notation << " #{@public
|
254
|
-
notation << " #{@system
|
270
|
+
notation << " #{quote}#{@public}#{quote}" if @public
|
271
|
+
notation << " #{quote}#{@system}#{quote}" if @system
|
255
272
|
notation << ">"
|
256
273
|
notation
|
257
274
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
+
|
2
3
|
module REXML
|
3
4
|
module Formatters
|
4
5
|
class Default
|
@@ -66,7 +67,7 @@ module REXML
|
|
66
67
|
|
67
68
|
node.attributes.to_a.map { |a|
|
68
69
|
Hash === a ? a.values : a
|
69
|
-
}.flatten.sort_by {|attr| attr.name
|
70
|
+
}.flatten.sort_by {|attr| attr.name}.each do |attr|
|
70
71
|
output << " "
|
71
72
|
attr.write( output )
|
72
73
|
end unless node.attributes.empty?
|
@@ -101,11 +102,14 @@ module REXML
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def write_instruction( node, output )
|
104
|
-
output << Instruction::START
|
105
|
-
output <<
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
output << Instruction::START
|
106
|
+
output << node.target
|
107
|
+
content = node.content
|
108
|
+
if content
|
109
|
+
output << ' '
|
110
|
+
output << content
|
111
|
+
end
|
112
|
+
output << Instruction::STOP
|
109
113
|
end
|
110
114
|
end
|
111
115
|
end
|
data/lib/rexml/instruction.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
+
|
2
3
|
require_relative "child"
|
3
4
|
require_relative "source"
|
4
5
|
|
@@ -6,8 +7,8 @@ module REXML
|
|
6
7
|
# Represents an XML Instruction; IE, <? ... ?>
|
7
8
|
# TODO: Add parent arg (3rd arg) to constructor
|
8
9
|
class Instruction < Child
|
9
|
-
START =
|
10
|
-
STOP =
|
10
|
+
START = "<?"
|
11
|
+
STOP = "?>"
|
11
12
|
|
12
13
|
# target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
|
13
14
|
# content is everything else.
|
@@ -17,20 +18,25 @@ module REXML
|
|
17
18
|
# @param target can be one of a number of things. If String, then
|
18
19
|
# the target of this instruction is set to this. If an Instruction,
|
19
20
|
# then the Instruction is shallowly cloned (target and content are
|
20
|
-
# copied).
|
21
|
-
# an Instruction declaration.
|
21
|
+
# copied).
|
22
22
|
# @param content Must be either a String, or a Parent. Can only
|
23
23
|
# be a Parent if the target argument is a Source. Otherwise, this
|
24
24
|
# String is set as the content of this instruction.
|
25
25
|
def initialize(target, content=nil)
|
26
|
-
|
26
|
+
case target
|
27
|
+
when String
|
27
28
|
super()
|
28
29
|
@target = target
|
29
30
|
@content = content
|
30
|
-
|
31
|
+
when Instruction
|
31
32
|
super(content)
|
32
33
|
@target = target.target
|
33
34
|
@content = target.content
|
35
|
+
else
|
36
|
+
message =
|
37
|
+
"processing instruction target must be String or REXML::Instruction: "
|
38
|
+
message << "<#{target.inspect}>"
|
39
|
+
raise ArgumentError, message
|
34
40
|
end
|
35
41
|
@content.strip! if @content
|
36
42
|
end
|
@@ -45,11 +51,13 @@ module REXML
|
|
45
51
|
def write writer, indent=-1, transitive=false, ie_hack=false
|
46
52
|
Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1)
|
47
53
|
indent(writer, indent)
|
48
|
-
writer << START
|
54
|
+
writer << START
|
49
55
|
writer << @target
|
50
|
-
|
51
|
-
|
52
|
-
|
56
|
+
if @content
|
57
|
+
writer << ' '
|
58
|
+
writer << @content
|
59
|
+
end
|
60
|
+
writer << STOP
|
53
61
|
end
|
54
62
|
|
55
63
|
# @return true if other is an Instruction, and the content and target
|
data/lib/rexml/namespace.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
+
|
2
3
|
require_relative 'xmltokens'
|
3
4
|
|
4
5
|
module REXML
|
@@ -14,14 +15,24 @@ module REXML
|
|
14
15
|
# Sets the name and the expanded name
|
15
16
|
def name=( name )
|
16
17
|
@expanded_name = name
|
17
|
-
name
|
18
|
-
|
19
|
-
|
18
|
+
case name
|
19
|
+
when NAMESPLIT
|
20
|
+
if $1
|
21
|
+
@prefix = $1
|
22
|
+
else
|
23
|
+
@prefix = ""
|
24
|
+
@namespace = ""
|
25
|
+
end
|
26
|
+
@name = $2
|
27
|
+
when ""
|
28
|
+
@prefix = nil
|
29
|
+
@namespace = nil
|
30
|
+
@name = nil
|
20
31
|
else
|
21
|
-
|
22
|
-
|
32
|
+
message = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: "
|
33
|
+
message += "<#{name.inspect}>"
|
34
|
+
raise ArgumentError, message
|
23
35
|
end
|
24
|
-
@name = $2
|
25
36
|
end
|
26
37
|
|
27
38
|
# Compares names optionally WITH namespaces
|
data/lib/rexml/rexml.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
2
|
# frozen_string_literal: false
|
3
3
|
# REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby.
|
4
4
|
#
|
@@ -24,7 +24,7 @@
|
|
24
24
|
module REXML
|
25
25
|
COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
|
26
26
|
DATE = "2008/019"
|
27
|
-
VERSION = "3.1.
|
27
|
+
VERSION = "3.1.8"
|
28
28
|
REVISION = ""
|
29
29
|
|
30
30
|
Copyright = COPYRIGHT
|
data/lib/rexml/xmldecl.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
|
+
|
2
3
|
require_relative 'encoding'
|
3
4
|
require_relative 'source'
|
4
5
|
|
@@ -7,11 +8,11 @@ module REXML
|
|
7
8
|
class XMLDecl < Child
|
8
9
|
include Encoding
|
9
10
|
|
10
|
-
DEFAULT_VERSION = "1.0"
|
11
|
-
DEFAULT_ENCODING = "UTF-8"
|
12
|
-
DEFAULT_STANDALONE = "no"
|
13
|
-
START =
|
14
|
-
STOP =
|
11
|
+
DEFAULT_VERSION = "1.0"
|
12
|
+
DEFAULT_ENCODING = "UTF-8"
|
13
|
+
DEFAULT_STANDALONE = "no"
|
14
|
+
START = "<?xml"
|
15
|
+
STOP = "?>"
|
15
16
|
|
16
17
|
attr_accessor :version, :standalone
|
17
18
|
attr_reader :writeencoding, :writethis
|
@@ -46,9 +47,9 @@ module REXML
|
|
46
47
|
# Ignored
|
47
48
|
def write(writer, indent=-1, transitive=false, ie_hack=false)
|
48
49
|
return nil unless @writethis or writer.kind_of? Output
|
49
|
-
writer << START
|
50
|
+
writer << START
|
50
51
|
writer << " #{content encoding}"
|
51
|
-
writer << STOP
|
52
|
+
writer << STOP
|
52
53
|
end
|
53
54
|
|
54
55
|
def ==( other )
|
@@ -102,14 +103,26 @@ module REXML
|
|
102
103
|
end
|
103
104
|
|
104
105
|
def inspect
|
105
|
-
START
|
106
|
+
"#{START} ... #{STOP}"
|
106
107
|
end
|
107
108
|
|
108
109
|
private
|
109
110
|
def content(enc)
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
context = nil
|
112
|
+
context = parent.context if parent
|
113
|
+
if context and context[:prologue_quote] == :quote
|
114
|
+
quote = "\""
|
115
|
+
else
|
116
|
+
quote = "'"
|
117
|
+
end
|
118
|
+
|
119
|
+
rv = "version=#{quote}#{@version}#{quote}"
|
120
|
+
if @writeencoding or enc !~ /\Autf-8\z/i
|
121
|
+
rv << " encoding=#{quote}#{enc}#{quote}"
|
122
|
+
end
|
123
|
+
if @standalone
|
124
|
+
rv << " standalone=#{quote}#{@standalone}#{quote}"
|
125
|
+
end
|
113
126
|
rv
|
114
127
|
end
|
115
128
|
end
|
data/rexml.gemspec
CHANGED
@@ -16,23 +16,66 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = "https://github.com/ruby/rexml"
|
17
17
|
spec.license = "BSD-2-Clause"
|
18
18
|
|
19
|
-
spec.files = [
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
spec.files = [
|
20
|
+
".gitignore",
|
21
|
+
".travis.yml",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"lib/rexml/attlistdecl.rb",
|
27
|
+
"lib/rexml/attribute.rb",
|
28
|
+
"lib/rexml/cdata.rb",
|
29
|
+
"lib/rexml/child.rb",
|
30
|
+
"lib/rexml/comment.rb",
|
31
|
+
"lib/rexml/doctype.rb",
|
32
|
+
"lib/rexml/document.rb",
|
33
|
+
"lib/rexml/dtd/attlistdecl.rb",
|
34
|
+
"lib/rexml/dtd/dtd.rb",
|
35
|
+
"lib/rexml/dtd/elementdecl.rb",
|
36
|
+
"lib/rexml/dtd/entitydecl.rb",
|
37
|
+
"lib/rexml/dtd/notationdecl.rb",
|
38
|
+
"lib/rexml/element.rb",
|
39
|
+
"lib/rexml/encoding.rb",
|
40
|
+
"lib/rexml/entity.rb",
|
41
|
+
"lib/rexml/formatters/default.rb",
|
42
|
+
"lib/rexml/formatters/pretty.rb",
|
43
|
+
"lib/rexml/formatters/transitive.rb",
|
44
|
+
"lib/rexml/functions.rb",
|
45
|
+
"lib/rexml/instruction.rb",
|
46
|
+
"lib/rexml/light/node.rb",
|
47
|
+
"lib/rexml/namespace.rb",
|
48
|
+
"lib/rexml/node.rb",
|
49
|
+
"lib/rexml/output.rb",
|
50
|
+
"lib/rexml/parent.rb",
|
51
|
+
"lib/rexml/parseexception.rb",
|
52
|
+
"lib/rexml/parsers/baseparser.rb",
|
53
|
+
"lib/rexml/parsers/lightparser.rb",
|
54
|
+
"lib/rexml/parsers/pullparser.rb",
|
55
|
+
"lib/rexml/parsers/sax2parser.rb",
|
56
|
+
"lib/rexml/parsers/streamparser.rb",
|
57
|
+
"lib/rexml/parsers/treeparser.rb",
|
58
|
+
"lib/rexml/parsers/ultralightparser.rb",
|
59
|
+
"lib/rexml/parsers/xpathparser.rb",
|
60
|
+
"lib/rexml/quickpath.rb",
|
61
|
+
"lib/rexml/rexml.rb",
|
62
|
+
"lib/rexml/sax2listener.rb",
|
63
|
+
"lib/rexml/security.rb",
|
64
|
+
"lib/rexml/source.rb",
|
65
|
+
"lib/rexml/streamlistener.rb",
|
66
|
+
"lib/rexml/syncenumerator.rb",
|
67
|
+
"lib/rexml/text.rb",
|
68
|
+
"lib/rexml/undefinednamespaceexception.rb",
|
69
|
+
"lib/rexml/validation/relaxng.rb",
|
70
|
+
"lib/rexml/validation/validation.rb",
|
71
|
+
"lib/rexml/validation/validationexception.rb",
|
72
|
+
"lib/rexml/xmldecl.rb",
|
73
|
+
"lib/rexml/xmltokens.rb",
|
74
|
+
"lib/rexml/xpath.rb",
|
75
|
+
"lib/rexml/xpath_parser.rb",
|
76
|
+
"rexml.gemspec",
|
77
|
+
"run-test.rb",
|
78
|
+
]
|
36
79
|
spec.bindir = "exe"
|
37
80
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
81
|
spec.require_paths = ["lib"]
|
data/run-test.rb
ADDED
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.1.
|
4
|
+
version: 3.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,8 +51,6 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
-
- bin/console
|
55
|
-
- bin/setup
|
56
54
|
- lib/rexml/attlistdecl.rb
|
57
55
|
- lib/rexml/attribute.rb
|
58
56
|
- lib/rexml/cdata.rb
|
@@ -104,6 +102,7 @@ files:
|
|
104
102
|
- lib/rexml/xpath.rb
|
105
103
|
- lib/rexml/xpath_parser.rb
|
106
104
|
- rexml.gemspec
|
105
|
+
- run-test.rb
|
107
106
|
homepage: https://github.com/ruby/rexml
|
108
107
|
licenses:
|
109
108
|
- BSD-2-Clause
|
@@ -124,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
123
|
version: '0'
|
125
124
|
requirements: []
|
126
125
|
rubyforge_project:
|
127
|
-
rubygems_version:
|
126
|
+
rubygems_version: 3.0.0.beta3
|
128
127
|
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: An XML toolkit for Ruby
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "rexml"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|