rexml 3.2.4 → 3.4.1

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +558 -0
  3. data/README.md +11 -14
  4. data/doc/rexml/context.rdoc +143 -0
  5. data/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  6. data/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  7. data/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  8. data/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  9. data/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  10. data/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  11. data/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  12. data/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  13. data/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  14. data/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  15. data/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  16. data/doc/rexml/tutorial.rdoc +1358 -0
  17. data/lib/rexml/attribute.rb +17 -11
  18. data/lib/rexml/doctype.rb +55 -31
  19. data/lib/rexml/document.rb +199 -35
  20. data/lib/rexml/element.rb +1802 -487
  21. data/lib/rexml/entity.rb +9 -38
  22. data/lib/rexml/formatters/pretty.rb +3 -3
  23. data/lib/rexml/functions.rb +1 -2
  24. data/lib/rexml/light/node.rb +0 -8
  25. data/lib/rexml/namespace.rb +8 -4
  26. data/lib/rexml/node.rb +8 -4
  27. data/lib/rexml/parseexception.rb +1 -0
  28. data/lib/rexml/parsers/baseparser.rb +545 -252
  29. data/lib/rexml/parsers/pullparser.rb +16 -0
  30. data/lib/rexml/parsers/sax2parser.rb +16 -19
  31. data/lib/rexml/parsers/streamparser.rb +16 -10
  32. data/lib/rexml/parsers/treeparser.rb +9 -21
  33. data/lib/rexml/parsers/xpathparser.rb +161 -97
  34. data/lib/rexml/rexml.rb +29 -22
  35. data/lib/rexml/source.rb +185 -100
  36. data/lib/rexml/text.rb +60 -61
  37. data/lib/rexml/xpath_parser.rb +43 -33
  38. data/lib/rexml.rb +3 -0
  39. metadata +42 -46
  40. data/.gitignore +0 -9
  41. data/.travis.yml +0 -24
  42. data/Gemfile +0 -6
  43. data/Rakefile +0 -8
  44. data/rexml.gemspec +0 -84
@@ -7,39 +7,45 @@ require_relative 'xmltokens'
7
7
  require_relative 'attribute'
8
8
  require_relative 'parsers/xpathparser'
9
9
 
10
- class Object
11
- # provides a unified +clone+ operation, for REXML::XPathParser
12
- # to use across multiple Object types
13
- def dclone
14
- clone
15
- end
16
- end
17
- class Symbol
18
- # provides a unified +clone+ operation, for REXML::XPathParser
19
- # to use across multiple Object types
20
- def dclone ; self ; end
21
- end
22
- class Integer
23
- # provides a unified +clone+ operation, for REXML::XPathParser
24
- # to use across multiple Object types
25
- def dclone ; self ; end
26
- end
27
- class Float
28
- # provides a unified +clone+ operation, for REXML::XPathParser
29
- # to use across multiple Object types
30
- def dclone ; self ; end
31
- end
32
- class Array
33
- # provides a unified +clone+ operation, for REXML::XPathParser
34
- # to use across multiple Object+ types
35
- def dclone
36
- klone = self.clone
37
- klone.clear
38
- self.each{|v| klone << v.dclone}
39
- klone
10
+ module REXML
11
+ module DClonable
12
+ refine Object do
13
+ # provides a unified +clone+ operation, for REXML::XPathParser
14
+ # to use across multiple Object types
15
+ def dclone
16
+ clone
17
+ end
18
+ end
19
+ refine Symbol do
20
+ # provides a unified +clone+ operation, for REXML::XPathParser
21
+ # to use across multiple Object types
22
+ def dclone ; self ; end
23
+ end
24
+ refine Integer do
25
+ # provides a unified +clone+ operation, for REXML::XPathParser
26
+ # to use across multiple Object types
27
+ def dclone ; self ; end
28
+ end
29
+ refine Float do
30
+ # provides a unified +clone+ operation, for REXML::XPathParser
31
+ # to use across multiple Object types
32
+ def dclone ; self ; end
33
+ end
34
+ refine Array do
35
+ # provides a unified +clone+ operation, for REXML::XPathParser
36
+ # to use across multiple Object+ types
37
+ def dclone
38
+ klone = self.clone
39
+ klone.clear
40
+ self.each{|v| klone << v.dclone}
41
+ klone
42
+ end
43
+ end
40
44
  end
41
45
  end
42
46
 
47
+ using REXML::DClonable
48
+
43
49
  module REXML
44
50
  # You don't want to use this class. Really. Use XPath, which is a wrapper
45
51
  # for this class. Believe me. You don't want to poke around in here.
@@ -584,6 +590,7 @@ module REXML
584
590
 
585
591
  def evaluate_predicate(expression, nodesets)
586
592
  enter(:predicate, expression, nodesets) if @debug
593
+ new_nodeset_count = 0
587
594
  new_nodesets = nodesets.collect do |nodeset|
588
595
  new_nodeset = []
589
596
  subcontext = { :size => nodeset.size }
@@ -600,17 +607,20 @@ module REXML
600
607
  result = result[0] if result.kind_of? Array and result.length == 1
601
608
  if result.kind_of? Numeric
602
609
  if result == node.position
603
- new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
610
+ new_nodeset_count += 1
611
+ new_nodeset << XPathNode.new(node, position: new_nodeset_count)
604
612
  end
605
613
  elsif result.instance_of? Array
606
614
  if result.size > 0 and result.inject(false) {|k,s| s or k}
607
615
  if result.size > 0
608
- new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
616
+ new_nodeset_count += 1
617
+ new_nodeset << XPathNode.new(node, position: new_nodeset_count)
609
618
  end
610
619
  end
611
620
  else
612
621
  if result
613
- new_nodeset << XPathNode.new(node, position: new_nodeset.size + 1)
622
+ new_nodeset_count += 1
623
+ new_nodeset << XPathNode.new(node, position: new_nodeset_count)
614
624
  end
615
625
  end
616
626
  end
data/lib/rexml.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "rexml/document"
metadata CHANGED
@@ -1,57 +1,54 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2020-01-31 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
10
+ date: 2025-02-16 00:00:00.000000000 Z
11
+ dependencies: []
41
12
  description: An XML toolkit for Ruby
42
13
  email:
43
14
  - kou@cozmixng.org
44
15
  executables: []
45
16
  extensions: []
46
- extra_rdoc_files: []
17
+ extra_rdoc_files:
18
+ - LICENSE.txt
19
+ - NEWS.md
20
+ - README.md
21
+ - doc/rexml/context.rdoc
22
+ - doc/rexml/tasks/rdoc/child.rdoc
23
+ - doc/rexml/tasks/rdoc/document.rdoc
24
+ - doc/rexml/tasks/rdoc/element.rdoc
25
+ - doc/rexml/tasks/rdoc/node.rdoc
26
+ - doc/rexml/tasks/rdoc/parent.rdoc
27
+ - doc/rexml/tasks/tocs/child_toc.rdoc
28
+ - doc/rexml/tasks/tocs/document_toc.rdoc
29
+ - doc/rexml/tasks/tocs/element_toc.rdoc
30
+ - doc/rexml/tasks/tocs/master_toc.rdoc
31
+ - doc/rexml/tasks/tocs/node_toc.rdoc
32
+ - doc/rexml/tasks/tocs/parent_toc.rdoc
33
+ - doc/rexml/tutorial.rdoc
47
34
  files:
48
- - ".gitignore"
49
- - ".travis.yml"
50
- - Gemfile
51
35
  - LICENSE.txt
52
36
  - NEWS.md
53
37
  - README.md
54
- - Rakefile
38
+ - doc/rexml/context.rdoc
39
+ - doc/rexml/tasks/rdoc/child.rdoc
40
+ - doc/rexml/tasks/rdoc/document.rdoc
41
+ - doc/rexml/tasks/rdoc/element.rdoc
42
+ - doc/rexml/tasks/rdoc/node.rdoc
43
+ - doc/rexml/tasks/rdoc/parent.rdoc
44
+ - doc/rexml/tasks/tocs/child_toc.rdoc
45
+ - doc/rexml/tasks/tocs/document_toc.rdoc
46
+ - doc/rexml/tasks/tocs/element_toc.rdoc
47
+ - doc/rexml/tasks/tocs/master_toc.rdoc
48
+ - doc/rexml/tasks/tocs/node_toc.rdoc
49
+ - doc/rexml/tasks/tocs/parent_toc.rdoc
50
+ - doc/rexml/tutorial.rdoc
51
+ - lib/rexml.rb
55
52
  - lib/rexml/attlistdecl.rb
56
53
  - lib/rexml/attribute.rb
57
54
  - lib/rexml/cdata.rb
@@ -101,29 +98,28 @@ files:
101
98
  - lib/rexml/xmltokens.rb
102
99
  - lib/rexml/xpath.rb
103
100
  - lib/rexml/xpath_parser.rb
104
- - rexml.gemspec
105
101
  homepage: https://github.com/ruby/rexml
106
102
  licenses:
107
103
  - BSD-2-Clause
108
- metadata: {}
109
- post_install_message:
110
- rdoc_options: []
104
+ metadata:
105
+ changelog_uri: https://github.com/ruby/rexml/releases/tag/v3.4.1
106
+ rdoc_options:
107
+ - "--main"
108
+ - README.md
111
109
  require_paths:
112
110
  - lib
113
111
  required_ruby_version: !ruby/object:Gem::Requirement
114
112
  requirements:
115
113
  - - ">="
116
114
  - !ruby/object:Gem::Version
117
- version: '0'
115
+ version: 2.5.0
118
116
  required_rubygems_version: !ruby/object:Gem::Requirement
119
117
  requirements:
120
118
  - - ">="
121
119
  - !ruby/object:Gem::Version
122
120
  version: '0'
123
121
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.7.6.2
126
- signing_key:
122
+ rubygems_version: 3.6.2
127
123
  specification_version: 4
128
124
  summary: An XML toolkit for Ruby
129
125
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
data/.travis.yml DELETED
@@ -1,24 +0,0 @@
1
- notifications:
2
- webhooks:
3
- - https://webhook.commit-email.info/
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/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in rexml.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- desc "Run test"
4
- task :test do
5
- ruby("run-test.rb")
6
- end
7
-
8
- task :default => :test
data/rexml.gemspec DELETED
@@ -1,84 +0,0 @@
1
- begin
2
- require_relative "lib/rexml/rexml"
3
- rescue LoadError
4
- # for Ruby core repository
5
- require_relative "rexml"
6
- end
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = "rexml"
10
- spec.version = REXML::VERSION
11
- spec.authors = ["Kouhei Sutou"]
12
- spec.email = ["kou@cozmixng.org"]
13
-
14
- spec.summary = %q{An XML toolkit for Ruby}
15
- spec.description = %q{An XML toolkit for Ruby}
16
- spec.homepage = "https://github.com/ruby/rexml"
17
- spec.license = "BSD-2-Clause"
18
-
19
- spec.files = [
20
- ".gitignore",
21
- ".travis.yml",
22
- "Gemfile",
23
- "LICENSE.txt",
24
- "NEWS.md",
25
- "README.md",
26
- "Rakefile",
27
- "lib/rexml/attlistdecl.rb",
28
- "lib/rexml/attribute.rb",
29
- "lib/rexml/cdata.rb",
30
- "lib/rexml/child.rb",
31
- "lib/rexml/comment.rb",
32
- "lib/rexml/doctype.rb",
33
- "lib/rexml/document.rb",
34
- "lib/rexml/dtd/attlistdecl.rb",
35
- "lib/rexml/dtd/dtd.rb",
36
- "lib/rexml/dtd/elementdecl.rb",
37
- "lib/rexml/dtd/entitydecl.rb",
38
- "lib/rexml/dtd/notationdecl.rb",
39
- "lib/rexml/element.rb",
40
- "lib/rexml/encoding.rb",
41
- "lib/rexml/entity.rb",
42
- "lib/rexml/formatters/default.rb",
43
- "lib/rexml/formatters/pretty.rb",
44
- "lib/rexml/formatters/transitive.rb",
45
- "lib/rexml/functions.rb",
46
- "lib/rexml/instruction.rb",
47
- "lib/rexml/light/node.rb",
48
- "lib/rexml/namespace.rb",
49
- "lib/rexml/node.rb",
50
- "lib/rexml/output.rb",
51
- "lib/rexml/parent.rb",
52
- "lib/rexml/parseexception.rb",
53
- "lib/rexml/parsers/baseparser.rb",
54
- "lib/rexml/parsers/lightparser.rb",
55
- "lib/rexml/parsers/pullparser.rb",
56
- "lib/rexml/parsers/sax2parser.rb",
57
- "lib/rexml/parsers/streamparser.rb",
58
- "lib/rexml/parsers/treeparser.rb",
59
- "lib/rexml/parsers/ultralightparser.rb",
60
- "lib/rexml/parsers/xpathparser.rb",
61
- "lib/rexml/quickpath.rb",
62
- "lib/rexml/rexml.rb",
63
- "lib/rexml/sax2listener.rb",
64
- "lib/rexml/security.rb",
65
- "lib/rexml/source.rb",
66
- "lib/rexml/streamlistener.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
- ]
78
- spec.bindir = "exe"
79
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
80
- spec.require_paths = ["lib"]
81
-
82
- spec.add_development_dependency "bundler"
83
- spec.add_development_dependency "rake"
84
- end