packwerk 3.2.3 → 3.3.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 (124) hide show
  1. checksums.yaml +4 -4
  2. data/exe/packwerk +0 -4
  3. data/lib/packwerk/application_validator.rb +11 -10
  4. data/lib/packwerk/association_inspector.rb +21 -32
  5. data/lib/packwerk/cache.rb +43 -36
  6. data/lib/packwerk/checker.rb +24 -26
  7. data/lib/packwerk/cli.rb +13 -20
  8. data/lib/packwerk/commands/base_command.rb +20 -26
  9. data/lib/packwerk/commands/check_command.rb +8 -8
  10. data/lib/packwerk/commands/help_command.rb +3 -4
  11. data/lib/packwerk/commands/init_command.rb +2 -3
  12. data/lib/packwerk/commands/lazy_loaded_entry.rb +5 -7
  13. data/lib/packwerk/commands/update_todo_command.rb +3 -3
  14. data/lib/packwerk/commands/uses_parse_run.rb +20 -26
  15. data/lib/packwerk/commands/validate_command.rb +6 -7
  16. data/lib/packwerk/commands/version_command.rb +2 -3
  17. data/lib/packwerk/commands.rb +5 -8
  18. data/lib/packwerk/configuration.rb +29 -43
  19. data/lib/packwerk/const_node_inspector.rb +11 -15
  20. data/lib/packwerk/constant_context.rb +0 -2
  21. data/lib/packwerk/constant_discovery.rb +3 -16
  22. data/lib/packwerk/constant_name_inspector.rb +4 -11
  23. data/lib/packwerk/extension_loader.rb +1 -2
  24. data/lib/packwerk/file_processor.rb +20 -25
  25. data/lib/packwerk/files_for_processing.rb +13 -29
  26. data/lib/packwerk/formatters/default_offenses_formatter.rb +14 -12
  27. data/lib/packwerk/formatters/progress_formatter.rb +10 -12
  28. data/lib/packwerk/generators/configuration_file.rb +5 -9
  29. data/lib/packwerk/generators/root_package.rb +3 -7
  30. data/lib/packwerk/graph.rb +1 -7
  31. data/lib/packwerk/node_helpers.rb +32 -38
  32. data/lib/packwerk/node_processor.rb +2 -14
  33. data/lib/packwerk/node_processor_factory.rb +13 -7
  34. data/lib/packwerk/node_visitor.rb +2 -10
  35. data/lib/packwerk/offense.rb +6 -12
  36. data/lib/packwerk/offense_collection.rb +22 -35
  37. data/lib/packwerk/offenses_formatter.rb +27 -34
  38. data/lib/packwerk/output_style.rb +10 -11
  39. data/lib/packwerk/output_styles/coloured.rb +6 -4
  40. data/lib/packwerk/output_styles/plain.rb +6 -4
  41. data/lib/packwerk/package.rb +15 -16
  42. data/lib/packwerk/package_set.rb +15 -25
  43. data/lib/packwerk/package_todo.rb +21 -30
  44. data/lib/packwerk/parse_run.rb +10 -37
  45. data/lib/packwerk/parsed_constant_definitions.rb +10 -24
  46. data/lib/packwerk/parsers/erb.rb +11 -22
  47. data/lib/packwerk/parsers/factory.rb +9 -9
  48. data/lib/packwerk/parsers/parser_interface.rb +5 -10
  49. data/lib/packwerk/parsers/ruby.rb +9 -14
  50. data/lib/packwerk/parsers.rb +2 -4
  51. data/lib/packwerk/rails_load_paths.rb +6 -11
  52. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +10 -15
  53. data/lib/packwerk/reference_checking/reference_checker.rb +2 -8
  54. data/lib/packwerk/reference_extractor.rb +22 -55
  55. data/lib/packwerk/reference_offense.rb +5 -15
  56. data/lib/packwerk/run_context.rb +28 -39
  57. data/lib/packwerk/spring_command.rb +4 -7
  58. data/lib/packwerk/validator/result.rb +12 -5
  59. data/lib/packwerk/validator.rb +23 -33
  60. data/lib/packwerk/validators/dependency_validator.rb +9 -10
  61. data/lib/packwerk/version.rb +1 -1
  62. data/lib/packwerk.rb +0 -1
  63. metadata +15 -76
  64. data/lib/packwerk/disable_sorbet.rb +0 -41
  65. data/sorbet/config +0 -4
  66. data/sorbet/rbi/gems/actionpack@7.0.8.7.rbi +0 -19338
  67. data/sorbet/rbi/gems/actionview@7.0.8.7.rbi +0 -15492
  68. data/sorbet/rbi/gems/activesupport@7.0.8.7.rbi +0 -18283
  69. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -584
  70. data/sorbet/rbi/gems/better_html@2.1.1.rbi +0 -529
  71. data/sorbet/rbi/gems/builder@3.3.0.rbi +0 -8
  72. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -36
  73. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +0 -11656
  74. data/sorbet/rbi/gems/constant_resolver@0.3.0.rbi +0 -99
  75. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -622
  76. data/sorbet/rbi/gems/erubi@1.13.1.rbi +0 -154
  77. data/sorbet/rbi/gems/i18n@1.14.7.rbi +0 -2358
  78. data/sorbet/rbi/gems/json@2.7.2.rbi +0 -1561
  79. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14237
  80. data/sorbet/rbi/gems/loofah@2.24.0.rbi +0 -1104
  81. data/sorbet/rbi/gems/m@1.6.0.rbi +0 -257
  82. data/sorbet/rbi/gems/method_source@1.1.0.rbi +0 -303
  83. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +0 -98
  84. data/sorbet/rbi/gems/minitest@5.25.4.rbi +0 -2229
  85. data/sorbet/rbi/gems/mocha@2.5.0.rbi +0 -3961
  86. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  87. data/sorbet/rbi/gems/nokogiri@1.18.4.rbi +0 -8204
  88. data/sorbet/rbi/gems/parallel@1.25.1.rbi +0 -286
  89. data/sorbet/rbi/gems/parser@3.3.3.0.rbi +0 -7320
  90. data/sorbet/rbi/gems/prism@0.27.0.rbi +0 -36983
  91. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -161
  92. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +0 -736
  93. data/sorbet/rbi/gems/rack@2.2.13.rbi +0 -5633
  94. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +0 -754
  95. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +0 -764
  96. data/sorbet/rbi/gems/railties@7.0.8.7.rbi +0 -3517
  97. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -402
  98. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -3039
  99. data/sorbet/rbi/gems/rbi@0.1.12.rbi +0 -3071
  100. data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +0 -3771
  101. data/sorbet/rbi/gems/rexml@3.3.9.rbi +0 -4857
  102. data/sorbet/rbi/gems/rubocop-ast@1.31.3.rbi +0 -7089
  103. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +0 -2967
  104. data/sorbet/rbi/gems/rubocop-shopify@2.9.0.rbi +0 -8
  105. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +0 -975
  106. data/sorbet/rbi/gems/rubocop@1.64.1.rbi +0 -58089
  107. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1317
  108. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -8
  109. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +0 -474
  110. data/sorbet/rbi/gems/spoom@1.3.2.rbi +0 -4420
  111. data/sorbet/rbi/gems/spring@4.0.0.rbi +0 -411
  112. data/sorbet/rbi/gems/tapioca@0.13.3.rbi +0 -3524
  113. data/sorbet/rbi/gems/thor@1.3.1.rbi +0 -4351
  114. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5917
  115. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +0 -65
  116. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -428
  117. data/sorbet/rbi/gems/yard@0.9.36.rbi +0 -18333
  118. data/sorbet/rbi/gems/zeitwerk@2.6.4.rbi +0 -934
  119. data/sorbet/rbi/shims/minitest/test.rb +0 -8
  120. data/sorbet/rbi/shims/packwerk/reference.rbi +0 -33
  121. data/sorbet/rbi/shims/packwerk/unresolved_reference.rbi +0 -33
  122. data/sorbet/rbi/shims/parser.rbi +0 -13
  123. data/sorbet/rbi/shims/psych.rbi +0 -5
  124. data/sorbet/tapioca/require.rb +0 -25
@@ -1,4857 +0,0 @@
1
- # typed: false
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `rexml` gem.
5
- # Please instead update this file by running `bin/tapioca gem rexml`.
6
-
7
- # This class needs:
8
- # * Documentation
9
- # * Work! Not all types of attlists are intelligently parsed, so we just
10
- # spew back out what we get in. This works, but it would be better if
11
- # we formatted the output ourselves.
12
- #
13
- # AttlistDecls provide *just* enough support to allow namespace
14
- # declarations. If you need some sort of generalized support, or have an
15
- # interesting idea about how to map the hideous, terrible design of DTD
16
- # AttlistDecls onto an intuitive Ruby interface, let me know. I'm desperate
17
- # for anything to make DTDs more palateable.
18
- #
19
- # source://rexml//lib/rexml/attlistdecl.rb#18
20
- class REXML::AttlistDecl < ::REXML::Child
21
- include ::Enumerable
22
-
23
- # Create an AttlistDecl, pulling the information from a Source. Notice
24
- # that this isn't very convenient; to create an AttlistDecl, you basically
25
- # have to format it yourself, and then have the initializer parse it.
26
- # Sorry, but for the foreseeable future, DTD support in REXML is pretty
27
- # weak on convenience. Have I mentioned how much I hate DTDs?
28
- #
29
- # @return [AttlistDecl] a new instance of AttlistDecl
30
- #
31
- # source://rexml//lib/rexml/attlistdecl.rb#29
32
- def initialize(source); end
33
-
34
- # Access the attlist attribute/value pairs.
35
- # value = attlist_decl[ attribute_name ]
36
- #
37
- # source://rexml//lib/rexml/attlistdecl.rb#38
38
- def [](key); end
39
-
40
- # Iterate over the key/value pairs:
41
- # attlist_decl.each { |attribute_name, attribute_value| ... }
42
- #
43
- # source://rexml//lib/rexml/attlistdecl.rb#50
44
- def each(&block); end
45
-
46
- # What is this? Got me.
47
- #
48
- # source://rexml//lib/rexml/attlistdecl.rb#22
49
- def element_name; end
50
-
51
- # Whether an attlist declaration includes the given attribute definition
52
- # if attlist_decl.include? "xmlns:foobar"
53
- #
54
- # @return [Boolean]
55
- #
56
- # source://rexml//lib/rexml/attlistdecl.rb#44
57
- def include?(key); end
58
-
59
- # source://rexml//lib/rexml/attlistdecl.rb#59
60
- def node_type; end
61
-
62
- # Write out exactly what we got in.
63
- #
64
- # source://rexml//lib/rexml/attlistdecl.rb#55
65
- def write(out, indent = T.unsafe(nil)); end
66
- end
67
-
68
- # Defines an Element Attribute; IE, a attribute=value pair, as in:
69
- # <element attribute="value"/>. Attributes can be in their own
70
- # namespaces. General users of REXML will not interact with the
71
- # Attribute class much.
72
- #
73
- # source://rexml//lib/rexml/attribute.rb#10
74
- class REXML::Attribute
75
- include ::REXML::Node
76
- include ::REXML::XMLTokens
77
- include ::REXML::Namespace
78
-
79
- # Constructor.
80
- # FIXME: The parser doesn't catch illegal characters in attributes
81
- #
82
- # first::
83
- # Either: an Attribute, which this new attribute will become a
84
- # clone of; or a String, which is the name of this attribute
85
- # second::
86
- # If +first+ is an Attribute, then this may be an Element, or nil.
87
- # If nil, then the Element parent of this attribute is the parent
88
- # of the +first+ Attribute. If the first argument is a String,
89
- # then this must also be a String, and is the content of the attribute.
90
- # If this is the content, it must be fully normalized (contain no
91
- # illegal characters).
92
- # parent::
93
- # Ignored unless +first+ is a String; otherwise, may be the Element
94
- # parent of this attribute, or nil.
95
- #
96
- #
97
- # Attribute.new( attribute_to_clone )
98
- # Attribute.new( attribute_to_clone, parent_element )
99
- # Attribute.new( "attr", "attr_value" )
100
- # Attribute.new( "attr", "attr_value", parent_element )
101
- #
102
- # @return [Attribute] a new instance of Attribute
103
- #
104
- # source://rexml//lib/rexml/attribute.rb#42
105
- def initialize(first, second = T.unsafe(nil), parent = T.unsafe(nil)); end
106
-
107
- # Returns true if other is an Attribute and has the same name and value,
108
- # false otherwise.
109
- #
110
- # source://rexml//lib/rexml/attribute.rb#106
111
- def ==(other); end
112
-
113
- # Returns a copy of this attribute
114
- #
115
- # source://rexml//lib/rexml/attribute.rb#164
116
- def clone; end
117
-
118
- # source://rexml//lib/rexml/attribute.rb#132
119
- def doctype; end
120
-
121
- # The element to which this attribute belongs
122
- #
123
- # source://rexml//lib/rexml/attribute.rb#15
124
- def element; end
125
-
126
- # Sets the element of which this object is an attribute. Normally, this
127
- # is not directly called.
128
- #
129
- # Returns this attribute
130
- #
131
- # source://rexml//lib/rexml/attribute.rb#172
132
- def element=(element); end
133
-
134
- # Creates (and returns) a hash from both the name and value
135
- #
136
- # source://rexml//lib/rexml/attribute.rb#111
137
- def hash; end
138
-
139
- # source://rexml//lib/rexml/attribute.rb#198
140
- def inspect; end
141
-
142
- # Returns the namespace URL, if defined, or nil otherwise
143
- #
144
- # e = Element.new("el")
145
- # e.add_namespace("ns", "http://url")
146
- # e.add_attribute("ns:a", "b")
147
- # e.add_attribute("nsx:a", "c")
148
- # e.attribute("ns:a").namespace # => "http://url"
149
- # e.attribute("nsx:a").namespace # => nil
150
- #
151
- # This method always returns "" for no namespace attribute. Because
152
- # the default namespace doesn't apply to attribute names.
153
- #
154
- # From https://www.w3.org/TR/xml-names/#uniqAttrs
155
- #
156
- # > the default namespace does not apply to attribute names
157
- #
158
- # e = REXML::Element.new("el")
159
- # e.add_namespace("", "http://example.com/")
160
- # e.namespace # => "http://example.com/"
161
- # e.add_attribute("a", "b")
162
- # e.attribute("a").namespace # => ""
163
- #
164
- # source://rexml//lib/rexml/attribute.rb#95
165
- def namespace(arg = T.unsafe(nil)); end
166
-
167
- # source://rexml//lib/rexml/attribute.rb#194
168
- def node_type; end
169
-
170
- # The normalized value of this attribute. That is, the attribute with
171
- # entities intact.
172
- #
173
- # source://rexml//lib/rexml/attribute.rb#158
174
- def normalized=(new_normalized); end
175
-
176
- # Returns the namespace of the attribute.
177
- #
178
- # e = Element.new( "elns:myelement" )
179
- # e.add_attribute( "nsa:a", "aval" )
180
- # e.add_attribute( "b", "bval" )
181
- # e.attributes.get_attribute( "a" ).prefix # -> "nsa"
182
- # e.attributes.get_attribute( "b" ).prefix # -> ""
183
- # a = Attribute.new( "x", "y" )
184
- # a.prefix # -> ""
185
- #
186
- # source://rexml//lib/rexml/attribute.rb#70
187
- def prefix; end
188
-
189
- # Removes this Attribute from the tree, and returns true if successful
190
- #
191
- # This method is usually not called directly.
192
- #
193
- # source://rexml//lib/rexml/attribute.rb#185
194
- def remove; end
195
-
196
- # Returns the attribute value, with entities replaced
197
- #
198
- # source://rexml//lib/rexml/attribute.rb#140
199
- def to_s; end
200
-
201
- # Returns this attribute out as XML source, expanding the name
202
- #
203
- # a = Attribute.new( "x", "y" )
204
- # a.to_string # -> "x='y'"
205
- # b = Attribute.new( "ns:x", "y" )
206
- # b.to_string # -> "ns:x='y'"
207
- #
208
- # source://rexml//lib/rexml/attribute.rb#121
209
- def to_string; end
210
-
211
- # Returns the UNNORMALIZED value of this attribute. That is, entities
212
- # have been expanded to their values
213
- #
214
- # source://rexml//lib/rexml/attribute.rb#149
215
- def value; end
216
-
217
- # Writes this attribute (EG, puts 'key="value"' to the output)
218
- #
219
- # source://rexml//lib/rexml/attribute.rb#190
220
- def write(output, indent = T.unsafe(nil)); end
221
-
222
- # source://rexml//lib/rexml/attribute.rb#204
223
- def xpath; end
224
- end
225
-
226
- # A class that defines the set of Attributes of an Element and provides
227
- # operations for accessing elements in that set.
228
- #
229
- # source://rexml//lib/rexml/element.rb#2137
230
- class REXML::Attributes < ::Hash
231
- # :call-seq:
232
- # new(element)
233
- #
234
- # Creates and returns a new \REXML::Attributes object.
235
- # The element given by argument +element+ is stored,
236
- # but its own attributes are not modified:
237
- #
238
- # ele = REXML::Element.new('foo')
239
- # attrs = REXML::Attributes.new(ele)
240
- # attrs.object_id == ele.attributes.object_id # => false
241
- #
242
- # Other instance methods in class \REXML::Attributes may refer to:
243
- #
244
- # - +element.document+.
245
- # - +element.prefix+.
246
- # - +element.expanded_name+.
247
- #
248
- # @return [Attributes] a new instance of Attributes
249
- #
250
- # source://rexml//lib/rexml/element.rb#2156
251
- def initialize(element); end
252
-
253
- # :call-seq:
254
- # add(attribute) -> attribute
255
- #
256
- # Adds attribute +attribute+, replacing the previous
257
- # attribute of the same name if it exists;
258
- # returns +attribute+:
259
- #
260
- # xml_string = <<-EOT
261
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
262
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
263
- # </root>
264
- # EOT
265
- # d = REXML::Document.new(xml_string)
266
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
267
- # attrs = ele.attributes
268
- # attrs # => {"att"=>{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='&lt;'}}
269
- # attrs.add(REXML::Attribute.new('foo:att', '2')) # => foo:att='2'
270
- # attrs.add(REXML::Attribute.new('baz', '3')) # => baz='3'
271
- # attrs.include?('baz') # => true
272
- #
273
- # source://rexml//lib/rexml/element.rb#2522
274
- def <<(attribute); end
275
-
276
- # :call-seq:
277
- # [name] -> attribute_value or nil
278
- #
279
- # Returns the value for the attribute given by +name+,
280
- # if it exists; otherwise +nil+.
281
- # The value returned is the unnormalized attribute value,
282
- # with entities expanded:
283
- #
284
- # xml_string = <<-EOT
285
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
286
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
287
- # </root>
288
- # EOT
289
- # d = REXML::Document.new(xml_string)
290
- # ele = d.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
291
- # ele.attributes['att'] # => "<"
292
- # ele.attributes['bar:att'] # => "2"
293
- # ele.attributes['nosuch'] # => nil
294
- #
295
- # Related: get_attribute (returns an \Attribute object).
296
- #
297
- # source://rexml//lib/rexml/element.rb#2181
298
- def [](name); end
299
-
300
- # :call-seq:
301
- # [name] = value -> value
302
- #
303
- # When +value+ is non-+nil+,
304
- # assigns that to the attribute for the given +name+,
305
- # overwriting the previous value if it exists:
306
- #
307
- # xml_string = <<-EOT
308
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
309
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
310
- # </root>
311
- # EOT
312
- # d = REXML::Document.new(xml_string)
313
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
314
- # attrs = ele.attributes
315
- # attrs['foo:att'] = '2' # => "2"
316
- # attrs['baz:att'] = '3' # => "3"
317
- #
318
- # When +value+ is +nil+, deletes the attribute if it exists:
319
- #
320
- # attrs['baz:att'] = nil
321
- # attrs.include?('baz:att') # => false
322
- #
323
- # source://rexml//lib/rexml/element.rb#2365
324
- def []=(name, value); end
325
-
326
- # :call-seq:
327
- # add(attribute) -> attribute
328
- #
329
- # Adds attribute +attribute+, replacing the previous
330
- # attribute of the same name if it exists;
331
- # returns +attribute+:
332
- #
333
- # xml_string = <<-EOT
334
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
335
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
336
- # </root>
337
- # EOT
338
- # d = REXML::Document.new(xml_string)
339
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
340
- # attrs = ele.attributes
341
- # attrs # => {"att"=>{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='&lt;'}}
342
- # attrs.add(REXML::Attribute.new('foo:att', '2')) # => foo:att='2'
343
- # attrs.add(REXML::Attribute.new('baz', '3')) # => baz='3'
344
- # attrs.include?('baz') # => true
345
- #
346
- # source://rexml//lib/rexml/element.rb#2522
347
- def add(attribute); end
348
-
349
- # :call-seq:
350
- # delete(name) -> element
351
- # delete(attribute) -> element
352
- #
353
- # Removes a specified attribute if it exists;
354
- # returns the attributes' element.
355
- #
356
- # When string argument +name+ is given,
357
- # removes the attribute of that name if it exists:
358
- #
359
- # xml_string = <<-EOT
360
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
361
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
362
- # </root>
363
- # EOT
364
- # d = REXML::Document.new(xml_string)
365
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
366
- # attrs = ele.attributes
367
- # attrs.delete('foo:att') # => <ele bar:att='2' att='&lt;'/>
368
- # attrs.delete('foo:att') # => <ele bar:att='2' att='&lt;'/>
369
- #
370
- # When attribute argument +attribute+ is given,
371
- # removes that attribute if it exists:
372
- #
373
- # attr = REXML::Attribute.new('bar:att', '2')
374
- # attrs.delete(attr) # => <ele att='&lt;'/> # => <ele att='&lt;'/>
375
- # attrs.delete(attr) # => <ele att='&lt;'/> # => <ele/>
376
- #
377
- # source://rexml//lib/rexml/element.rb#2475
378
- def delete(attribute); end
379
-
380
- # :call-seq:
381
- # delete_all(name) -> array_of_removed_attributes
382
- #
383
- # Removes all attributes matching the given +name+;
384
- # returns an array of the removed attributes:
385
- #
386
- # xml_string = <<-EOT
387
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
388
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
389
- # </root>
390
- # EOT
391
- # d = REXML::Document.new(xml_string)
392
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
393
- # attrs = ele.attributes
394
- # attrs.delete_all('att') # => [att='&lt;']
395
- #
396
- # source://rexml//lib/rexml/element.rb#2544
397
- def delete_all(name); end
398
-
399
- # :call-seq:
400
- # each {|expanded_name, value| ... }
401
- #
402
- # Calls the given block with each expanded-name/value pair:
403
- #
404
- # xml_string = <<-EOT
405
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
406
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
407
- # </root>
408
- # EOT
409
- # d = REXML::Document.new(xml_string)
410
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
411
- # ele.attributes.each do |expanded_name, value|
412
- # p [expanded_name, value]
413
- # end
414
- #
415
- # Output:
416
- #
417
- # ["foo:att", "1"]
418
- # ["bar:att", "2"]
419
- # ["att", "<"]
420
- #
421
- # source://rexml//lib/rexml/element.rb#2283
422
- def each; end
423
-
424
- # :call-seq:
425
- # each_attribute {|attr| ... }
426
- #
427
- # Calls the given block with each \REXML::Attribute object:
428
- #
429
- # xml_string = <<-EOT
430
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
431
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
432
- # </root>
433
- # EOT
434
- # d = REXML::Document.new(xml_string)
435
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
436
- # ele.attributes.each_attribute do |attr|
437
- # p [attr.class, attr]
438
- # end
439
- #
440
- # Output:
441
- #
442
- # [REXML::Attribute, foo:att='1']
443
- # [REXML::Attribute, bar:att='2']
444
- # [REXML::Attribute, att='&lt;']
445
- #
446
- # source://rexml//lib/rexml/element.rb#2250
447
- def each_attribute; end
448
-
449
- # :call-seq:
450
- # get_attribute(name) -> attribute_object or nil
451
- #
452
- # Returns the \REXML::Attribute object for the given +name+:
453
- #
454
- # xml_string = <<-EOT
455
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
456
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
457
- # </root>
458
- # EOT
459
- # d = REXML::Document.new(xml_string)
460
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
461
- # attrs = ele.attributes
462
- # attrs.get_attribute('foo:att') # => foo:att='1'
463
- # attrs.get_attribute('foo:att').class # => REXML::Attribute
464
- # attrs.get_attribute('bar:att') # => bar:att='2'
465
- # attrs.get_attribute('att') # => att='&lt;'
466
- # attrs.get_attribute('nosuch') # => nil
467
- #
468
- # source://rexml//lib/rexml/element.rb#2309
469
- def get_attribute(name); end
470
-
471
- # :call-seq:
472
- # get_attribute_ns(namespace, name)
473
- #
474
- # Returns the \REXML::Attribute object among the attributes
475
- # that matches the given +namespace+ and +name+:
476
- #
477
- # xml_string = <<-EOT
478
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
479
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
480
- # </root>
481
- # EOT
482
- # d = REXML::Document.new(xml_string)
483
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
484
- # attrs = ele.attributes
485
- # attrs.get_attribute_ns('http://foo', 'att') # => foo:att='1'
486
- # attrs.get_attribute_ns('http://foo', 'nosuch') # => nil
487
- #
488
- # source://rexml//lib/rexml/element.rb#2570
489
- def get_attribute_ns(namespace, name); end
490
-
491
- # :call-seq:
492
- # length
493
- #
494
- # Returns the count of attributes:
495
- #
496
- # xml_string = <<-EOT
497
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
498
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
499
- # </root>
500
- # EOT
501
- # d = REXML::Document.new(xml_string)
502
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
503
- # ele.attributes.length # => 3
504
- #
505
- # source://rexml//lib/rexml/element.rb#2221
506
- def length; end
507
-
508
- # :call-seq:
509
- # namespaces
510
- #
511
- # Returns a hash of name/value pairs for the namespaces:
512
- #
513
- # xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
514
- # d = REXML::Document.new(xml_string)
515
- # d.root.attributes.namespaces # => {"xmlns"=>"foo", "x"=>"bar", "y"=>"twee"}
516
- #
517
- # source://rexml//lib/rexml/element.rb#2431
518
- def namespaces; end
519
-
520
- # :call-seq:
521
- # prefixes -> array_of_prefix_strings
522
- #
523
- # Returns an array of prefix strings in the attributes.
524
- # The array does not include the default
525
- # namespace declaration, if one exists.
526
- #
527
- # xml_string = '<a xmlns="foo" xmlns:x="bar" xmlns:y="twee" z="glorp"/>'
528
- # d = REXML::Document.new(xml_string)
529
- # d.root.attributes.prefixes # => ["x", "y"]
530
- #
531
- # source://rexml//lib/rexml/element.rb#2406
532
- def prefixes; end
533
-
534
- # :call-seq:
535
- # length
536
- #
537
- # Returns the count of attributes:
538
- #
539
- # xml_string = <<-EOT
540
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
541
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
542
- # </root>
543
- # EOT
544
- # d = REXML::Document.new(xml_string)
545
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
546
- # ele.attributes.length # => 3
547
- #
548
- # source://rexml//lib/rexml/element.rb#2221
549
- def size; end
550
-
551
- # :call-seq:
552
- # to_a -> array_of_attribute_objects
553
- #
554
- # Returns an array of \REXML::Attribute objects representing
555
- # the attributes:
556
- #
557
- # xml_string = <<-EOT
558
- # <root xmlns:foo="http://foo" xmlns:bar="http://bar">
559
- # <ele foo:att='1' bar:att='2' att='&lt;'/>
560
- # </root>
561
- # EOT
562
- # d = REXML::Document.new(xml_string)
563
- # ele = d.root.elements['//ele'] # => <a foo:att='1' bar:att='2' att='&lt;'/>
564
- # attrs = ele.attributes.to_a # => [foo:att='1', bar:att='2', att='&lt;']
565
- # attrs.first.class # => REXML::Attribute
566
- #
567
- # source://rexml//lib/rexml/element.rb#2203
568
- def to_a; end
569
- end
570
-
571
- # source://rexml//lib/rexml/cdata.rb#5
572
- class REXML::CData < ::REXML::Text
573
- # Constructor. CData is data between <![CDATA[ ... ]]>
574
- #
575
- # _Examples_
576
- # CData.new( source )
577
- # CData.new( "Here is some CDATA" )
578
- # CData.new( "Some unprocessed data", respect_whitespace_TF, parent_element )
579
- #
580
- # @return [CData] a new instance of CData
581
- #
582
- # source://rexml//lib/rexml/cdata.rb#16
583
- def initialize(first, whitespace = T.unsafe(nil), parent = T.unsafe(nil)); end
584
-
585
- # Make a copy of this object
586
- #
587
- # _Examples_
588
- # c = CData.new( "Some text" )
589
- # d = c.clone
590
- # d.to_s # -> "Some text"
591
- #
592
- # source://rexml//lib/rexml/cdata.rb#26
593
- def clone; end
594
-
595
- # Returns the content of this CData object
596
- #
597
- # _Examples_
598
- # c = CData.new( "Some text" )
599
- # c.to_s # -> "Some text"
600
- #
601
- # source://rexml//lib/rexml/cdata.rb#35
602
- def to_s; end
603
-
604
- # source://rexml//lib/rexml/cdata.rb#39
605
- def value; end
606
-
607
- # == DEPRECATED
608
- # See the rexml/formatters package
609
- #
610
- # Generates XML output of this object
611
- #
612
- # output::
613
- # Where to write the string. Defaults to $stdout
614
- # indent::
615
- # The amount to indent this node by
616
- # transitive::
617
- # Ignored
618
- # ie_hack::
619
- # Ignored
620
- #
621
- # _Examples_
622
- # c = CData.new( " Some text " )
623
- # c.write( $stdout ) #-> <![CDATA[ Some text ]]>
624
- #
625
- # source://rexml//lib/rexml/cdata.rb#60
626
- def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
627
- end
628
-
629
- # A Child object is something contained by a parent, and this class
630
- # contains methods to support that. Most user code will not use this
631
- # class directly.
632
- #
633
- # source://rexml//lib/rexml/child.rb#9
634
- class REXML::Child
635
- include ::REXML::Node
636
-
637
- # Constructor. Any inheritors of this class should call super to make
638
- # sure this method is called.
639
- # parent::
640
- # if supplied, the parent of this child will be set to the
641
- # supplied value, and self will be added to the parent
642
- #
643
- # @return [Child] a new instance of Child
644
- #
645
- # source://rexml//lib/rexml/child.rb#18
646
- def initialize(parent = T.unsafe(nil)); end
647
-
648
- # This doesn't yet handle encodings
649
- #
650
- # source://rexml//lib/rexml/child.rb#91
651
- def bytes; end
652
-
653
- # Returns:: the document this child belongs to, or nil if this child
654
- # belongs to no document
655
- #
656
- # source://rexml//lib/rexml/child.rb#85
657
- def document; end
658
-
659
- # source://rexml//lib/rexml/node.rb#11
660
- def next_sibling; end
661
-
662
- # Sets the next sibling of this child. This can be used to insert a child
663
- # after some other child.
664
- # a = Element.new("a")
665
- # b = a.add_element("b")
666
- # c = Element.new("c")
667
- # b.next_sibling = c
668
- # # => <a><b/><c/></a>
669
- #
670
- # source://rexml//lib/rexml/child.rb#68
671
- def next_sibling=(other); end
672
-
673
- # The Parent of this object
674
- #
675
- # source://rexml//lib/rexml/child.rb#11
676
- def parent; end
677
-
678
- # Sets the parent of this child to the supplied argument.
679
- #
680
- # other::
681
- # Must be a Parent object. If this object is the same object as the
682
- # existing parent of this child, no action is taken. Otherwise, this
683
- # child is removed from the current parent (if one exists), and is added
684
- # to the new parent.
685
- # Returns:: The parent added
686
- #
687
- # source://rexml//lib/rexml/child.rb#52
688
- def parent=(other); end
689
-
690
- # source://rexml//lib/rexml/node.rb#17
691
- def previous_sibling; end
692
-
693
- # Sets the previous sibling of this child. This can be used to insert a
694
- # child before some other child.
695
- # a = Element.new("a")
696
- # b = a.add_element("b")
697
- # c = Element.new("c")
698
- # b.previous_sibling = c
699
- # # => <a><b/><c/></a>
700
- #
701
- # source://rexml//lib/rexml/child.rb#79
702
- def previous_sibling=(other); end
703
-
704
- # Removes this child from the parent.
705
- #
706
- # Returns:: self
707
- #
708
- # source://rexml//lib/rexml/child.rb#37
709
- def remove; end
710
-
711
- # Replaces this object with another object. Basically, calls
712
- # Parent.replace_child
713
- #
714
- # Returns:: self
715
- #
716
- # source://rexml//lib/rexml/child.rb#29
717
- def replace_with(child); end
718
- end
719
-
720
- # Represents an XML comment; that is, text between \<!-- ... -->
721
- #
722
- # source://rexml//lib/rexml/comment.rb#7
723
- class REXML::Comment < ::REXML::Child
724
- include ::Comparable
725
-
726
- # Constructor. The first argument can be one of three types:
727
- # argument. If Comment, the argument is duplicated. If
728
- # Source, the argument is scanned for a comment.
729
- # should be nil, not supplied, or a Parent to be set as the parent
730
- # of this object
731
- #
732
- # @param first If String, the contents of this comment are set to the
733
- # @param second If the first argument is a Source, this argument
734
- # @return [Comment] a new instance of Comment
735
- #
736
- # source://rexml//lib/rexml/comment.rb#24
737
- def initialize(first, second = T.unsafe(nil)); end
738
-
739
- # Compares this Comment to another; the contents of the comment are used
740
- # in the comparison.
741
- #
742
- # source://rexml//lib/rexml/comment.rb#63
743
- def <=>(other); end
744
-
745
- # Compares this Comment to another; the contents of the comment are used
746
- # in the comparison.
747
- #
748
- # source://rexml//lib/rexml/comment.rb#70
749
- def ==(other); end
750
-
751
- # source://rexml//lib/rexml/comment.rb#33
752
- def clone; end
753
-
754
- # source://rexml//lib/rexml/comment.rb#75
755
- def node_type; end
756
-
757
- # The content text
758
- #
759
- # source://rexml//lib/rexml/comment.rb#14
760
- def string; end
761
-
762
- # The content text
763
- #
764
- # source://rexml//lib/rexml/comment.rb#14
765
- def string=(_arg0); end
766
-
767
- # The content text
768
- #
769
- # source://rexml//lib/rexml/comment.rb#14
770
- def to_s; end
771
-
772
- # == DEPRECATED
773
- # See REXML::Formatters
774
- #
775
- # output::
776
- # Where to write the string
777
- # indent::
778
- # An integer. If -1, no indenting will be used; otherwise, the
779
- # indentation will be this number of spaces, and children will be
780
- # indented an additional amount.
781
- # transitive::
782
- # Ignored by this class. The contents of comments are never modified.
783
- # ie_hack::
784
- # Needed for conformity to the child API, but not used by this class.
785
- #
786
- # source://rexml//lib/rexml/comment.rb#50
787
- def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
788
- end
789
-
790
- # source://rexml//lib/rexml/xpath_parser.rb#11
791
- module REXML::DClonable; end
792
-
793
- # This is an abstract class. You never use this directly; it serves as a
794
- # parent class for the specific declarations.
795
- #
796
- # source://rexml//lib/rexml/doctype.rb#242
797
- class REXML::Declaration < ::REXML::Child
798
- # @return [Declaration] a new instance of Declaration
799
- #
800
- # source://rexml//lib/rexml/doctype.rb#243
801
- def initialize(src); end
802
-
803
- # source://rexml//lib/rexml/doctype.rb#248
804
- def to_s; end
805
-
806
- # == DEPRECATED
807
- # See REXML::Formatters
808
- #
809
- # source://rexml//lib/rexml/doctype.rb#255
810
- def write(output, indent); end
811
- end
812
-
813
- # Represents an XML DOCTYPE declaration; that is, the contents of <!DOCTYPE
814
- # ... >. DOCTYPES can be used to declare the DTD of a document, as well as
815
- # being used to declare entities used in the document.
816
- #
817
- # source://rexml//lib/rexml/doctype.rb#51
818
- class REXML::DocType < ::REXML::Parent
819
- include ::REXML::XMLTokens
820
-
821
- # Constructor
822
- #
823
- # dt = DocType.new( 'foo', '-//I/Hate/External/IDs' )
824
- # # <!DOCTYPE foo '-//I/Hate/External/IDs'>
825
- # dt = DocType.new( doctype_to_clone )
826
- # # Incomplete. Shallow clone of doctype
827
- #
828
- # +Note+ that the constructor:
829
- #
830
- # Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
831
- #
832
- # is _deprecated_. Do not use it. It will probably disappear.
833
- #
834
- # @return [DocType] a new instance of DocType
835
- #
836
- # source://rexml//lib/rexml/doctype.rb#80
837
- def initialize(first, parent = T.unsafe(nil)); end
838
-
839
- # source://rexml//lib/rexml/doctype.rb#185
840
- def add(child); end
841
-
842
- # source://rexml//lib/rexml/doctype.rb#125
843
- def attribute_of(element, attribute); end
844
-
845
- # source://rexml//lib/rexml/doctype.rb#115
846
- def attributes_of(element); end
847
-
848
- # source://rexml//lib/rexml/doctype.rb#135
849
- def clone; end
850
-
851
- # source://rexml//lib/rexml/doctype.rb#173
852
- def context; end
853
-
854
- # name is the name of the doctype
855
- # external_id is the referenced DTD, if given
856
- #
857
- # source://rexml//lib/rexml/doctype.rb#66
858
- def entities; end
859
-
860
- # source://rexml//lib/rexml/doctype.rb#181
861
- def entity(name); end
862
-
863
- # name is the name of the doctype
864
- # external_id is the referenced DTD, if given
865
- #
866
- # source://rexml//lib/rexml/doctype.rb#66
867
- def external_id; end
868
-
869
- # name is the name of the doctype
870
- # external_id is the referenced DTD, if given
871
- #
872
- # source://rexml//lib/rexml/doctype.rb#66
873
- def name; end
874
-
875
- # name is the name of the doctype
876
- # external_id is the referenced DTD, if given
877
- #
878
- # source://rexml//lib/rexml/doctype.rb#66
879
- def namespaces; end
880
-
881
- # source://rexml//lib/rexml/doctype.rb#111
882
- def node_type; end
883
-
884
- # Retrieves a named notation. Only notations declared in the internal
885
- # DTD subset can be retrieved.
886
- #
887
- # Method contributed by Henrik Martensson
888
- #
889
- # source://rexml//lib/rexml/doctype.rb#229
890
- def notation(name); end
891
-
892
- # This method returns a list of notations that have been declared in the
893
- # _internal_ DTD subset. Notations in the external DTD subset are not
894
- # listed.
895
- #
896
- # Method contributed by Henrik Martensson
897
- #
898
- # source://rexml//lib/rexml/doctype.rb#221
899
- def notations; end
900
-
901
- # This method retrieves the public identifier identifying the document's
902
- # DTD.
903
- #
904
- # Method contributed by Henrik Martensson
905
- #
906
- # source://rexml//lib/rexml/doctype.rb#195
907
- def public; end
908
-
909
- # This method retrieves the system identifier identifying the document's DTD
910
- #
911
- # Method contributed by Henrik Martensson
912
- #
913
- # source://rexml//lib/rexml/doctype.rb#207
914
- def system; end
915
-
916
- # output::
917
- # Where to write the string
918
- # indent::
919
- # An integer. If -1, no indentation will be used; otherwise, the
920
- # indentation will be this number of spaces, and children will be
921
- # indented an additional amount.
922
- # transitive::
923
- # Ignored
924
- # ie_hack::
925
- # Ignored
926
- #
927
- # source://rexml//lib/rexml/doctype.rb#149
928
- def write(output, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
929
- end
930
-
931
- # Represents an XML document.
932
- #
933
- # A document may have:
934
- #
935
- # - A single child that may be accessed via method #root.
936
- # - An XML declaration.
937
- # - A document type.
938
- # - Processing instructions.
939
- #
940
- # == In a Hurry?
941
- #
942
- # If you're somewhat familiar with XML
943
- # and have a particular task in mind,
944
- # you may want to see the
945
- # {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
946
- # and in particular, the
947
- # {tasks page for documents}[../doc/rexml/tasks/tocs/document_toc_rdoc.html].
948
- #
949
- # source://rexml//lib/rexml/document.rb#35
950
- class REXML::Document < ::REXML::Element
951
- # :call-seq:
952
- # new(string = nil, context = {}) -> new_document
953
- # new(io_stream = nil, context = {}) -> new_document
954
- # new(document = nil, context = {}) -> new_document
955
- #
956
- # Returns a new \REXML::Document object.
957
- #
958
- # When no arguments are given,
959
- # returns an empty document:
960
- #
961
- # d = REXML::Document.new
962
- # d.to_s # => ""
963
- #
964
- # When argument +string+ is given, it must be a string
965
- # containing a valid XML document:
966
- #
967
- # xml_string = '<root><foo>Foo</foo><bar>Bar</bar></root>'
968
- # d = REXML::Document.new(xml_string)
969
- # d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
970
- #
971
- # When argument +io_stream+ is given, it must be an \IO object
972
- # that is opened for reading, and when read must return a valid XML document:
973
- #
974
- # File.write('t.xml', xml_string)
975
- # d = File.open('t.xml', 'r') do |io|
976
- # REXML::Document.new(io)
977
- # end
978
- # d.to_s # => "<root><foo>Foo</foo><bar>Bar</bar></root>"
979
- #
980
- # When argument +document+ is given, it must be an existing
981
- # document object, whose context and attributes (but not children)
982
- # are cloned into the new document:
983
- #
984
- # d = REXML::Document.new(xml_string)
985
- # d.children # => [<root> ... </>]
986
- # d.context = {raw: :all, compress_whitespace: :all}
987
- # d.add_attributes({'bar' => 0, 'baz' => 1})
988
- # d1 = REXML::Document.new(d)
989
- # d1.children # => []
990
- # d1.context # => {:raw=>:all, :compress_whitespace=>:all}
991
- # d1.attributes # => {"bar"=>bar='0', "baz"=>baz='1'}
992
- #
993
- # When argument +context+ is given, it must be a hash
994
- # containing context entries for the document;
995
- # see {Element Context}[../doc/rexml/context_rdoc.html]:
996
- #
997
- # context = {raw: :all, compress_whitespace: :all}
998
- # d = REXML::Document.new(xml_string, context)
999
- # d.context # => {:raw=>:all, :compress_whitespace=>:all}
1000
- #
1001
- # @return [Document] a new instance of Document
1002
- #
1003
- # source://rexml//lib/rexml/document.rb#92
1004
- def initialize(source = T.unsafe(nil), context = T.unsafe(nil)); end
1005
-
1006
- # :call-seq:
1007
- # add(xml_decl) -> self
1008
- # add(doc_type) -> self
1009
- # add(object) -> self
1010
- #
1011
- # Adds an object to the document; returns +self+.
1012
- #
1013
- # When argument +xml_decl+ is given,
1014
- # it must be an REXML::XMLDecl object,
1015
- # which becomes the XML declaration for the document,
1016
- # replacing the previous XML declaration if any:
1017
- #
1018
- # d = REXML::Document.new
1019
- # d.xml_decl.to_s # => ""
1020
- # d.add(REXML::XMLDecl.new('2.0'))
1021
- # d.xml_decl.to_s # => "<?xml version='2.0'?>"
1022
- #
1023
- # When argument +doc_type+ is given,
1024
- # it must be an REXML::DocType object,
1025
- # which becomes the document type for the document,
1026
- # replacing the previous document type, if any:
1027
- #
1028
- # d = REXML::Document.new
1029
- # d.doctype.to_s # => ""
1030
- # d.add(REXML::DocType.new('foo'))
1031
- # d.doctype.to_s # => "<!DOCTYPE foo>"
1032
- #
1033
- # When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
1034
- # is given it is added as the last child:
1035
- #
1036
- # d = REXML::Document.new
1037
- # d.add(REXML::Element.new('foo'))
1038
- # d.to_s # => "<foo/>"
1039
- #
1040
- # source://rexml//lib/rexml/document.rb#172
1041
- def <<(child); end
1042
-
1043
- # :call-seq:
1044
- # add(xml_decl) -> self
1045
- # add(doc_type) -> self
1046
- # add(object) -> self
1047
- #
1048
- # Adds an object to the document; returns +self+.
1049
- #
1050
- # When argument +xml_decl+ is given,
1051
- # it must be an REXML::XMLDecl object,
1052
- # which becomes the XML declaration for the document,
1053
- # replacing the previous XML declaration if any:
1054
- #
1055
- # d = REXML::Document.new
1056
- # d.xml_decl.to_s # => ""
1057
- # d.add(REXML::XMLDecl.new('2.0'))
1058
- # d.xml_decl.to_s # => "<?xml version='2.0'?>"
1059
- #
1060
- # When argument +doc_type+ is given,
1061
- # it must be an REXML::DocType object,
1062
- # which becomes the document type for the document,
1063
- # replacing the previous document type, if any:
1064
- #
1065
- # d = REXML::Document.new
1066
- # d.doctype.to_s # => ""
1067
- # d.add(REXML::DocType.new('foo'))
1068
- # d.doctype.to_s # => "<!DOCTYPE foo>"
1069
- #
1070
- # When argument +object+ (not an REXML::XMLDecl or REXML::DocType object)
1071
- # is given it is added as the last child:
1072
- #
1073
- # d = REXML::Document.new
1074
- # d.add(REXML::Element.new('foo'))
1075
- # d.to_s # => "<foo/>"
1076
- #
1077
- # source://rexml//lib/rexml/document.rb#172
1078
- def add(child); end
1079
-
1080
- # :call-seq:
1081
- # add_element(name_or_element = nil, attributes = nil) -> new_element
1082
- #
1083
- # Adds an element to the document by calling REXML::Element.add_element:
1084
- #
1085
- # REXML::Element.add_element(name_or_element, attributes)
1086
- #
1087
- # source://rexml//lib/rexml/document.rb#211
1088
- def add_element(arg = T.unsafe(nil), arg2 = T.unsafe(nil)); end
1089
-
1090
- # :call-seq:
1091
- # clone -> new_document
1092
- #
1093
- # Returns the new document resulting from executing
1094
- # <tt>Document.new(self)</tt>. See Document.new.
1095
- #
1096
- # source://rexml//lib/rexml/document.rb#122
1097
- def clone; end
1098
-
1099
- # :call-seq:
1100
- # doctype -> doc_type or nil
1101
- #
1102
- # Returns the DocType object for the document, if it exists, otherwise +nil+:
1103
- #
1104
- # d = REXML::Document.new('<!DOCTYPE document SYSTEM "subjects.dtd">')
1105
- # d.doctype.class # => REXML::DocType
1106
- # d = REXML::Document.new('')
1107
- # d.doctype.class # => nil
1108
- #
1109
- # source://rexml//lib/rexml/document.rb#243
1110
- def doctype; end
1111
-
1112
- # source://rexml//lib/rexml/document.rb#446
1113
- def document; end
1114
-
1115
- # :call-seq:
1116
- # encoding -> encoding_string
1117
- #
1118
- # Returns the XMLDecl encoding of the document,
1119
- #
1120
- # d = REXML::Document.new('<?xml version="1.0" encoding="UTF-16"?>')
1121
- # d.encoding # => "UTF-16"
1122
- # d = REXML::Document.new('')
1123
- # d.encoding # => "UTF-8"
1124
- #
1125
- # source://rexml//lib/rexml/document.rb#292
1126
- def encoding; end
1127
-
1128
- # Returns the value of attribute entity_expansion_count.
1129
- #
1130
- # source://rexml//lib/rexml/document.rb#435
1131
- def entity_expansion_count; end
1132
-
1133
- # Sets the attribute entity_expansion_limit
1134
- #
1135
- # @param value the value to set the attribute entity_expansion_limit to.
1136
- #
1137
- # source://rexml//lib/rexml/document.rb#436
1138
- def entity_expansion_limit=(_arg0); end
1139
-
1140
- # Returns the value of attribute entity_expansion_text_limit.
1141
- #
1142
- # source://rexml//lib/rexml/document.rb#437
1143
- def entity_expansion_text_limit; end
1144
-
1145
- # Sets the attribute entity_expansion_text_limit
1146
- #
1147
- # @param value the value to set the attribute entity_expansion_text_limit to.
1148
- #
1149
- # source://rexml//lib/rexml/document.rb#437
1150
- def entity_expansion_text_limit=(_arg0); end
1151
-
1152
- # :call-seq:
1153
- # expanded_name -> empty_string
1154
- #
1155
- # Returns an empty string.
1156
- #
1157
- # source://rexml//lib/rexml/document.rb#131
1158
- def expanded_name; end
1159
-
1160
- # :call-seq:
1161
- # expanded_name -> empty_string
1162
- #
1163
- # Returns an empty string.
1164
- # d = doc_type
1165
- # d ? d.name : "UNDEFINED"
1166
- #
1167
- # source://rexml//lib/rexml/document.rb#131
1168
- def name; end
1169
-
1170
- # :call-seq:
1171
- # node_type -> :document
1172
- #
1173
- # Returns the symbol +:document+.
1174
- #
1175
- # source://rexml//lib/rexml/document.rb#112
1176
- def node_type; end
1177
-
1178
- # source://rexml//lib/rexml/document.rb#439
1179
- def record_entity_expansion; end
1180
-
1181
- # :call-seq:
1182
- # root -> root_element or nil
1183
- #
1184
- # Returns the root element of the document, if it exists, otherwise +nil+:
1185
- #
1186
- # d = REXML::Document.new('<root></root>')
1187
- # d.root # => <root/>
1188
- # d = REXML::Document.new('')
1189
- # d.root # => nil
1190
- #
1191
- # source://rexml//lib/rexml/document.rb#227
1192
- def root; end
1193
-
1194
- # :call-seq:
1195
- # stand_alone?
1196
- #
1197
- # Returns the XMLDecl standalone value of the document as a string,
1198
- # if it has been set, otherwise the default standalone value:
1199
- #
1200
- # d = REXML::Document.new('<?xml standalone="yes"?>')
1201
- # d.stand_alone? # => "yes"
1202
- # d = REXML::Document.new('')
1203
- # d.stand_alone? # => nil
1204
- #
1205
- # @return [Boolean]
1206
- #
1207
- # source://rexml//lib/rexml/document.rb#307
1208
- def stand_alone?; end
1209
-
1210
- # :call-seq:
1211
- # version -> version_string
1212
- #
1213
- # Returns the XMLDecl version of this document as a string,
1214
- # if it has been set, otherwise the default version:
1215
- #
1216
- # d = REXML::Document.new('<?xml version="2.0" encoding="UTF-8"?>')
1217
- # d.version # => "2.0"
1218
- # d = REXML::Document.new('')
1219
- # d.version # => "1.0"
1220
- #
1221
- # source://rexml//lib/rexml/document.rb#277
1222
- def version; end
1223
-
1224
- # :call-seq:
1225
- # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
1226
- # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
1227
- #
1228
- # Write the XML tree out, optionally with indent. This writes out the
1229
- # entire XML document, including XML declarations, doctype declarations,
1230
- # and processing instructions (if any are given).
1231
- #
1232
- # A controversial point is whether Document should always write the XML
1233
- # declaration (<?xml version='1.0'?>) whether or not one is given by the
1234
- # user (or source document). REXML does not write one if one was not
1235
- # specified, because it adds unnecessary bandwidth to applications such
1236
- # as XML-RPC.
1237
- #
1238
- # Accept Nth argument style and options Hash style as argument.
1239
- # The recommended style is options Hash style for one or more
1240
- # arguments case.
1241
- #
1242
- # _Examples_
1243
- # Document.new("<a><b/></a>").write
1244
- #
1245
- # output = ""
1246
- # Document.new("<a><b/></a>").write(output)
1247
- #
1248
- # output = ""
1249
- # Document.new("<a><b/></a>").write(:output => output, :indent => 2)
1250
- #
1251
- # See also the classes in the rexml/formatters package for the proper way
1252
- # to change the default formatting of XML output.
1253
- #
1254
- # _Examples_
1255
- #
1256
- # output = ""
1257
- # tr = Transitive.new
1258
- # tr.write(Document.new("<a><b/></a>"), output)
1259
- #
1260
- # output::
1261
- # output an object which supports '<< string'; this is where the
1262
- # document will be written.
1263
- # indent::
1264
- # An integer. If -1, no indenting will be used; otherwise, the
1265
- # indentation will be twice this number of spaces, and children will be
1266
- # indented an additional amount. For a value of 3, every item will be
1267
- # indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1
1268
- # transitive::
1269
- # If transitive is true and indent is >= 0, then the output will be
1270
- # pretty-printed in such a way that the added whitespace does not affect
1271
- # the absolute *value* of the document -- that is, it leaves the value
1272
- # and number of Text nodes in the document unchanged.
1273
- # ie_hack::
1274
- # This hack inserts a space before the /> on empty tags to address
1275
- # a limitation of Internet Explorer. Defaults to false
1276
- # Encoding name as String. Change output encoding to specified encoding
1277
- # instead of encoding in XML declaration.
1278
- # Defaults to nil. It means encoding in XML declaration is used.
1279
- #
1280
- # source://rexml//lib/rexml/document.rb#367
1281
- def write(*arguments); end
1282
-
1283
- # :call-seq:
1284
- # xml_decl -> xml_decl
1285
- #
1286
- # Returns the XMLDecl object for the document, if it exists,
1287
- # otherwise the default XMLDecl object:
1288
- #
1289
- # d = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>')
1290
- # d.xml_decl.class # => REXML::XMLDecl
1291
- # d.xml_decl.to_s # => "<?xml version='1.0' encoding='UTF-8'?>"
1292
- # d = REXML::Document.new('')
1293
- # d.xml_decl.class # => REXML::XMLDecl
1294
- # d.xml_decl.to_s # => ""
1295
- #
1296
- # source://rexml//lib/rexml/document.rb#260
1297
- def xml_decl; end
1298
-
1299
- private
1300
-
1301
- # source://rexml//lib/rexml/document.rb#451
1302
- def build(source); end
1303
-
1304
- class << self
1305
- # Get the entity expansion limit. By default the limit is set to 10000.
1306
- #
1307
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1308
- #
1309
- # source://rexml//lib/rexml/document.rb#417
1310
- def entity_expansion_limit; end
1311
-
1312
- # Set the entity expansion limit. By default the limit is set to 10000.
1313
- #
1314
- # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1315
- #
1316
- # source://rexml//lib/rexml/document.rb#410
1317
- def entity_expansion_limit=(val); end
1318
-
1319
- # Get the entity expansion limit. By default the limit is set to 10240.
1320
- #
1321
- # Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
1322
- #
1323
- # source://rexml//lib/rexml/document.rb#431
1324
- def entity_expansion_text_limit; end
1325
-
1326
- # Set the entity expansion limit. By default the limit is set to 10240.
1327
- #
1328
- # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
1329
- #
1330
- # source://rexml//lib/rexml/document.rb#424
1331
- def entity_expansion_text_limit=(val); end
1332
-
1333
- # source://rexml//lib/rexml/document.rb#403
1334
- def parse_stream(source, listener); end
1335
- end
1336
- end
1337
-
1338
- # An \REXML::Element object represents an XML element.
1339
- #
1340
- # An element:
1341
- #
1342
- # - Has a name (string).
1343
- # - May have a parent (another element).
1344
- # - Has zero or more children
1345
- # (other elements, text, CDATA, processing instructions, and comments).
1346
- # - Has zero or more siblings
1347
- # (other elements, text, CDATA, processing instructions, and comments).
1348
- # - Has zero or more named attributes.
1349
- #
1350
- # == In a Hurry?
1351
- #
1352
- # If you're somewhat familiar with XML
1353
- # and have a particular task in mind,
1354
- # you may want to see the
1355
- # {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
1356
- # and in particular, the
1357
- # {tasks page for elements}[../doc/rexml/tasks/tocs/element_toc_rdoc.html].
1358
- #
1359
- # === Name
1360
- #
1361
- # An element has a name, which is initially set when the element is created:
1362
- #
1363
- # e = REXML::Element.new('foo')
1364
- # e.name # => "foo"
1365
- #
1366
- # The name may be changed:
1367
- #
1368
- # e.name = 'bar'
1369
- # e.name # => "bar"
1370
- #
1371
- #
1372
- # === \Parent
1373
- #
1374
- # An element may have a parent.
1375
- #
1376
- # Its parent may be assigned explicitly when the element is created:
1377
- #
1378
- # e0 = REXML::Element.new('foo')
1379
- # e1 = REXML::Element.new('bar', e0)
1380
- # e1.parent # => <foo> ... </>
1381
- #
1382
- # Note: the representation of an element always shows the element's name.
1383
- # If the element has children, the representation indicates that
1384
- # by including an ellipsis (<tt>...</tt>).
1385
- #
1386
- # The parent may be assigned explicitly at any time:
1387
- #
1388
- # e2 = REXML::Element.new('baz')
1389
- # e1.parent = e2
1390
- # e1.parent # => <baz/>
1391
- #
1392
- # When an element is added as a child, its parent is set automatically:
1393
- #
1394
- # e1.add_element(e0)
1395
- # e0.parent # => <bar> ... </>
1396
- #
1397
- # For an element that has no parent, method +parent+ returns +nil+.
1398
- #
1399
- # === Children
1400
- #
1401
- # An element has zero or more children.
1402
- # The children are an ordered collection
1403
- # of all objects whose parent is the element itself.
1404
- #
1405
- # The children may include any combination of elements, text, comments,
1406
- # processing instructions, and CDATA.
1407
- # (This example keeps things clean by controlling whitespace
1408
- # via a +context+ setting.)
1409
- #
1410
- # xml_string = <<-EOT
1411
- # <root>
1412
- # <ele_0/>
1413
- # text 0
1414
- # <!--comment 0-->
1415
- # <?target_0 pi_0?>
1416
- # <![CDATA[cdata 0]]>
1417
- # <ele_1/>
1418
- # text 1
1419
- # <!--comment 1-->
1420
- # <?target_0 pi_1?>
1421
- # <![CDATA[cdata 1]]>
1422
- # </root>
1423
- # EOT
1424
- # context = {ignore_whitespace_nodes: :all, compress_whitespace: :all}
1425
- # d = REXML::Document.new(xml_string, context)
1426
- # root = d.root
1427
- # root.children.size # => 10
1428
- # root.each {|child| p "#{child.class}: #{child}" }
1429
- #
1430
- # Output:
1431
- #
1432
- # "REXML::Element: <ele_0/>"
1433
- # "REXML::Text: \n text 0\n "
1434
- # "REXML::Comment: comment 0"
1435
- # "REXML::Instruction: <?target_0 pi_0?>"
1436
- # "REXML::CData: cdata 0"
1437
- # "REXML::Element: <ele_1/>"
1438
- # "REXML::Text: \n text 1\n "
1439
- # "REXML::Comment: comment 1"
1440
- # "REXML::Instruction: <?target_0 pi_1?>"
1441
- # "REXML::CData: cdata 1"
1442
- #
1443
- # A child may be added using inherited methods
1444
- # Parent#insert_before or Parent#insert_after:
1445
- #
1446
- # xml_string = '<root><a/><c/><d/></root>'
1447
- # d = REXML::Document.new(xml_string)
1448
- # root = d.root
1449
- # c = d.root[1] # => <c/>
1450
- # root.insert_before(c, REXML::Element.new('b'))
1451
- # root.to_a # => [<a/>, <b/>, <c/>, <d/>]
1452
- #
1453
- # A child may be replaced using Parent#replace_child:
1454
- #
1455
- # root.replace_child(c, REXML::Element.new('x'))
1456
- # root.to_a # => [<a/>, <b/>, <x/>, <d/>]
1457
- #
1458
- # A child may be removed using Parent#delete:
1459
- #
1460
- # x = root[2] # => <x/>
1461
- # root.delete(x)
1462
- # root.to_a # => [<a/>, <b/>, <d/>]
1463
- #
1464
- # === Siblings
1465
- #
1466
- # An element has zero or more siblings,
1467
- # which are the other children of the element's parent.
1468
- #
1469
- # In the example above, element +ele_1+ is between a CDATA sibling
1470
- # and a text sibling:
1471
- #
1472
- # ele_1 = root[5] # => <ele_1/>
1473
- # ele_1.previous_sibling # => "cdata 0"
1474
- # ele_1.next_sibling # => "\n text 1\n "
1475
- #
1476
- # === \Attributes
1477
- #
1478
- # An element has zero or more named attributes.
1479
- #
1480
- # A new element has no attributes:
1481
- #
1482
- # e = REXML::Element.new('foo')
1483
- # e.attributes # => {}
1484
- #
1485
- # Attributes may be added:
1486
- #
1487
- # e.add_attribute('bar', 'baz')
1488
- # e.add_attribute('bat', 'bam')
1489
- # e.attributes.size # => 2
1490
- # e['bar'] # => "baz"
1491
- # e['bat'] # => "bam"
1492
- #
1493
- # An existing attribute may be modified:
1494
- #
1495
- # e.add_attribute('bar', 'bad')
1496
- # e.attributes.size # => 2
1497
- # e['bar'] # => "bad"
1498
- #
1499
- # An existing attribute may be deleted:
1500
- #
1501
- # e.delete_attribute('bar')
1502
- # e.attributes.size # => 1
1503
- # e['bar'] # => nil
1504
- #
1505
- # == What's Here
1506
- #
1507
- # To begin with, what's elsewhere?
1508
- #
1509
- # \Class \REXML::Element inherits from its ancestor classes:
1510
- #
1511
- # - REXML::Child
1512
- # - REXML::Parent
1513
- #
1514
- # \REXML::Element itself and its ancestors also include modules:
1515
- #
1516
- # - {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html]
1517
- # - REXML::Namespace
1518
- # - REXML::Node
1519
- # - REXML::XMLTokens
1520
- #
1521
- # === Methods for Creating an \Element
1522
- #
1523
- # ::new:: Returns a new empty element.
1524
- # #clone:: Returns a clone of another element.
1525
- #
1526
- # === Methods for Attributes
1527
- #
1528
- # {[attribute_name]}[#method-i-5B-5D]:: Returns an attribute value.
1529
- # #add_attribute:: Adds a new attribute.
1530
- # #add_attributes:: Adds multiple new attributes.
1531
- # #attribute:: Returns the attribute value for a given name and optional namespace.
1532
- # #delete_attribute:: Removes an attribute.
1533
- #
1534
- # === Methods for Children
1535
- #
1536
- # {[index]}[#method-i-5B-5D]:: Returns the child at the given offset.
1537
- # #add_element:: Adds an element as the last child.
1538
- # #delete_element:: Deletes a child element.
1539
- # #each_element:: Calls the given block with each child element.
1540
- # #each_element_with_attribute:: Calls the given block with each child element
1541
- # that meets given criteria,
1542
- # which can include the attribute name.
1543
- # #each_element_with_text:: Calls the given block with each child element
1544
- # that meets given criteria,
1545
- # which can include text.
1546
- # #get_elements:: Returns an array of element children that match a given xpath.
1547
- #
1548
- # === Methods for \Text Children
1549
- #
1550
- # #add_text:: Adds a text node to the element.
1551
- # #get_text:: Returns a text node that meets specified criteria.
1552
- # #text:: Returns the text string from the first node that meets specified criteria.
1553
- # #texts:: Returns an array of the text children of the element.
1554
- # #text=:: Adds, removes, or replaces the first text child of the element
1555
- #
1556
- # === Methods for Other Children
1557
- #
1558
- # #cdatas:: Returns an array of the cdata children of the element.
1559
- # #comments:: Returns an array of the comment children of the element.
1560
- # #instructions:: Returns an array of the instruction children of the element.
1561
- #
1562
- # === Methods for Namespaces
1563
- #
1564
- # #add_namespace:: Adds a namespace to the element.
1565
- # #delete_namespace:: Removes a namespace from the element.
1566
- # #namespace:: Returns the string namespace URI for the element.
1567
- # #namespaces:: Returns a hash of all defined namespaces in the element.
1568
- # #prefixes:: Returns an array of the string prefixes (names)
1569
- # of all defined namespaces in the element
1570
- #
1571
- # === Methods for Querying
1572
- #
1573
- # #document:: Returns the document, if any, that the element belongs to.
1574
- # #root:: Returns the most distant element (not document) ancestor of the element.
1575
- # #root_node:: Returns the most distant ancestor of the element.
1576
- # #xpath:: Returns the string xpath to the element
1577
- # relative to the most distant parent
1578
- # #has_attributes?:: Returns whether the element has attributes.
1579
- # #has_elements?:: Returns whether the element has elements.
1580
- # #has_text?:: Returns whether the element has text.
1581
- # #next_element:: Returns the next sibling that is an element.
1582
- # #previous_element:: Returns the previous sibling that is an element.
1583
- # #raw:: Returns whether raw mode is set for the element.
1584
- # #whitespace:: Returns whether whitespace is respected for the element.
1585
- # #ignore_whitespace_nodes:: Returns whether whitespace nodes
1586
- # are to be ignored for the element.
1587
- # #node_type:: Returns symbol <tt>:element</tt>.
1588
- #
1589
- # === One More Method
1590
- #
1591
- # #inspect:: Returns a string representation of the element.
1592
- #
1593
- # === Accessors
1594
- #
1595
- # #elements:: Returns the REXML::Elements object for the element.
1596
- # #attributes:: Returns the REXML::Attributes object for the element.
1597
- # #context:: Returns or sets the context hash for the element.
1598
- #
1599
- # source://rexml//lib/rexml/element.rb#271
1600
- class REXML::Element < ::REXML::Parent
1601
- include ::REXML::XMLTokens
1602
- include ::REXML::Namespace
1603
-
1604
- # :call-seq:
1605
- # Element.new(name = 'UNDEFINED', parent = nil, context = nil) -> new_element
1606
- # Element.new(element, parent = nil, context = nil) -> new_element
1607
- #
1608
- # Returns a new \REXML::Element object.
1609
- #
1610
- # When no arguments are given,
1611
- # returns an element with name <tt>'UNDEFINED'</tt>:
1612
- #
1613
- # e = REXML::Element.new # => <UNDEFINED/>
1614
- # e.class # => REXML::Element
1615
- # e.name # => "UNDEFINED"
1616
- #
1617
- # When only argument +name+ is given,
1618
- # returns an element of the given name:
1619
- #
1620
- # REXML::Element.new('foo') # => <foo/>
1621
- #
1622
- # When only argument +element+ is given, it must be an \REXML::Element object;
1623
- # returns a shallow copy of the given element:
1624
- #
1625
- # e0 = REXML::Element.new('foo')
1626
- # e1 = REXML::Element.new(e0) # => <foo/>
1627
- #
1628
- # When argument +parent+ is also given, it must be an REXML::Parent object:
1629
- #
1630
- # e = REXML::Element.new('foo', REXML::Parent.new)
1631
- # e.parent # => #<REXML::Parent @parent=nil, @children=[<foo/>]>
1632
- #
1633
- # When argument +context+ is also given, it must be a hash
1634
- # representing the context for the element;
1635
- # see {Element Context}[../doc/rexml/context_rdoc.html]:
1636
- #
1637
- # e = REXML::Element.new('foo', nil, {raw: :all})
1638
- # e.context # => {:raw=>:all}
1639
- #
1640
- # @return [Element] a new instance of Element
1641
- #
1642
- # source://rexml//lib/rexml/element.rb#319
1643
- def initialize(arg = T.unsafe(nil), parent = T.unsafe(nil), context = T.unsafe(nil)); end
1644
-
1645
- # :call-seq:
1646
- # [index] -> object
1647
- # [attr_name] -> attr_value
1648
- # [attr_sym] -> attr_value
1649
- #
1650
- # With integer argument +index+ given,
1651
- # returns the child at offset +index+, or +nil+ if none:
1652
- #
1653
- # d = REXML::Document.new '><root><a/>text<b/>more<c/></root>'
1654
- # root = d.root
1655
- # (0..root.size).each do |index|
1656
- # node = root[index]
1657
- # p "#{index}: #{node} (#{node.class})"
1658
- # end
1659
- #
1660
- # Output:
1661
- #
1662
- # "0: <a/> (REXML::Element)"
1663
- # "1: text (REXML::Text)"
1664
- # "2: <b/> (REXML::Element)"
1665
- # "3: more (REXML::Text)"
1666
- # "4: <c/> (REXML::Element)"
1667
- # "5: (NilClass)"
1668
- #
1669
- # With string argument +attr_name+ given,
1670
- # returns the string value for the given attribute name if it exists,
1671
- # otherwise +nil+:
1672
- #
1673
- # d = REXML::Document.new('<root attr="value"></root>')
1674
- # root = d.root
1675
- # root['attr'] # => "value"
1676
- # root['nosuch'] # => nil
1677
- #
1678
- # With symbol argument +attr_sym+ given,
1679
- # returns <tt>[attr_sym.to_s]</tt>:
1680
- #
1681
- # root[:attr] # => "value"
1682
- # root[:nosuch] # => nil
1683
- #
1684
- # source://rexml//lib/rexml/element.rb#1246
1685
- def [](name_or_index); end
1686
-
1687
- # :call-seq:
1688
- # add_attribute(name, value) -> value
1689
- # add_attribute(attribute) -> attribute
1690
- #
1691
- # Adds an attribute to this element, overwriting any existing attribute
1692
- # by the same name.
1693
- #
1694
- # With string argument +name+ and object +value+ are given,
1695
- # adds the attribute created with that name and value:
1696
- #
1697
- # e = REXML::Element.new
1698
- # e.add_attribute('attr', 'value') # => "value"
1699
- # e['attr'] # => "value"
1700
- # e.add_attribute('attr', 'VALUE') # => "VALUE"
1701
- # e['attr'] # => "VALUE"
1702
- #
1703
- # With only attribute object +attribute+ given,
1704
- # adds the given attribute:
1705
- #
1706
- # a = REXML::Attribute.new('attr', 'value')
1707
- # e.add_attribute(a) # => attr='value'
1708
- # e['attr'] # => "value"
1709
- # a = REXML::Attribute.new('attr', 'VALUE')
1710
- # e.add_attribute(a) # => attr='VALUE'
1711
- # e['attr'] # => "VALUE"
1712
- #
1713
- # source://rexml//lib/rexml/element.rb#1345
1714
- def add_attribute(key, value = T.unsafe(nil)); end
1715
-
1716
- # :call-seq:
1717
- # add_attributes(hash) -> hash
1718
- # add_attributes(array)
1719
- #
1720
- # Adds zero or more attributes to the element;
1721
- # returns the argument.
1722
- #
1723
- # If hash argument +hash+ is given,
1724
- # each key must be a string;
1725
- # adds each attribute created with the key/value pair:
1726
- #
1727
- # e = REXML::Element.new
1728
- # h = {'foo' => 'bar', 'baz' => 'bat'}
1729
- # e.add_attributes(h)
1730
- #
1731
- # If argument +array+ is given,
1732
- # each array member must be a 2-element array <tt>[name, value];
1733
- # each name must be a string:
1734
- #
1735
- # e = REXML::Element.new
1736
- # a = [['foo' => 'bar'], ['baz' => 'bat']]
1737
- # e.add_attributes(a)
1738
- #
1739
- # source://rexml//lib/rexml/element.rb#1376
1740
- def add_attributes(hash); end
1741
-
1742
- # :call-seq:
1743
- # add_element(name, attributes = nil) -> new_element
1744
- # add_element(element, attributes = nil) -> element
1745
- #
1746
- # Adds a child element, optionally setting attributes
1747
- # on the added element; returns the added element.
1748
- #
1749
- # With string argument +name+, creates a new element with that name
1750
- # and adds the new element as a child:
1751
- #
1752
- # e0 = REXML::Element.new('foo')
1753
- # e0.add_element('bar')
1754
- # e0[0] # => <bar/>
1755
- #
1756
- #
1757
- # With argument +name+ and hash argument +attributes+,
1758
- # sets attributes on the new element:
1759
- #
1760
- # e0.add_element('baz', {'bat' => '0', 'bam' => '1'})
1761
- # e0[1] # => <baz bat='0' bam='1'/>
1762
- #
1763
- # With element argument +element+, adds that element as a child:
1764
- #
1765
- # e0 = REXML::Element.new('foo')
1766
- # e1 = REXML::Element.new('bar')
1767
- # e0.add_element(e1)
1768
- # e0[0] # => <bar/>
1769
- #
1770
- # With argument +element+ and hash argument +attributes+,
1771
- # sets attributes on the added element:
1772
- #
1773
- # e0.add_element(e1, {'bat' => '0', 'bam' => '1'})
1774
- # e0[1] # => <bar bat='0' bam='1'/>
1775
- #
1776
- # source://rexml//lib/rexml/element.rb#732
1777
- def add_element(element, attrs = T.unsafe(nil)); end
1778
-
1779
- # :call-seq:
1780
- # add_namespace(prefix, uri = nil) -> self
1781
- #
1782
- # Adds a namespace to the element; returns +self+.
1783
- #
1784
- # With the single argument +prefix+,
1785
- # adds a namespace using the given +prefix+ and the namespace URI:
1786
- #
1787
- # e = REXML::Element.new('foo')
1788
- # e.add_namespace('bar')
1789
- # e.namespaces # => {"xmlns"=>"bar"}
1790
- #
1791
- # With both arguments +prefix+ and +uri+ given,
1792
- # adds a namespace using both arguments:
1793
- #
1794
- # e.add_namespace('baz', 'bat')
1795
- # e.namespaces # => {"xmlns"=>"bar", "baz"=>"bat"}
1796
- #
1797
- # source://rexml//lib/rexml/element.rb#655
1798
- def add_namespace(prefix, uri = T.unsafe(nil)); end
1799
-
1800
- # :call-seq:
1801
- # add_text(string) -> nil
1802
- # add_text(text_node) -> self
1803
- #
1804
- # Adds text to the element.
1805
- #
1806
- # When string argument +string+ is given, returns +nil+.
1807
- #
1808
- # If the element has no child text node,
1809
- # creates a \REXML::Text object using the string,
1810
- # honoring the current settings for whitespace and raw,
1811
- # then adds that node to the element:
1812
- #
1813
- # d = REXML::Document.new('<a><b/></a>')
1814
- # a = d.root
1815
- # a.add_text('foo')
1816
- # a.to_a # => [<b/>, "foo"]
1817
- #
1818
- # If the element has child text nodes,
1819
- # appends the string to the _last_ text node:
1820
- #
1821
- # d = REXML::Document.new('<a>foo<b/>bar</a>')
1822
- # a = d.root
1823
- # a.add_text('baz')
1824
- # a.to_a # => ["foo", <b/>, "barbaz"]
1825
- # a.add_text('baz')
1826
- # a.to_a # => ["foo", <b/>, "barbazbaz"]
1827
- #
1828
- # When text node argument +text_node+ is given,
1829
- # appends the node as the last text node in the element;
1830
- # returns +self+:
1831
- #
1832
- # d = REXML::Document.new('<a>foo<b/>bar</a>')
1833
- # a = d.root
1834
- # a.add_text(REXML::Text.new('baz'))
1835
- # a.to_a # => ["foo", <b/>, "bar", "baz"]
1836
- # a.add_text(REXML::Text.new('baz'))
1837
- # a.to_a # => ["foo", <b/>, "bar", "baz", "baz"]
1838
- #
1839
- # source://rexml//lib/rexml/element.rb#1147
1840
- def add_text(text); end
1841
-
1842
- # :call-seq:
1843
- # attribute(name, namespace = nil)
1844
- #
1845
- # Returns the string value for the given attribute name.
1846
- #
1847
- # With only argument +name+ given,
1848
- # returns the value of the named attribute if it exists, otherwise +nil+:
1849
- #
1850
- # xml_string = <<-EOT
1851
- # <root xmlns="ns0">
1852
- # <a xmlns="ns1" attr="value"></a>
1853
- # <b xmlns="ns2" attr="value"></b>
1854
- # <c attr="value"/>
1855
- # </root>
1856
- # EOT
1857
- # d = REXML::Document.new(xml_string)
1858
- # root = d.root
1859
- # a = root[1] # => <a xmlns='ns1' attr='value'/>
1860
- # a.attribute('attr') # => attr='value'
1861
- # a.attribute('nope') # => nil
1862
- #
1863
- # With arguments +name+ and +namespace+ given,
1864
- # returns the value of the named attribute if it exists, otherwise +nil+:
1865
- #
1866
- # xml_string = "<root xmlns:a='a' a:x='a:x' x='x'/>"
1867
- # document = REXML::Document.new(xml_string)
1868
- # document.root.attribute("x") # => x='x'
1869
- # document.root.attribute("x", "a") # => a:x='a:x'
1870
- #
1871
- # source://rexml//lib/rexml/element.rb#1287
1872
- def attribute(name, namespace = T.unsafe(nil)); end
1873
-
1874
- # Mechanisms for accessing attributes and child elements of this
1875
- # element.
1876
- #
1877
- # source://rexml//lib/rexml/element.rb#278
1878
- def attributes; end
1879
-
1880
- # :call-seq:
1881
- # cdatas -> array_of_cdata_children
1882
- #
1883
- # Returns a frozen array of the REXML::CData children of the element:
1884
- #
1885
- # xml_string = <<-EOT
1886
- # <root>
1887
- # <![CDATA[foo]]>
1888
- # <![CDATA[bar]]>
1889
- # </root>
1890
- # EOT
1891
- # d = REXML::Document.new(xml_string)
1892
- # cds = d.root.cdatas # => ["foo", "bar"]
1893
- # cds.frozen? # => true
1894
- # cds.map {|cd| cd.class } # => [REXML::CData, REXML::CData]
1895
- #
1896
- # source://rexml//lib/rexml/element.rb#1420
1897
- def cdatas; end
1898
-
1899
- # :call-seq:
1900
- # clone -> new_element
1901
- #
1902
- # Returns a shallow copy of the element, containing the name and attributes,
1903
- # but not the parent or children:
1904
- #
1905
- # e = REXML::Element.new('foo')
1906
- # e.add_attributes({'bar' => 0, 'baz' => 1})
1907
- # e.clone # => <foo bar='0' baz='1'/>
1908
- #
1909
- # source://rexml//lib/rexml/element.rb#383
1910
- def clone; end
1911
-
1912
- # :call-seq:
1913
- # comments -> array_of_comment_children
1914
- #
1915
- # Returns a frozen array of the REXML::Comment children of the element:
1916
- #
1917
- # xml_string = <<-EOT
1918
- # <root>
1919
- # <!--foo-->
1920
- # <!--bar-->
1921
- # </root>
1922
- # EOT
1923
- # d = REXML::Document.new(xml_string)
1924
- # cs = d.root.comments
1925
- # cs.frozen? # => true
1926
- # cs.map {|c| c.class } # => [REXML::Comment, REXML::Comment]
1927
- # cs.map {|c| c.to_s } # => ["foo", "bar"]
1928
- #
1929
- # source://rexml//lib/rexml/element.rb#1441
1930
- def comments; end
1931
-
1932
- # The context holds information about the processing environment, such as
1933
- # whitespace handling.
1934
- #
1935
- # source://rexml//lib/rexml/element.rb#281
1936
- def context; end
1937
-
1938
- # The context holds information about the processing environment, such as
1939
- # whitespace handling.
1940
- #
1941
- # source://rexml//lib/rexml/element.rb#281
1942
- def context=(_arg0); end
1943
-
1944
- # :call-seq:
1945
- # delete_attribute(name) -> removed_attribute or nil
1946
- #
1947
- # Removes a named attribute if it exists;
1948
- # returns the removed attribute if found, otherwise +nil+:
1949
- #
1950
- # e = REXML::Element.new('foo')
1951
- # e.add_attribute('bar', 'baz')
1952
- # e.delete_attribute('bar') # => <bar/>
1953
- # e.delete_attribute('bar') # => nil
1954
- #
1955
- # source://rexml//lib/rexml/element.rb#1395
1956
- def delete_attribute(key); end
1957
-
1958
- # :call-seq:
1959
- # delete_element(index) -> removed_element or nil
1960
- # delete_element(element) -> removed_element or nil
1961
- # delete_element(xpath) -> removed_element or nil
1962
- #
1963
- # Deletes a child element.
1964
- #
1965
- # When 1-based integer argument +index+ is given,
1966
- # removes and returns the child element at that offset if it exists;
1967
- # indexing does not include text nodes;
1968
- # returns +nil+ if the element does not exist:
1969
- #
1970
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1971
- # a = d.root # => <a> ... </>
1972
- # a.delete_element(1) # => <b/>
1973
- # a.delete_element(1) # => <c/>
1974
- # a.delete_element(1) # => nil
1975
- #
1976
- # When element argument +element+ is given,
1977
- # removes and returns that child element if it exists,
1978
- # otherwise returns +nil+:
1979
- #
1980
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1981
- # a = d.root # => <a> ... </>
1982
- # c = a[2] # => <c/>
1983
- # a.delete_element(c) # => <c/>
1984
- # a.delete_element(c) # => nil
1985
- #
1986
- # When xpath argument +xpath+ is given,
1987
- # removes and returns the element at xpath if it exists,
1988
- # otherwise returns +nil+:
1989
- #
1990
- # d = REXML::Document.new '<a><b/>text<c/></a>'
1991
- # a = d.root # => <a> ... </>
1992
- # a.delete_element('//c') # => <c/>
1993
- # a.delete_element('//c') # => nil
1994
- #
1995
- # source://rexml//lib/rexml/element.rb#778
1996
- def delete_element(element); end
1997
-
1998
- # :call-seq:
1999
- # delete_namespace(namespace = 'xmlns') -> self
2000
- #
2001
- # Removes a namespace from the element.
2002
- #
2003
- # With no argument, removes the default namespace:
2004
- #
2005
- # d = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
2006
- # d.to_s # => "<a xmlns:foo='bar' xmlns='twiddle'/>"
2007
- # d.root.delete_namespace # => <a xmlns:foo='bar'/>
2008
- # d.to_s # => "<a xmlns:foo='bar'/>"
2009
- #
2010
- # With argument +namespace+, removes the specified namespace:
2011
- #
2012
- # d.root.delete_namespace('foo')
2013
- # d.to_s # => "<a/>"
2014
- #
2015
- # Does nothing if no such namespace is found:
2016
- #
2017
- # d.root.delete_namespace('nosuch')
2018
- # d.to_s # => "<a/>"
2019
- #
2020
- # source://rexml//lib/rexml/element.rb#687
2021
- def delete_namespace(namespace = T.unsafe(nil)); end
2022
-
2023
- # :call-seq:
2024
- # document -> document or nil
2025
- #
2026
- # If the element is part of a document, returns that document:
2027
- #
2028
- # d = REXML::Document.new('<a><b><c/></b></a>')
2029
- # top_element = d.first
2030
- # child = top_element.first
2031
- # top_element.document == d # => true
2032
- # child.document == d # => true
2033
- #
2034
- # If the element is not part of a document, returns +nil+:
2035
- #
2036
- # REXML::Element.new.document # => nil
2037
- #
2038
- # For a document, returns +self+:
2039
- #
2040
- # d.document == d # => true
2041
- #
2042
- # Related: #root, #root_node.
2043
- #
2044
- # source://rexml//lib/rexml/element.rb#475
2045
- def document; end
2046
-
2047
- # :call-seq:
2048
- # each_element {|e| ... }
2049
- #
2050
- # Calls the given block with each child element:
2051
- #
2052
- # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2053
- # a = d.root
2054
- # a.each_element {|e| p e }
2055
- #
2056
- # Output:
2057
- #
2058
- # <b> ... </>
2059
- # <c> ... </>
2060
- # <d> ... </>
2061
- # <e/>
2062
- #
2063
- # source://rexml//lib/rexml/element.rb#930
2064
- def each_element(xpath = T.unsafe(nil), &block); end
2065
-
2066
- # :call-seq:
2067
- # each_element_with_attribute(attr_name, value = nil, max = 0, xpath = nil) {|e| ... }
2068
- #
2069
- # Calls the given block with each child element that meets given criteria.
2070
- #
2071
- # When only string argument +attr_name+ is given,
2072
- # calls the block with each child element that has that attribute:
2073
- #
2074
- # d = REXML::Document.new '<a><b id="1"/><c id="2"/><d id="1"/><e/></a>'
2075
- # a = d.root
2076
- # a.each_element_with_attribute('id') {|e| p e }
2077
- #
2078
- # Output:
2079
- #
2080
- # <b id='1'/>
2081
- # <c id='2'/>
2082
- # <d id='1'/>
2083
- #
2084
- # With argument +attr_name+ and string argument +value+ given,
2085
- # calls the block with each child element that has that attribute
2086
- # with that value:
2087
- #
2088
- # a.each_element_with_attribute('id', '1') {|e| p e }
2089
- #
2090
- # Output:
2091
- #
2092
- # <b id='1'/>
2093
- # <d id='1'/>
2094
- #
2095
- # With arguments +attr_name+, +value+, and integer argument +max+ given,
2096
- # calls the block with at most +max+ child elements:
2097
- #
2098
- # a.each_element_with_attribute('id', '1', 1) {|e| p e }
2099
- #
2100
- # Output:
2101
- #
2102
- # <b id='1'/>
2103
- #
2104
- # With all arguments given, including +xpath+,
2105
- # calls the block with only those child elements
2106
- # that meet the first three criteria,
2107
- # and also match the given +xpath+:
2108
- #
2109
- # a.each_element_with_attribute('id', '1', 2, '//d') {|e| p e }
2110
- #
2111
- # Output:
2112
- #
2113
- # <d id='1'/>
2114
- #
2115
- # source://rexml//lib/rexml/element.rb#847
2116
- def each_element_with_attribute(key, value = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2117
-
2118
- # :call-seq:
2119
- # each_element_with_text(text = nil, max = 0, xpath = nil) {|e| ... }
2120
- #
2121
- # Calls the given block with each child element that meets given criteria.
2122
- #
2123
- # With no arguments, calls the block with each child element that has text:
2124
- #
2125
- # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2126
- # a = d.root
2127
- # a.each_element_with_text {|e| p e }
2128
- #
2129
- # Output:
2130
- #
2131
- # <b> ... </>
2132
- # <c> ... </>
2133
- # <d> ... </>
2134
- #
2135
- # With the single string argument +text+,
2136
- # calls the block with each element that has exactly that text:
2137
- #
2138
- # a.each_element_with_text('b') {|e| p e }
2139
- #
2140
- # Output:
2141
- #
2142
- # <b> ... </>
2143
- # <c> ... </>
2144
- #
2145
- # With argument +text+ and integer argument +max+,
2146
- # calls the block with at most +max+ elements:
2147
- #
2148
- # a.each_element_with_text('b', 1) {|e| p e }
2149
- #
2150
- # Output:
2151
- #
2152
- # <b> ... </>
2153
- #
2154
- # With all arguments given, including +xpath+,
2155
- # calls the block with only those child elements
2156
- # that meet the first two criteria,
2157
- # and also match the given +xpath+:
2158
- #
2159
- # a.each_element_with_text('b', 2, '//c') {|e| p e }
2160
- #
2161
- # Output:
2162
- #
2163
- # <c> ... </>
2164
- #
2165
- # source://rexml//lib/rexml/element.rb#904
2166
- def each_element_with_text(text = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2167
-
2168
- # Mechanisms for accessing attributes and child elements of this
2169
- # element.
2170
- #
2171
- # source://rexml//lib/rexml/element.rb#278
2172
- def elements; end
2173
-
2174
- # :call-seq:
2175
- # get_elements(xpath)
2176
- #
2177
- # Returns an array of the elements that match the given +xpath+:
2178
- #
2179
- # xml_string = <<-EOT
2180
- # <root>
2181
- # <a level='1'>
2182
- # <a level='2'/>
2183
- # </a>
2184
- # </root>
2185
- # EOT
2186
- # d = REXML::Document.new(xml_string)
2187
- # d.root.get_elements('//a') # => [<a level='1'> ... </>, <a level='2'/>]
2188
- #
2189
- # source://rexml//lib/rexml/element.rb#949
2190
- def get_elements(xpath); end
2191
-
2192
- # :call-seq:
2193
- # get_text(xpath = nil) -> text_node or nil
2194
- #
2195
- # Returns the first text node child in a specified element, if it exists,
2196
- # +nil+ otherwise.
2197
- #
2198
- # With no argument, returns the first text node from +self+:
2199
- #
2200
- # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2201
- # d.root.get_text.class # => REXML::Text
2202
- # d.root.get_text # => "some text "
2203
- #
2204
- # With argument +xpath+, returns the first text node from the element
2205
- # that matches +xpath+:
2206
- #
2207
- # d.root.get_text(1) # => "this is bold!"
2208
- #
2209
- # source://rexml//lib/rexml/element.rb#1053
2210
- def get_text(path = T.unsafe(nil)); end
2211
-
2212
- # :call-seq:
2213
- # has_attributes? -> true or false
2214
- #
2215
- # Returns +true+ if the element has attributes, +false+ otherwise:
2216
- #
2217
- # d = REXML::Document.new('<root><a attr="val"/><b/></root>')
2218
- # a, b = *d.root
2219
- # a.has_attributes? # => true
2220
- # b.has_attributes? # => false
2221
- #
2222
- # @return [Boolean]
2223
- #
2224
- # source://rexml//lib/rexml/element.rb#1315
2225
- def has_attributes?; end
2226
-
2227
- # :call-seq:
2228
- # has_elements?
2229
- #
2230
- # Returns +true+ if the element has one or more element children,
2231
- # +false+ otherwise:
2232
- #
2233
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2234
- # a = d.root # => <a> ... </>
2235
- # a.has_elements? # => true
2236
- # b = a[0] # => <b/>
2237
- # b.has_elements? # => false
2238
- #
2239
- # @return [Boolean]
2240
- #
2241
- # source://rexml//lib/rexml/element.rb#794
2242
- def has_elements?; end
2243
-
2244
- # :call-seq:
2245
- # has_text? -> true or false
2246
- #
2247
- # Returns +true+ if the element has one or more text noded,
2248
- # +false+ otherwise:
2249
- #
2250
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2251
- # a = d.root
2252
- # a.has_text? # => true
2253
- # b = a[0]
2254
- # b.has_text? # => false
2255
- #
2256
- # @return [Boolean]
2257
- #
2258
- # source://rexml//lib/rexml/element.rb#1002
2259
- def has_text?; end
2260
-
2261
- # :call-seq:
2262
- # ignore_whitespace_nodes
2263
- #
2264
- # Returns +true+ if whitespace nodes are ignored for the element.
2265
- #
2266
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2267
- #
2268
- # source://rexml//lib/rexml/element.rb#513
2269
- def ignore_whitespace_nodes; end
2270
-
2271
- # :call-seq:
2272
- # inspect -> string
2273
- #
2274
- # Returns a string representation of the element.
2275
- #
2276
- # For an element with no attributes and no children, shows the element name:
2277
- #
2278
- # REXML::Element.new.inspect # => "<UNDEFINED/>"
2279
- #
2280
- # Shows attributes, if any:
2281
- #
2282
- # e = REXML::Element.new('foo')
2283
- # e.add_attributes({'bar' => 0, 'baz' => 1})
2284
- # e.inspect # => "<foo bar='0' baz='1'/>"
2285
- #
2286
- # Shows an ellipsis (<tt>...</tt>), if there are child elements:
2287
- #
2288
- # e.add_element(REXML::Element.new('bar'))
2289
- # e.add_element(REXML::Element.new('baz'))
2290
- # e.inspect # => "<foo bar='0' baz='1'> ... </>"
2291
- #
2292
- # source://rexml//lib/rexml/element.rb#358
2293
- def inspect; end
2294
-
2295
- # :call-seq:
2296
- # instructions -> array_of_instruction_children
2297
- #
2298
- # Returns a frozen array of the REXML::Instruction children of the element:
2299
- #
2300
- # xml_string = <<-EOT
2301
- # <root>
2302
- # <?target0 foo?>
2303
- # <?target1 bar?>
2304
- # </root>
2305
- # EOT
2306
- # d = REXML::Document.new(xml_string)
2307
- # is = d.root.instructions
2308
- # is.frozen? # => true
2309
- # is.map {|i| i.class } # => [REXML::Instruction, REXML::Instruction]
2310
- # is.map {|i| i.to_s } # => ["<?target0 foo?>", "<?target1 bar?>"]
2311
- #
2312
- # source://rexml//lib/rexml/element.rb#1462
2313
- def instructions; end
2314
-
2315
- # :call-seq:
2316
- # namespace(prefix = nil) -> string_uri or nil
2317
- #
2318
- # Returns the string namespace URI for the element,
2319
- # possibly deriving from one of its ancestors.
2320
- #
2321
- # xml_string = <<-EOT
2322
- # <root>
2323
- # <a xmlns='1' xmlns:y='2'>
2324
- # <b/>
2325
- # <c xmlns:z='3'/>
2326
- # </a>
2327
- # </root>
2328
- # EOT
2329
- # d = REXML::Document.new(xml_string)
2330
- # b = d.elements['//b']
2331
- # b.namespace # => "1"
2332
- # b.namespace('y') # => "2"
2333
- # b.namespace('nosuch') # => nil
2334
- #
2335
- # source://rexml//lib/rexml/element.rb#618
2336
- def namespace(prefix = T.unsafe(nil)); end
2337
-
2338
- # :call-seq:
2339
- # namespaces -> array_of_namespace_names
2340
- #
2341
- # Returns a hash of all defined namespaces
2342
- # in the element and its ancestors:
2343
- #
2344
- # xml_string = <<-EOT
2345
- # <root>
2346
- # <a xmlns:x='1' xmlns:y='2'>
2347
- # <b/>
2348
- # <c xmlns:z='3'/>
2349
- # </a>
2350
- # </root>
2351
- # EOT
2352
- # d = REXML::Document.new(xml_string)
2353
- # d.elements['//a'].namespaces # => {"x"=>"1", "y"=>"2"}
2354
- # d.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
2355
- # d.elements['//c'].namespaces # => {"x"=>"1", "y"=>"2", "z"=>"3"}
2356
- #
2357
- # source://rexml//lib/rexml/element.rb#591
2358
- def namespaces; end
2359
-
2360
- # :call-seq:
2361
- # next_element
2362
- #
2363
- # Returns the next sibling that is an element if it exists,
2364
- # +niL+ otherwise:
2365
- #
2366
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2367
- # d.root.elements['b'].next_element #-> <c/>
2368
- # d.root.elements['c'].next_element #-> nil
2369
- #
2370
- # source://rexml//lib/rexml/element.rb#963
2371
- def next_element; end
2372
-
2373
- # :call-seq:
2374
- # node_type -> :element
2375
- #
2376
- # Returns symbol <tt>:element</tt>:
2377
- #
2378
- # d = REXML::Document.new('<a/>')
2379
- # a = d.root # => <a/>
2380
- # a.node_type # => :element
2381
- #
2382
- # source://rexml//lib/rexml/element.rb#1168
2383
- def node_type; end
2384
-
2385
- # :call-seq:
2386
- # prefixes -> array_of_namespace_prefixes
2387
- #
2388
- # Returns an array of the string prefixes (names) of all defined namespaces
2389
- # in the element and its ancestors:
2390
- #
2391
- # xml_string = <<-EOT
2392
- # <root>
2393
- # <a xmlns:x='1' xmlns:y='2'>
2394
- # <b/>
2395
- # <c xmlns:z='3'/>
2396
- # </a>
2397
- # </root>
2398
- # EOT
2399
- # d = REXML::Document.new(xml_string, {compress_whitespace: :all})
2400
- # d.elements['//a'].prefixes # => ["x", "y"]
2401
- # d.elements['//b'].prefixes # => ["x", "y"]
2402
- # d.elements['//c'].prefixes # => ["x", "y", "z"]
2403
- #
2404
- # source://rexml//lib/rexml/element.rb#565
2405
- def prefixes; end
2406
-
2407
- # :call-seq:
2408
- # previous_element
2409
- #
2410
- # Returns the previous sibling that is an element if it exists,
2411
- # +niL+ otherwise:
2412
- #
2413
- # d = REXML::Document.new '<a><b/>text<c/></a>'
2414
- # d.root.elements['c'].previous_element #-> <b/>
2415
- # d.root.elements['b'].previous_element #-> nil
2416
- #
2417
- # source://rexml//lib/rexml/element.rb#979
2418
- def previous_element; end
2419
-
2420
- # :call-seq:
2421
- # raw
2422
- #
2423
- # Returns +true+ if raw mode is set for the element.
2424
- #
2425
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2426
- #
2427
- # The evaluation is tested against +expanded_name+, and so is namespace
2428
- # sensitive.
2429
- #
2430
- # source://rexml//lib/rexml/element.rb#533
2431
- def raw; end
2432
-
2433
- # :call-seq:
2434
- # root -> element
2435
- #
2436
- # Returns the most distant _element_ (not document) ancestor of the element:
2437
- #
2438
- # d = REXML::Document.new('<a><b><c/></b></a>')
2439
- # top_element = d.first
2440
- # child = top_element.first
2441
- # top_element.root == top_element # => true
2442
- # child.root == top_element # => true
2443
- #
2444
- # For a document, returns the topmost element:
2445
- #
2446
- # d.root == top_element # => true
2447
- #
2448
- # Related: #root_node, #document.
2449
- #
2450
- # source://rexml//lib/rexml/element.rb#443
2451
- def root; end
2452
-
2453
- # :call-seq:
2454
- # root_node -> document or element
2455
- #
2456
- # Returns the most distant ancestor of +self+.
2457
- #
2458
- # When the element is part of a document,
2459
- # returns the root node of the document.
2460
- # Note that the root node is different from the document element;
2461
- # in this example +a+ is document element and the root node is its parent:
2462
- #
2463
- # d = REXML::Document.new('<a><b><c/></b></a>')
2464
- # top_element = d.first # => <a> ... </>
2465
- # child = top_element.first # => <b> ... </>
2466
- # d.root_node == d # => true
2467
- # top_element.root_node == d # => true
2468
- # child.root_node == d # => true
2469
- #
2470
- # When the element is not part of a document, but does have ancestor elements,
2471
- # returns the most distant ancestor element:
2472
- #
2473
- # e0 = REXML::Element.new('foo')
2474
- # e1 = REXML::Element.new('bar')
2475
- # e1.parent = e0
2476
- # e2 = REXML::Element.new('baz')
2477
- # e2.parent = e1
2478
- # e2.root_node == e0 # => true
2479
- #
2480
- # When the element has no ancestor elements,
2481
- # returns +self+:
2482
- #
2483
- # e = REXML::Element.new('foo')
2484
- # e.root_node == e # => true
2485
- #
2486
- # Related: #root, #document.
2487
- #
2488
- # source://rexml//lib/rexml/element.rb#422
2489
- def root_node; end
2490
-
2491
- # :call-seq:
2492
- # text(xpath = nil) -> text_string or nil
2493
- #
2494
- # Returns the text string from the first text node child
2495
- # in a specified element, if it exists, +nil+ otherwise.
2496
- #
2497
- # With no argument, returns the text from the first text node in +self+:
2498
- #
2499
- # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2500
- # d.root.text.class # => String
2501
- # d.root.text # => "some text "
2502
- #
2503
- # With argument +xpath+, returns text from the first text node
2504
- # in the element that matches +xpath+:
2505
- #
2506
- # d.root.text(1) # => "this is bold!"
2507
- #
2508
- # Note that an element may have multiple text nodes,
2509
- # possibly separated by other non-text children, as above.
2510
- # Even so, the returned value is the string text from the first such node.
2511
- #
2512
- # Note also that the text note is retrieved by method get_text,
2513
- # and so is always normalized text.
2514
- #
2515
- # source://rexml//lib/rexml/element.rb#1030
2516
- def text(path = T.unsafe(nil)); end
2517
-
2518
- # :call-seq:
2519
- # text = string -> string
2520
- # text = nil -> nil
2521
- #
2522
- # Adds, replaces, or removes the first text node child in the element.
2523
- #
2524
- # With string argument +string+,
2525
- # creates a new \REXML::Text node containing that string,
2526
- # honoring the current settings for whitespace and row,
2527
- # then places the node as the first text child in the element;
2528
- # returns +string+.
2529
- #
2530
- # If the element has no text child, the text node is added:
2531
- #
2532
- # d = REXML::Document.new '<a><b/></a>'
2533
- # d.root.text = 'foo' #-> '<a><b/>foo</a>'
2534
- #
2535
- # If the element has a text child, it is replaced:
2536
- #
2537
- # d.root.text = 'bar' #-> '<a><b/>bar</a>'
2538
- #
2539
- # With argument +nil+, removes the first text child:
2540
- #
2541
- # d.root.text = nil #-> '<a><b/><c/></a>'
2542
- #
2543
- # source://rexml//lib/rexml/element.rb#1089
2544
- def text=(text); end
2545
-
2546
- # :call-seq:
2547
- # texts -> array_of_text_children
2548
- #
2549
- # Returns a frozen array of the REXML::Text children of the element:
2550
- #
2551
- # xml_string = '<root><a/>text<b/>more<c/></root>'
2552
- # d = REXML::Document.new(xml_string)
2553
- # ts = d.root.texts
2554
- # ts.frozen? # => true
2555
- # ts.map {|t| t.class } # => [REXML::Text, REXML::Text]
2556
- # ts.map {|t| t.to_s } # => ["text", "more"]
2557
- #
2558
- # source://rexml//lib/rexml/element.rb#1478
2559
- def texts; end
2560
-
2561
- # :call-seq:
2562
- # whitespace
2563
- #
2564
- # Returns +true+ if whitespace is respected for this element,
2565
- # +false+ otherwise.
2566
- #
2567
- # See {Element Context}[../doc/rexml/context_rdoc.html].
2568
- #
2569
- # The evaluation is tested against the element's +expanded_name+,
2570
- # and so is namespace-sensitive.
2571
- #
2572
- # source://rexml//lib/rexml/element.rb#490
2573
- def whitespace; end
2574
-
2575
- # == DEPRECATED
2576
- # See REXML::Formatters
2577
- #
2578
- # Writes out this element, and recursively, all children.
2579
- # output::
2580
- # output an object which supports '<< string'; this is where the
2581
- # document will be written.
2582
- # indent::
2583
- # An integer. If -1, no indenting will be used; otherwise, the
2584
- # indentation will be this number of spaces, and children will be
2585
- # indented an additional amount. Defaults to -1
2586
- # transitive::
2587
- # If transitive is true and indent is >= 0, then the output will be
2588
- # pretty-printed in such a way that the added whitespace does not affect
2589
- # the parse tree of the document
2590
- # ie_hack::
2591
- # This hack inserts a space before the /> on empty tags to address
2592
- # a limitation of Internet Explorer. Defaults to false
2593
- #
2594
- # out = ''
2595
- # doc.write( out ) #-> doc is written to the string 'out'
2596
- # doc.write( $stdout ) #-> doc written to the console
2597
- #
2598
- # source://rexml//lib/rexml/element.rb#1504
2599
- def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
2600
-
2601
- # :call-seq:
2602
- # xpath -> string_xpath
2603
- #
2604
- # Returns the string xpath to the element
2605
- # relative to the most distant parent:
2606
- #
2607
- # d = REXML::Document.new('<a><b><c/></b></a>')
2608
- # a = d.root # => <a> ... </>
2609
- # b = a[0] # => <b> ... </>
2610
- # c = b[0] # => <c/>
2611
- # d.xpath # => ""
2612
- # a.xpath # => "/a"
2613
- # b.xpath # => "/a/b"
2614
- # c.xpath # => "/a/b/c"
2615
- #
2616
- # If there is no parent, returns the expanded name of the element:
2617
- #
2618
- # e = REXML::Element.new('foo')
2619
- # e.xpath # => "foo"
2620
- #
2621
- # source://rexml//lib/rexml/element.rb#1192
2622
- def xpath; end
2623
-
2624
- private
2625
-
2626
- # source://rexml//lib/rexml/element.rb#1521
2627
- def __to_xpath_helper(node); end
2628
-
2629
- # A private helper method
2630
- #
2631
- # source://rexml//lib/rexml/element.rb#1536
2632
- def each_with_something(test, max = T.unsafe(nil), name = T.unsafe(nil)); end
2633
- end
2634
-
2635
- # source://rexml//lib/rexml/doctype.rb#261
2636
- class REXML::ElementDecl < ::REXML::Declaration
2637
- # @return [ElementDecl] a new instance of ElementDecl
2638
- #
2639
- # source://rexml//lib/rexml/doctype.rb#262
2640
- def initialize(src); end
2641
- end
2642
-
2643
- # A class which provides filtering of children for Elements, and
2644
- # XPath search support. You are expected to only encounter this class as
2645
- # the <tt>element.elements</tt> object. Therefore, you are
2646
- # _not_ expected to instantiate this yourself.
2647
- #
2648
- # xml_string = <<-EOT
2649
- # <?xml version="1.0" encoding="UTF-8"?>
2650
- # <bookstore>
2651
- # <book category="cooking">
2652
- # <title lang="en">Everyday Italian</title>
2653
- # <author>Giada De Laurentiis</author>
2654
- # <year>2005</year>
2655
- # <price>30.00</price>
2656
- # </book>
2657
- # <book category="children">
2658
- # <title lang="en">Harry Potter</title>
2659
- # <author>J K. Rowling</author>
2660
- # <year>2005</year>
2661
- # <price>29.99</price>
2662
- # </book>
2663
- # <book category="web">
2664
- # <title lang="en">XQuery Kick Start</title>
2665
- # <author>James McGovern</author>
2666
- # <author>Per Bothner</author>
2667
- # <author>Kurt Cagle</author>
2668
- # <author>James Linn</author>
2669
- # <author>Vaidyanathan Nagarajan</author>
2670
- # <year>2003</year>
2671
- # <price>49.99</price>
2672
- # </book>
2673
- # <book category="web" cover="paperback">
2674
- # <title lang="en">Learning XML</title>
2675
- # <author>Erik T. Ray</author>
2676
- # <year>2003</year>
2677
- # <price>39.95</price>
2678
- # </book>
2679
- # </bookstore>
2680
- # EOT
2681
- # d = REXML::Document.new(xml_string)
2682
- # elements = d.root.elements
2683
- # elements # => #<REXML::Elements @element=<bookstore> ... </>>
2684
- #
2685
- # source://rexml//lib/rexml/element.rb#1591
2686
- class REXML::Elements
2687
- include ::Enumerable
2688
-
2689
- # :call-seq:
2690
- # new(parent) -> new_elements_object
2691
- #
2692
- # Returns a new \Elements object with the given +parent+.
2693
- # Does _not_ assign <tt>parent.elements = self</tt>:
2694
- #
2695
- # d = REXML::Document.new(xml_string)
2696
- # eles = REXML::Elements.new(d.root)
2697
- # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2698
- # eles == d.root.elements # => false
2699
- #
2700
- # @return [Elements] a new instance of Elements
2701
- #
2702
- # source://rexml//lib/rexml/element.rb#1604
2703
- def initialize(parent); end
2704
-
2705
- # :call-seq:
2706
- # add -> new_element
2707
- # add(name) -> new_element
2708
- # add(element) -> element
2709
- #
2710
- # Adds an element; returns the element added.
2711
- #
2712
- # With no argument, creates and adds a new element.
2713
- # The new element has:
2714
- #
2715
- # - No name.
2716
- # - \Parent from the \Elements object.
2717
- # - Context from the that parent.
2718
- #
2719
- # Example:
2720
- #
2721
- # d = REXML::Document.new(xml_string)
2722
- # elements = d.root.elements
2723
- # parent = elements.parent # => <bookstore> ... </>
2724
- # parent.context = {raw: :all}
2725
- # elements.size # => 4
2726
- # new_element = elements.add # => </>
2727
- # elements.size # => 5
2728
- # new_element.name # => nil
2729
- # new_element.parent # => <bookstore> ... </>
2730
- # new_element.context # => {:raw=>:all}
2731
- #
2732
- # With string argument +name+, creates and adds a new element.
2733
- # The new element has:
2734
- #
2735
- # - Name +name+.
2736
- # - \Parent from the \Elements object.
2737
- # - Context from the that parent.
2738
- #
2739
- # Example:
2740
- #
2741
- # d = REXML::Document.new(xml_string)
2742
- # elements = d.root.elements
2743
- # parent = elements.parent # => <bookstore> ... </>
2744
- # parent.context = {raw: :all}
2745
- # elements.size # => 4
2746
- # new_element = elements.add('foo') # => <foo/>
2747
- # elements.size # => 5
2748
- # new_element.name # => "foo"
2749
- # new_element.parent # => <bookstore> ... </>
2750
- # new_element.context # => {:raw=>:all}
2751
- #
2752
- # With argument +element+,
2753
- # creates and adds a clone of the given +element+.
2754
- # The new element has name, parent, and context from the given +element+.
2755
- #
2756
- # d = REXML::Document.new(xml_string)
2757
- # elements = d.root.elements
2758
- # elements.size # => 4
2759
- # e0 = REXML::Element.new('foo')
2760
- # e1 = REXML::Element.new('bar', e0, {raw: :all})
2761
- # element = elements.add(e1) # => <bar/>
2762
- # elements.size # => 5
2763
- # element.name # => "bar"
2764
- # element.parent # => <bookstore> ... </>
2765
- # element.context # => {:raw=>:all}
2766
- #
2767
- # source://rexml//lib/rexml/element.rb#1921
2768
- def <<(element = T.unsafe(nil)); end
2769
-
2770
- # :call-seq:
2771
- # elements[index] -> element or nil
2772
- # elements[xpath] -> element or nil
2773
- # elements[n, name] -> element or nil
2774
- #
2775
- # Returns the first \Element object selected by the arguments,
2776
- # if any found, or +nil+ if none found.
2777
- #
2778
- # Notes:
2779
- # - The +index+ is 1-based, not 0-based, so that:
2780
- # - The first element has index <tt>1</tt>
2781
- # - The _nth_ element has index +n+.
2782
- # - The selection ignores non-\Element nodes.
2783
- #
2784
- # When the single argument +index+ is given,
2785
- # returns the element given by the index, if any; otherwise, +nil+:
2786
- #
2787
- # d = REXML::Document.new(xml_string)
2788
- # eles = d.root.elements
2789
- # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2790
- # eles[1] # => <book category='cooking'> ... </>
2791
- # eles.size # => 4
2792
- # eles[4] # => <book category='web' cover='paperback'> ... </>
2793
- # eles[5] # => nil
2794
- #
2795
- # The node at this index is not an \Element, and so is not returned:
2796
- #
2797
- # eles = d.root.first.first # => <title lang='en'> ... </>
2798
- # eles.to_a # => ["Everyday Italian"]
2799
- # eles[1] # => nil
2800
- #
2801
- # When the single argument +xpath+ is given,
2802
- # returns the first element found via that +xpath+, if any; otherwise, +nil+:
2803
- #
2804
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2805
- # eles['/bookstore'] # => <bookstore> ... </>
2806
- # eles['//book'] # => <book category='cooking'> ... </>
2807
- # eles['//book [@category="children"]'] # => <book category='children'> ... </>
2808
- # eles['/nosuch'] # => nil
2809
- # eles['//nosuch'] # => nil
2810
- # eles['//book [@category="nosuch"]'] # => nil
2811
- # eles['.'] # => <bookstore> ... </>
2812
- # eles['..'].class # => REXML::Document
2813
- #
2814
- # With arguments +n+ and +name+ given,
2815
- # returns the _nth_ found element that has the given +name+,
2816
- # or +nil+ if there is no such _nth_ element:
2817
- #
2818
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2819
- # eles[1, 'book'] # => <book category='cooking'> ... </>
2820
- # eles[4, 'book'] # => <book category='web' cover='paperback'> ... </>
2821
- # eles[5, 'book'] # => nil
2822
- #
2823
- # source://rexml//lib/rexml/element.rb#1676
2824
- def [](index, name = T.unsafe(nil)); end
2825
-
2826
- # :call-seq:
2827
- # elements[] = index, replacement_element -> replacement_element or nil
2828
- #
2829
- # Replaces or adds an element.
2830
- #
2831
- # When <tt>eles[index]</tt> exists, replaces it with +replacement_element+
2832
- # and returns +replacement_element+:
2833
- #
2834
- # d = REXML::Document.new(xml_string)
2835
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2836
- # eles[1] # => <book category='cooking'> ... </>
2837
- # eles[1] = REXML::Element.new('foo')
2838
- # eles[1] # => <foo/>
2839
- #
2840
- # Does nothing (or raises an exception)
2841
- # if +replacement_element+ is not an \Element:
2842
- # eles[2] # => <book category='web' cover='paperback'> ... </>
2843
- # eles[2] = REXML::Text.new('bar')
2844
- # eles[2] # => <book category='web' cover='paperback'> ... </>
2845
- #
2846
- # When <tt>eles[index]</tt> does not exist,
2847
- # adds +replacement_element+ to the element and returns
2848
- #
2849
- # d = REXML::Document.new(xml_string)
2850
- # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2851
- # eles.size # => 4
2852
- # eles[50] = REXML::Element.new('foo') # => <foo/>
2853
- # eles.size # => 5
2854
- # eles[5] # => <foo/>
2855
- #
2856
- # Does nothing (or raises an exception)
2857
- # if +replacement_element+ is not an \Element:
2858
- #
2859
- # eles[50] = REXML::Text.new('bar') # => "bar"
2860
- # eles.size # => 5
2861
- #
2862
- # source://rexml//lib/rexml/element.rb#1731
2863
- def []=(index, element); end
2864
-
2865
- # :call-seq:
2866
- # add -> new_element
2867
- # add(name) -> new_element
2868
- # add(element) -> element
2869
- #
2870
- # Adds an element; returns the element added.
2871
- #
2872
- # With no argument, creates and adds a new element.
2873
- # The new element has:
2874
- #
2875
- # - No name.
2876
- # - \Parent from the \Elements object.
2877
- # - Context from the that parent.
2878
- #
2879
- # Example:
2880
- #
2881
- # d = REXML::Document.new(xml_string)
2882
- # elements = d.root.elements
2883
- # parent = elements.parent # => <bookstore> ... </>
2884
- # parent.context = {raw: :all}
2885
- # elements.size # => 4
2886
- # new_element = elements.add # => </>
2887
- # elements.size # => 5
2888
- # new_element.name # => nil
2889
- # new_element.parent # => <bookstore> ... </>
2890
- # new_element.context # => {:raw=>:all}
2891
- #
2892
- # With string argument +name+, creates and adds a new element.
2893
- # The new element has:
2894
- #
2895
- # - Name +name+.
2896
- # - \Parent from the \Elements object.
2897
- # - Context from the that parent.
2898
- #
2899
- # Example:
2900
- #
2901
- # d = REXML::Document.new(xml_string)
2902
- # elements = d.root.elements
2903
- # parent = elements.parent # => <bookstore> ... </>
2904
- # parent.context = {raw: :all}
2905
- # elements.size # => 4
2906
- # new_element = elements.add('foo') # => <foo/>
2907
- # elements.size # => 5
2908
- # new_element.name # => "foo"
2909
- # new_element.parent # => <bookstore> ... </>
2910
- # new_element.context # => {:raw=>:all}
2911
- #
2912
- # With argument +element+,
2913
- # creates and adds a clone of the given +element+.
2914
- # The new element has name, parent, and context from the given +element+.
2915
- #
2916
- # d = REXML::Document.new(xml_string)
2917
- # elements = d.root.elements
2918
- # elements.size # => 4
2919
- # e0 = REXML::Element.new('foo')
2920
- # e1 = REXML::Element.new('bar', e0, {raw: :all})
2921
- # element = elements.add(e1) # => <bar/>
2922
- # elements.size # => 5
2923
- # element.name # => "bar"
2924
- # element.parent # => <bookstore> ... </>
2925
- # element.context # => {:raw=>:all}
2926
- #
2927
- # source://rexml//lib/rexml/element.rb#1921
2928
- def add(element = T.unsafe(nil)); end
2929
-
2930
- # :call-seq:
2931
- # collect(xpath = nil) {|element| ... } -> array
2932
- #
2933
- # Iterates over the elements; returns the array of block return values.
2934
- #
2935
- # With no argument, iterates over all elements:
2936
- #
2937
- # d = REXML::Document.new(xml_string)
2938
- # elements = d.root.elements
2939
- # elements.collect {|element| element.size } # => [9, 9, 17, 9]
2940
- #
2941
- # With argument +xpath+, iterates over elements that match
2942
- # the given +xpath+:
2943
- #
2944
- # xpath = '//book [@category="web"]'
2945
- # elements.collect(xpath) {|element| element.size } # => [17, 9]
2946
- #
2947
- # source://rexml//lib/rexml/element.rb#1984
2948
- def collect(xpath = T.unsafe(nil)); end
2949
-
2950
- # :call-seq:
2951
- # delete(index) -> removed_element or nil
2952
- # delete(element) -> removed_element or nil
2953
- # delete(xpath) -> removed_element or nil
2954
- #
2955
- # Removes an element; returns the removed element, or +nil+ if none removed.
2956
- #
2957
- # With integer argument +index+ given,
2958
- # removes the child element at that offset:
2959
- #
2960
- # d = REXML::Document.new(xml_string)
2961
- # elements = d.root.elements
2962
- # elements.size # => 4
2963
- # elements[2] # => <book category='children'> ... </>
2964
- # elements.delete(2) # => <book category='children'> ... </>
2965
- # elements.size # => 3
2966
- # elements[2] # => <book category='web'> ... </>
2967
- # elements.delete(50) # => nil
2968
- #
2969
- # With element argument +element+ given,
2970
- # removes that child element:
2971
- #
2972
- # d = REXML::Document.new(xml_string)
2973
- # elements = d.root.elements
2974
- # ele_1, ele_2, ele_3, ele_4 = *elements
2975
- # elements.size # => 4
2976
- # elements[2] # => <book category='children'> ... </>
2977
- # elements.delete(ele_2) # => <book category='children'> ... </>
2978
- # elements.size # => 3
2979
- # elements[2] # => <book category='web'> ... </>
2980
- # elements.delete(ele_2) # => nil
2981
- #
2982
- # With string argument +xpath+ given,
2983
- # removes the first element found via that xpath:
2984
- #
2985
- # d = REXML::Document.new(xml_string)
2986
- # elements = d.root.elements
2987
- # elements.delete('//book') # => <book category='cooking'> ... </>
2988
- # elements.delete('//book [@category="children"]') # => <book category='children'> ... </>
2989
- # elements.delete('//nosuch') # => nil
2990
- #
2991
- # source://rexml//lib/rexml/element.rb#1821
2992
- def delete(element); end
2993
-
2994
- # :call-seq:
2995
- # delete_all(xpath)
2996
- #
2997
- # Removes all elements found via the given +xpath+;
2998
- # returns the array of removed elements, if any, else +nil+.
2999
- #
3000
- # d = REXML::Document.new(xml_string)
3001
- # elements = d.root.elements
3002
- # elements.size # => 4
3003
- # deleted_elements = elements.delete_all('//book [@category="web"]')
3004
- # deleted_elements.size # => 2
3005
- # elements.size # => 2
3006
- # deleted_elements = elements.delete_all('//book')
3007
- # deleted_elements.size # => 2
3008
- # elements.size # => 0
3009
- # elements.delete_all('//book') # => []
3010
- #
3011
- # source://rexml//lib/rexml/element.rb#1847
3012
- def delete_all(xpath); end
3013
-
3014
- # :call-seq:
3015
- # each(xpath = nil) {|element| ... } -> self
3016
- #
3017
- # Iterates over the elements.
3018
- #
3019
- # With no argument, calls the block with each element:
3020
- #
3021
- # d = REXML::Document.new(xml_string)
3022
- # elements = d.root.elements
3023
- # elements.each {|element| p element }
3024
- #
3025
- # Output:
3026
- #
3027
- # <book category='cooking'> ... </>
3028
- # <book category='children'> ... </>
3029
- # <book category='web'> ... </>
3030
- # <book category='web' cover='paperback'> ... </>
3031
- #
3032
- # With argument +xpath+, calls the block with each element
3033
- # that matches the given +xpath+:
3034
- #
3035
- # elements.each('//book [@category="web"]') {|element| p element }
3036
- #
3037
- # Output:
3038
- #
3039
- # <book category='web'> ... </>
3040
- # <book category='web' cover='paperback'> ... </>
3041
- #
3042
- # source://rexml//lib/rexml/element.rb#1963
3043
- def each(xpath = T.unsafe(nil)); end
3044
-
3045
- # :call-seq:
3046
- # empty? -> true or false
3047
- #
3048
- # Returns +true+ if there are no children, +false+ otherwise.
3049
- #
3050
- # d = REXML::Document.new('')
3051
- # d.elements.empty? # => true
3052
- # d = REXML::Document.new(xml_string)
3053
- # d.elements.empty? # => false
3054
- #
3055
- # @return [Boolean]
3056
- #
3057
- # source://rexml//lib/rexml/element.rb#1751
3058
- def empty?; end
3059
-
3060
- # :call-seq:
3061
- # index(element)
3062
- #
3063
- # Returns the 1-based index of the given +element+, if found;
3064
- # otherwise, returns -1:
3065
- #
3066
- # d = REXML::Document.new(xml_string)
3067
- # elements = d.root.elements
3068
- # ele_1, ele_2, ele_3, ele_4 = *elements
3069
- # elements.index(ele_4) # => 4
3070
- # elements.delete(ele_3)
3071
- # elements.index(ele_4) # => 3
3072
- # elements.index(ele_3) # => -1
3073
- #
3074
- # source://rexml//lib/rexml/element.rb#1769
3075
- def index(element); end
3076
-
3077
- # :call-seq:
3078
- # inject(xpath = nil, initial = nil) -> object
3079
- #
3080
- # Calls the block with elements; returns the last block return value.
3081
- #
3082
- # With no argument, iterates over the elements, calling the block
3083
- # <tt>elements.size - 1</tt> times.
3084
- #
3085
- # - The first call passes the first and second elements.
3086
- # - The second call passes the first block return value and the third element.
3087
- # - The third call passes the second block return value and the fourth element.
3088
- # - And so on.
3089
- #
3090
- # In this example, the block returns the passed element,
3091
- # which is then the object argument to the next call:
3092
- #
3093
- # d = REXML::Document.new(xml_string)
3094
- # elements = d.root.elements
3095
- # elements.inject do |object, element|
3096
- # p [elements.index(object), elements.index(element)]
3097
- # element
3098
- # end
3099
- #
3100
- # Output:
3101
- #
3102
- # [1, 2]
3103
- # [2, 3]
3104
- # [3, 4]
3105
- #
3106
- # With the single argument +xpath+, calls the block only with
3107
- # elements matching that xpath:
3108
- #
3109
- # elements.inject('//book [@category="web"]') do |object, element|
3110
- # p [elements.index(object), elements.index(element)]
3111
- # element
3112
- # end
3113
- #
3114
- # Output:
3115
- #
3116
- # [3, 4]
3117
- #
3118
- # With argument +xpath+ given as +nil+
3119
- # and argument +initial+ also given,
3120
- # calls the block once for each element.
3121
- #
3122
- # - The first call passes the +initial+ and the first element.
3123
- # - The second call passes the first block return value and the second element.
3124
- # - The third call passes the second block return value and the third element.
3125
- # - And so on.
3126
- #
3127
- # In this example, the first object index is <tt>-1</tt>
3128
- #
3129
- # elements.inject(nil, 'Initial') do |object, element|
3130
- # p [elements.index(object), elements.index(element)]
3131
- # element
3132
- # end
3133
- #
3134
- # Output:
3135
- #
3136
- # [-1, 1]
3137
- # [1, 2]
3138
- # [2, 3]
3139
- # [3, 4]
3140
- #
3141
- # In this form the passed object can be used as an accumulator:
3142
- #
3143
- # elements.inject(nil, 0) do |total, element|
3144
- # total += element.size
3145
- # end # => 44
3146
- #
3147
- # With both arguments +xpath+ and +initial+ are given,
3148
- # calls the block only with elements matching that xpath:
3149
- #
3150
- # elements.inject('//book [@category="web"]', 0) do |total, element|
3151
- # total += element.size
3152
- # end # => 26
3153
- #
3154
- # source://rexml//lib/rexml/element.rb#2069
3155
- def inject(xpath = T.unsafe(nil), initial = T.unsafe(nil)); end
3156
-
3157
- # :call-seq:
3158
- # parent
3159
- #
3160
- # Returns the parent element cited in creating the \Elements object.
3161
- # This element is also the default starting point for searching
3162
- # in the \Elements object.
3163
- #
3164
- # d = REXML::Document.new(xml_string)
3165
- # elements = REXML::Elements.new(d.root)
3166
- # elements.parent == d.root # => true
3167
- #
3168
- # source://rexml//lib/rexml/element.rb#1619
3169
- def parent; end
3170
-
3171
- # :call-seq:
3172
- # size -> integer
3173
- #
3174
- # Returns the count of \Element children:
3175
- #
3176
- # d = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
3177
- # d.root.elements.size # => 3 # Three elements.
3178
- # d.root.size # => 6 # Three elements plus three text nodes..
3179
- #
3180
- # source://rexml//lib/rexml/element.rb#2093
3181
- def size; end
3182
-
3183
- # :call-seq:
3184
- # to_a(xpath = nil) -> array_of_elements
3185
- #
3186
- # Returns an array of element children (not including non-element children).
3187
- #
3188
- # With no argument, returns an array of all element children:
3189
- #
3190
- # d = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
3191
- # elements = d.root.elements
3192
- # elements.to_a # => [<b/>, <c/>] # Omits non-element children.
3193
- # children = d.root.children
3194
- # children # => ["sean", <b/>, "elliott", <c/>] # Includes non-element children.
3195
- #
3196
- # With argument +xpath+, returns an array of element children
3197
- # that match the xpath:
3198
- #
3199
- # elements.to_a('//c') # => [<c/>]
3200
- #
3201
- # source://rexml//lib/rexml/element.rb#2117
3202
- def to_a(xpath = T.unsafe(nil)); end
3203
-
3204
- private
3205
-
3206
- # Private helper class. Removes quotes from quoted strings
3207
- #
3208
- # source://rexml//lib/rexml/element.rb#2125
3209
- def literalize(name); end
3210
- end
3211
-
3212
- # source://rexml//lib/rexml/encoding.rb#4
3213
- module REXML::Encoding
3214
- # source://rexml//lib/rexml/encoding.rb#29
3215
- def decode(string); end
3216
-
3217
- # source://rexml//lib/rexml/encoding.rb#25
3218
- def encode(string); end
3219
-
3220
- # ID ---> Encoding name
3221
- #
3222
- # source://rexml//lib/rexml/encoding.rb#6
3223
- def encoding; end
3224
-
3225
- # source://rexml//lib/rexml/encoding.rb#7
3226
- def encoding=(encoding); end
3227
-
3228
- private
3229
-
3230
- # source://rexml//lib/rexml/encoding.rb#34
3231
- def find_encoding(name); end
3232
- end
3233
-
3234
- # source://rexml//lib/rexml/entity.rb#7
3235
- class REXML::Entity < ::REXML::Child
3236
- include ::REXML::XMLTokens
3237
-
3238
- # Create a new entity. Simple entities can be constructed by passing a
3239
- # name, value to the constructor; this creates a generic, plain entity
3240
- # reference. For anything more complicated, you have to pass a Source to
3241
- # the constructor with the entity definition, or use the accessor methods.
3242
- # +WARNING+: There is no validation of entity state except when the entity
3243
- # is read from a stream. If you start poking around with the accessors,
3244
- # you can easily create a non-conformant Entity.
3245
- #
3246
- # e = Entity.new( 'amp', '&' )
3247
- #
3248
- # @return [Entity] a new instance of Entity
3249
- #
3250
- # source://rexml//lib/rexml/entity.rb#34
3251
- def initialize(stream, value = T.unsafe(nil), parent = T.unsafe(nil), reference = T.unsafe(nil)); end
3252
-
3253
- # Returns the value of attribute external.
3254
- #
3255
- # source://rexml//lib/rexml/entity.rb#23
3256
- def external; end
3257
-
3258
- # Returns the value of attribute name.
3259
- #
3260
- # source://rexml//lib/rexml/entity.rb#23
3261
- def name; end
3262
-
3263
- # Returns the value of attribute ndata.
3264
- #
3265
- # source://rexml//lib/rexml/entity.rb#23
3266
- def ndata; end
3267
-
3268
- # Returns the value of this entity unprocessed -- raw. This is the
3269
- # normalized value; that is, with all %ent; and &ent; entities intact
3270
- #
3271
- # source://rexml//lib/rexml/entity.rb#86
3272
- def normalized; end
3273
-
3274
- # Returns the value of attribute pubid.
3275
- #
3276
- # source://rexml//lib/rexml/entity.rb#23
3277
- def pubid; end
3278
-
3279
- # Returns the value of attribute ref.
3280
- #
3281
- # source://rexml//lib/rexml/entity.rb#23
3282
- def ref; end
3283
-
3284
- # Returns this entity as a string. See write().
3285
- #
3286
- # source://rexml//lib/rexml/entity.rb#120
3287
- def to_s; end
3288
-
3289
- # Evaluates to the unnormalized value of this entity; that is, replacing
3290
- # &ent; entities.
3291
- #
3292
- # source://rexml//lib/rexml/entity.rb#73
3293
- def unnormalized; end
3294
-
3295
- # Returns the value of attribute value.
3296
- #
3297
- # source://rexml//lib/rexml/entity.rb#23
3298
- def value; end
3299
-
3300
- # Write out a fully formed, correct entity definition (assuming the Entity
3301
- # object itself is valid.)
3302
- #
3303
- # out::
3304
- # An object implementing <TT>&lt;&lt;</TT> to which the entity will be
3305
- # output
3306
- # indent::
3307
- # *DEPRECATED* and ignored
3308
- #
3309
- # source://rexml//lib/rexml/entity.rb#98
3310
- def write(out, indent = T.unsafe(nil)); end
3311
-
3312
- class << self
3313
- # Evaluates whether the given string matches an entity definition,
3314
- # returning true if so, and false otherwise.
3315
- #
3316
- # @return [Boolean]
3317
- #
3318
- # source://rexml//lib/rexml/entity.rb#67
3319
- def matches?(string); end
3320
- end
3321
- end
3322
-
3323
- # source://rexml//lib/rexml/doctype.rb#267
3324
- class REXML::ExternalEntity < ::REXML::Child
3325
- # @return [ExternalEntity] a new instance of ExternalEntity
3326
- #
3327
- # source://rexml//lib/rexml/doctype.rb#268
3328
- def initialize(src); end
3329
-
3330
- # source://rexml//lib/rexml/doctype.rb#272
3331
- def to_s; end
3332
-
3333
- # source://rexml//lib/rexml/doctype.rb#275
3334
- def write(output, indent); end
3335
- end
3336
-
3337
- # source://rexml//lib/rexml/formatters/default.rb#5
3338
- class REXML::Formatters::Default
3339
- # Prints out the XML document with no formatting -- except if ie_hack is
3340
- # set.
3341
- #
3342
- # ie_hack::
3343
- # If set to true, then inserts whitespace before the close of an empty
3344
- # tag, so that IE's bad XML parser doesn't choke.
3345
- #
3346
- # @return [Default] a new instance of Default
3347
- #
3348
- # source://rexml//lib/rexml/formatters/default.rb#12
3349
- def initialize(ie_hack = T.unsafe(nil)); end
3350
-
3351
- # Writes the node to some output.
3352
- #
3353
- # node::
3354
- # The node to write
3355
- # output::
3356
- # A class implementing <TT>&lt;&lt;</TT>. Pass in an Output object to
3357
- # change the output encoding.
3358
- #
3359
- # source://rexml//lib/rexml/formatters/default.rb#23
3360
- def write(node, output); end
3361
-
3362
- protected
3363
-
3364
- # source://rexml//lib/rexml/formatters/default.rb#98
3365
- def write_cdata(node, output); end
3366
-
3367
- # source://rexml//lib/rexml/formatters/default.rb#92
3368
- def write_comment(node, output); end
3369
-
3370
- # source://rexml//lib/rexml/formatters/default.rb#61
3371
- def write_document(node, output); end
3372
-
3373
- # source://rexml//lib/rexml/formatters/default.rb#65
3374
- def write_element(node, output); end
3375
-
3376
- # source://rexml//lib/rexml/formatters/default.rb#104
3377
- def write_instruction(node, output); end
3378
-
3379
- # source://rexml//lib/rexml/formatters/default.rb#88
3380
- def write_text(node, output); end
3381
- end
3382
-
3383
- # Pretty-prints an XML document. This destroys whitespace in text nodes
3384
- # and will insert carriage returns and indentations.
3385
- #
3386
- # TODO: Add an option to print attributes on new lines
3387
- #
3388
- # source://rexml//lib/rexml/formatters/pretty.rb#10
3389
- class REXML::Formatters::Pretty < ::REXML::Formatters::Default
3390
- # Create a new pretty printer.
3391
- #
3392
- # output::
3393
- # An object implementing '<<(String)', to which the output will be written.
3394
- # indentation::
3395
- # An integer greater than 0. The indentation of each level will be
3396
- # this number of spaces. If this is < 1, the behavior of this object
3397
- # is undefined. Defaults to 2.
3398
- # ie_hack::
3399
- # If true, the printer will insert whitespace before closing empty
3400
- # tags, thereby allowing Internet Explorer's XML parser to
3401
- # function. Defaults to false.
3402
- #
3403
- # @return [Pretty] a new instance of Pretty
3404
- #
3405
- # source://rexml//lib/rexml/formatters/pretty.rb#30
3406
- def initialize(indentation = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
3407
-
3408
- # If compact is set to true, then the formatter will attempt to use as
3409
- # little space as possible
3410
- #
3411
- # source://rexml//lib/rexml/formatters/pretty.rb#14
3412
- def compact; end
3413
-
3414
- # If compact is set to true, then the formatter will attempt to use as
3415
- # little space as possible
3416
- #
3417
- # source://rexml//lib/rexml/formatters/pretty.rb#14
3418
- def compact=(_arg0); end
3419
-
3420
- # The width of a page. Used for formatting text
3421
- #
3422
- # source://rexml//lib/rexml/formatters/pretty.rb#16
3423
- def width; end
3424
-
3425
- # The width of a page. Used for formatting text
3426
- #
3427
- # source://rexml//lib/rexml/formatters/pretty.rb#16
3428
- def width=(_arg0); end
3429
-
3430
- protected
3431
-
3432
- # source://rexml//lib/rexml/formatters/pretty.rb#102
3433
- def write_cdata(node, output); end
3434
-
3435
- # source://rexml//lib/rexml/formatters/pretty.rb#97
3436
- def write_comment(node, output); end
3437
-
3438
- # source://rexml//lib/rexml/formatters/pretty.rb#107
3439
- def write_document(node, output); end
3440
-
3441
- # source://rexml//lib/rexml/formatters/pretty.rb#39
3442
- def write_element(node, output); end
3443
-
3444
- # source://rexml//lib/rexml/formatters/pretty.rb#88
3445
- def write_text(node, output); end
3446
-
3447
- private
3448
-
3449
- # source://rexml//lib/rexml/formatters/pretty.rb#124
3450
- def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
3451
-
3452
- # source://rexml//lib/rexml/formatters/pretty.rb#129
3453
- def wrap(string, width); end
3454
- end
3455
-
3456
- # A Source that wraps an IO. See the Source class for method
3457
- # documentation
3458
- #
3459
- # source://rexml//lib/rexml/source.rb#183
3460
- class REXML::IOSource < ::REXML::Source
3461
- # block_size has been deprecated
3462
- #
3463
- # @return [IOSource] a new instance of IOSource
3464
- #
3465
- # source://rexml//lib/rexml/source.rb#187
3466
- def initialize(arg, block_size = T.unsafe(nil), encoding = T.unsafe(nil)); end
3467
-
3468
- # @return the current line in the source
3469
- #
3470
- # source://rexml//lib/rexml/source.rb#275
3471
- def current_line; end
3472
-
3473
- # @return [Boolean]
3474
- #
3475
- # source://rexml//lib/rexml/source.rb#270
3476
- def empty?; end
3477
-
3478
- # source://rexml//lib/rexml/source.rb#247
3479
- def ensure_buffer; end
3480
-
3481
- # source://rexml//lib/rexml/source.rb#251
3482
- def match(pattern, cons = T.unsafe(nil)); end
3483
-
3484
- # source://rexml//lib/rexml/source.rb#208
3485
- def read(term = T.unsafe(nil), min_bytes = T.unsafe(nil)); end
3486
-
3487
- # source://rexml//lib/rexml/source.rb#229
3488
- def read_until(term); end
3489
-
3490
- private
3491
-
3492
- # source://rexml//lib/rexml/source.rb#322
3493
- def encoding_updated; end
3494
-
3495
- # source://rexml//lib/rexml/source.rb#297
3496
- def readline(term = T.unsafe(nil)); end
3497
- end
3498
-
3499
- # Represents an XML Instruction; IE, <? ... ?>
3500
- # TODO: Add parent arg (3rd arg) to constructor
3501
- #
3502
- # source://rexml//lib/rexml/instruction.rb#9
3503
- class REXML::Instruction < ::REXML::Child
3504
- # Constructs a new Instruction
3505
- # the target of this instruction is set to this. If an Instruction,
3506
- # then the Instruction is shallowly cloned (target and content are
3507
- # copied).
3508
- # be a Parent if the target argument is a Source. Otherwise, this
3509
- # String is set as the content of this instruction.
3510
- #
3511
- # @param target can be one of a number of things. If String, then
3512
- # @param content Must be either a String, or a Parent. Can only
3513
- # @return [Instruction] a new instance of Instruction
3514
- #
3515
- # source://rexml//lib/rexml/instruction.rb#25
3516
- def initialize(target, content = T.unsafe(nil)); end
3517
-
3518
- # of the other matches the target and content of this object.
3519
- #
3520
- # @return true if other is an Instruction, and the content and target
3521
- #
3522
- # source://rexml//lib/rexml/instruction.rb#65
3523
- def ==(other); end
3524
-
3525
- # source://rexml//lib/rexml/instruction.rb#44
3526
- def clone; end
3527
-
3528
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3529
- # content is everything else.
3530
- #
3531
- # source://rexml//lib/rexml/instruction.rb#15
3532
- def content; end
3533
-
3534
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3535
- # content is everything else.
3536
- #
3537
- # source://rexml//lib/rexml/instruction.rb#15
3538
- def content=(_arg0); end
3539
-
3540
- # source://rexml//lib/rexml/instruction.rb#75
3541
- def inspect; end
3542
-
3543
- # source://rexml//lib/rexml/instruction.rb#71
3544
- def node_type; end
3545
-
3546
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3547
- # content is everything else.
3548
- #
3549
- # source://rexml//lib/rexml/instruction.rb#15
3550
- def target; end
3551
-
3552
- # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
3553
- # content is everything else.
3554
- #
3555
- # source://rexml//lib/rexml/instruction.rb#15
3556
- def target=(_arg0); end
3557
-
3558
- # == DEPRECATED
3559
- # See the rexml/formatters package
3560
- #
3561
- # source://rexml//lib/rexml/instruction.rb#51
3562
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
3563
- end
3564
-
3565
- # Adds named attributes to an object.
3566
- #
3567
- # source://rexml//lib/rexml/namespace.rb#7
3568
- module REXML::Namespace
3569
- include ::REXML::XMLTokens
3570
-
3571
- # The name of the object, valid if set
3572
- #
3573
- # source://rexml//lib/rexml/namespace.rb#9
3574
- def expanded_name; end
3575
-
3576
- # Fully expand the name, even if the prefix wasn't specified in the
3577
- # source file.
3578
- #
3579
- # source://rexml//lib/rexml/namespace.rb#57
3580
- def fully_expanded_name; end
3581
-
3582
- # Compares names optionally WITH namespaces
3583
- #
3584
- # @return [Boolean]
3585
- #
3586
- # source://rexml//lib/rexml/namespace.rb#43
3587
- def has_name?(other, ns = T.unsafe(nil)); end
3588
-
3589
- # The name of the object, valid if set
3590
- #
3591
- # source://rexml//lib/rexml/namespace.rb#9
3592
- def name; end
3593
-
3594
- # Sets the name and the expanded name
3595
- #
3596
- # source://rexml//lib/rexml/namespace.rb#17
3597
- def name=(name); end
3598
-
3599
- # The expanded name of the object, valid if name is set
3600
- #
3601
- # source://rexml//lib/rexml/namespace.rb#11
3602
- def prefix; end
3603
-
3604
- # The expanded name of the object, valid if name is set
3605
- #
3606
- # source://rexml//lib/rexml/namespace.rb#11
3607
- def prefix=(_arg0); end
3608
- end
3609
-
3610
- # source://rexml//lib/rexml/namespace.rb#13
3611
- REXML::Namespace::NAME_WITHOUT_NAMESPACE = T.let(T.unsafe(nil), Regexp)
3612
-
3613
- # source://rexml//lib/rexml/doctype.rb#280
3614
- class REXML::NotationDecl < ::REXML::Child
3615
- # @return [NotationDecl] a new instance of NotationDecl
3616
- #
3617
- # source://rexml//lib/rexml/doctype.rb#282
3618
- def initialize(name, middle, pub, sys); end
3619
-
3620
- # This method retrieves the name of the notation.
3621
- #
3622
- # Method contributed by Henrik Martensson
3623
- #
3624
- # source://rexml//lib/rexml/doctype.rb#307
3625
- def name; end
3626
-
3627
- # Returns the value of attribute public.
3628
- #
3629
- # source://rexml//lib/rexml/doctype.rb#281
3630
- def public; end
3631
-
3632
- # Sets the attribute public
3633
- #
3634
- # @param value the value to set the attribute public to.
3635
- #
3636
- # source://rexml//lib/rexml/doctype.rb#281
3637
- def public=(_arg0); end
3638
-
3639
- # Returns the value of attribute system.
3640
- #
3641
- # source://rexml//lib/rexml/doctype.rb#281
3642
- def system; end
3643
-
3644
- # Sets the attribute system
3645
- #
3646
- # @param value the value to set the attribute system to.
3647
- #
3648
- # source://rexml//lib/rexml/doctype.rb#281
3649
- def system=(_arg0); end
3650
-
3651
- # source://rexml//lib/rexml/doctype.rb#290
3652
- def to_s; end
3653
-
3654
- # source://rexml//lib/rexml/doctype.rb#300
3655
- def write(output, indent = T.unsafe(nil)); end
3656
- end
3657
-
3658
- # source://rexml//lib/rexml/output.rb#5
3659
- class REXML::Output
3660
- include ::REXML::Encoding
3661
-
3662
- # @return [Output] a new instance of Output
3663
- #
3664
- # source://rexml//lib/rexml/output.rb#10
3665
- def initialize(real_IO, encd = T.unsafe(nil)); end
3666
-
3667
- # source://rexml//lib/rexml/output.rb#22
3668
- def <<(content); end
3669
-
3670
- # Returns the value of attribute encoding.
3671
- #
3672
- # source://rexml//lib/rexml/output.rb#8
3673
- def encoding; end
3674
-
3675
- # source://rexml//lib/rexml/output.rb#26
3676
- def to_s; end
3677
- end
3678
-
3679
- # A parent has children, and has methods for accessing them. The Parent
3680
- # class is never encountered except as the superclass for some other
3681
- # object.
3682
- #
3683
- # source://rexml//lib/rexml/parent.rb#8
3684
- class REXML::Parent < ::REXML::Child
3685
- include ::Enumerable
3686
-
3687
- # Constructor
3688
- #
3689
- # @param parent if supplied, will be set as the parent of this object
3690
- # @return [Parent] a new instance of Parent
3691
- #
3692
- # source://rexml//lib/rexml/parent.rb#13
3693
- def initialize(parent = T.unsafe(nil)); end
3694
-
3695
- # source://rexml//lib/rexml/parent.rb#18
3696
- def <<(object); end
3697
-
3698
- # Fetches a child at a given index
3699
- #
3700
- # @param index the Integer index of the child to fetch
3701
- #
3702
- # source://rexml//lib/rexml/parent.rb#57
3703
- def [](index); end
3704
-
3705
- # Set an index entry. See Array.[]=
3706
- #
3707
- # @param index the index of the element to set
3708
- # @param opt either the object to set, or an Integer length
3709
- # @param child if opt is an Integer, this is the child to set
3710
- # @return the parent (self)
3711
- #
3712
- # source://rexml//lib/rexml/parent.rb#70
3713
- def []=(*args); end
3714
-
3715
- # source://rexml//lib/rexml/parent.rb#18
3716
- def add(object); end
3717
-
3718
- # source://rexml//lib/rexml/parent.rb#115
3719
- def children; end
3720
-
3721
- # Deeply clones this object. This creates a complete duplicate of this
3722
- # Parent, including all descendants.
3723
- #
3724
- # source://rexml//lib/rexml/parent.rb#148
3725
- def deep_clone; end
3726
-
3727
- # source://rexml//lib/rexml/parent.rb#32
3728
- def delete(object); end
3729
-
3730
- # source://rexml//lib/rexml/parent.rb#47
3731
- def delete_at(index); end
3732
-
3733
- # source://rexml//lib/rexml/parent.rb#43
3734
- def delete_if(&block); end
3735
-
3736
- # source://rexml//lib/rexml/parent.rb#39
3737
- def each(&block); end
3738
-
3739
- # source://rexml//lib/rexml/parent.rb#39
3740
- def each_child(&block); end
3741
-
3742
- # source://rexml//lib/rexml/parent.rb#51
3743
- def each_index(&block); end
3744
-
3745
- # Fetches the index of a given child
3746
- # of this parent.
3747
- #
3748
- # @param child the child to get the index of
3749
- # @return the index of the child, or nil if the object is not a child
3750
- #
3751
- # source://rexml//lib/rexml/parent.rb#123
3752
- def index(child); end
3753
-
3754
- # Inserts an child after another child
3755
- # child2 will be inserted after child1 in the child list of the parent.
3756
- # If an xpath, child2 will be inserted after the first child to match
3757
- # the xpath.
3758
- #
3759
- # @param child1 this is either an xpath or an Element. If an Element,
3760
- # @param child2 the child to insert
3761
- # @return the parent (self)
3762
- #
3763
- # source://rexml//lib/rexml/parent.rb#102
3764
- def insert_after(child1, child2); end
3765
-
3766
- # Inserts an child before another child
3767
- # child2 will be inserted before child1 in the child list of the parent.
3768
- # If an xpath, child2 will be inserted before the first child to match
3769
- # the xpath.
3770
- #
3771
- # @param child1 this is either an xpath or an Element. If an Element,
3772
- # @param child2 the child to insert
3773
- # @return the parent (self)
3774
- #
3775
- # source://rexml//lib/rexml/parent.rb#82
3776
- def insert_before(child1, child2); end
3777
-
3778
- # @return the number of children of this parent
3779
- #
3780
- # source://rexml//lib/rexml/parent.rb#130
3781
- def length; end
3782
-
3783
- # @return [Boolean]
3784
- #
3785
- # source://rexml//lib/rexml/parent.rb#162
3786
- def parent?; end
3787
-
3788
- # source://rexml//lib/rexml/parent.rb#18
3789
- def push(object); end
3790
-
3791
- # Replaces one child with another, making sure the nodelist is correct
3792
- # Child)
3793
- #
3794
- # @param to_replace the child to replace (must be a Child)
3795
- # @param replacement the child to insert into the nodelist (must be a
3796
- #
3797
- # source://rexml//lib/rexml/parent.rb#140
3798
- def replace_child(to_replace, replacement); end
3799
-
3800
- # @return the number of children of this parent
3801
- #
3802
- # source://rexml//lib/rexml/parent.rb#130
3803
- def size; end
3804
-
3805
- # source://rexml//lib/rexml/parent.rb#115
3806
- def to_a; end
3807
-
3808
- # source://rexml//lib/rexml/parent.rb#27
3809
- def unshift(object); end
3810
- end
3811
-
3812
- # source://rexml//lib/rexml/parseexception.rb#3
3813
- class REXML::ParseException < ::RuntimeError
3814
- # @return [ParseException] a new instance of ParseException
3815
- #
3816
- # source://rexml//lib/rexml/parseexception.rb#6
3817
- def initialize(message, source = T.unsafe(nil), parser = T.unsafe(nil), exception = T.unsafe(nil)); end
3818
-
3819
- # source://rexml//lib/rexml/parseexception.rb#49
3820
- def context; end
3821
-
3822
- # Returns the value of attribute continued_exception.
3823
- #
3824
- # source://rexml//lib/rexml/parseexception.rb#4
3825
- def continued_exception; end
3826
-
3827
- # Sets the attribute continued_exception
3828
- #
3829
- # @param value the value to set the attribute continued_exception to.
3830
- #
3831
- # source://rexml//lib/rexml/parseexception.rb#4
3832
- def continued_exception=(_arg0); end
3833
-
3834
- # source://rexml//lib/rexml/parseexception.rb#44
3835
- def line; end
3836
-
3837
- # Returns the value of attribute parser.
3838
- #
3839
- # source://rexml//lib/rexml/parseexception.rb#4
3840
- def parser; end
3841
-
3842
- # Sets the attribute parser
3843
- #
3844
- # @param value the value to set the attribute parser to.
3845
- #
3846
- # source://rexml//lib/rexml/parseexception.rb#4
3847
- def parser=(_arg0); end
3848
-
3849
- # source://rexml//lib/rexml/parseexception.rb#39
3850
- def position; end
3851
-
3852
- # Returns the value of attribute source.
3853
- #
3854
- # source://rexml//lib/rexml/parseexception.rb#4
3855
- def source; end
3856
-
3857
- # Sets the attribute source
3858
- #
3859
- # @param value the value to set the attribute source to.
3860
- #
3861
- # source://rexml//lib/rexml/parseexception.rb#4
3862
- def source=(_arg0); end
3863
-
3864
- # source://rexml//lib/rexml/parseexception.rb#13
3865
- def to_s; end
3866
- end
3867
-
3868
- # = Using the Pull Parser
3869
- # <em>This API is experimental, and subject to change.</em>
3870
- # parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
3871
- # while parser.has_next?
3872
- # res = parser.next
3873
- # puts res[1]['att'] if res.start_tag? and res[0] == 'b'
3874
- # end
3875
- # See the PullEvent class for information on the content of the results.
3876
- # The data is identical to the arguments passed for the various events to
3877
- # the StreamListener API.
3878
- #
3879
- # Notice that:
3880
- # parser = PullParser.new( "<a>BAD DOCUMENT" )
3881
- # while parser.has_next?
3882
- # res = parser.next
3883
- # raise res[1] if res.error?
3884
- # end
3885
- #
3886
- # Nat Price gave me some good ideas for the API.
3887
- #
3888
- # source://rexml//lib/rexml/parsers/baseparser.rb#57
3889
- class REXML::Parsers::BaseParser
3890
- # @return [BaseParser] a new instance of BaseParser
3891
- #
3892
- # source://rexml//lib/rexml/parsers/baseparser.rb#163
3893
- def initialize(source); end
3894
-
3895
- # source://rexml//lib/rexml/parsers/baseparser.rb#173
3896
- def add_listener(listener); end
3897
-
3898
- # Returns true if there are no more events
3899
- #
3900
- # @return [Boolean]
3901
- #
3902
- # source://rexml//lib/rexml/parsers/baseparser.rb#204
3903
- def empty?; end
3904
-
3905
- # source://rexml//lib/rexml/parsers/baseparser.rb#536
3906
- def entity(reference, entities); end
3907
-
3908
- # Returns the value of attribute entity_expansion_count.
3909
- #
3910
- # source://rexml//lib/rexml/parsers/baseparser.rb#178
3911
- def entity_expansion_count; end
3912
-
3913
- # Sets the attribute entity_expansion_limit
3914
- #
3915
- # @param value the value to set the attribute entity_expansion_limit to.
3916
- #
3917
- # source://rexml//lib/rexml/parsers/baseparser.rb#179
3918
- def entity_expansion_limit=(_arg0); end
3919
-
3920
- # Sets the attribute entity_expansion_text_limit
3921
- #
3922
- # @param value the value to set the attribute entity_expansion_text_limit to.
3923
- #
3924
- # source://rexml//lib/rexml/parsers/baseparser.rb#180
3925
- def entity_expansion_text_limit=(_arg0); end
3926
-
3927
- # Returns true if there are more events. Synonymous with !empty?
3928
- #
3929
- # @return [Boolean]
3930
- #
3931
- # source://rexml//lib/rexml/parsers/baseparser.rb#209
3932
- def has_next?; end
3933
-
3934
- # Escapes all possible entities
3935
- #
3936
- # source://rexml//lib/rexml/parsers/baseparser.rb#547
3937
- def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
3938
-
3939
- # Peek at the +depth+ event in the stack. The first element on the stack
3940
- # is at depth 0. If +depth+ is -1, will parse to the end of the input
3941
- # stream and return the last event, which is always :end_document.
3942
- # Be aware that this causes the stream to be parsed up to the +depth+
3943
- # event, so you can effectively pre-parse the entire document (pull the
3944
- # entire thing into memory) using this method.
3945
- #
3946
- # source://rexml//lib/rexml/parsers/baseparser.rb#225
3947
- def peek(depth = T.unsafe(nil)); end
3948
-
3949
- # source://rexml//lib/rexml/parsers/baseparser.rb#194
3950
- def position; end
3951
-
3952
- # Returns the next event. This is a +PullEvent+ object.
3953
- #
3954
- # source://rexml//lib/rexml/parsers/baseparser.rb#240
3955
- def pull; end
3956
-
3957
- # Returns the value of attribute source.
3958
- #
3959
- # source://rexml//lib/rexml/parsers/baseparser.rb#177
3960
- def source; end
3961
-
3962
- # source://rexml//lib/rexml/parsers/baseparser.rb#182
3963
- def stream=(source); end
3964
-
3965
- # Unescapes all possible entities
3966
- #
3967
- # source://rexml//lib/rexml/parsers/baseparser.rb#563
3968
- def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end
3969
-
3970
- # Push an event back on the head of the stream. This method
3971
- # has (theoretically) infinite depth.
3972
- #
3973
- # source://rexml//lib/rexml/parsers/baseparser.rb#215
3974
- def unshift(token); end
3975
-
3976
- private
3977
-
3978
- # source://rexml//lib/rexml/parsers/baseparser.rb#612
3979
- def add_namespace(prefix, uri); end
3980
-
3981
- # @return [Boolean]
3982
- #
3983
- # source://rexml//lib/rexml/parsers/baseparser.rb#645
3984
- def need_source_encoding_update?(xml_declaration_encoding); end
3985
-
3986
- # source://rexml//lib/rexml/parsers/baseparser.rb#765
3987
- def parse_attributes(prefixes); end
3988
-
3989
- # source://rexml//lib/rexml/parsers/baseparser.rb#664
3990
- def parse_id(base_error_message, accept_external_id:, accept_public_id:); end
3991
-
3992
- # source://rexml//lib/rexml/parsers/baseparser.rb#692
3993
- def parse_id_invalid_details(accept_external_id:, accept_public_id:); end
3994
-
3995
- # source://rexml//lib/rexml/parsers/baseparser.rb#651
3996
- def parse_name(base_error_message); end
3997
-
3998
- # source://rexml//lib/rexml/parsers/baseparser.rb#627
3999
- def pop_namespaces_restore; end
4000
-
4001
- # source://rexml//lib/rexml/parsers/baseparser.rb#730
4002
- def process_instruction; end
4003
-
4004
- # source://rexml//lib/rexml/parsers/baseparser.rb#250
4005
- def pull_event; end
4006
-
4007
- # source://rexml//lib/rexml/parsers/baseparser.rb#621
4008
- def push_namespaces_restore; end
4009
-
4010
- # source://rexml//lib/rexml/parsers/baseparser.rb#638
4011
- def record_entity_expansion(delta = T.unsafe(nil)); end
4012
- end
4013
-
4014
- # source://rexml//lib/rexml/parsers/baseparser.rb#130
4015
- REXML::Parsers::BaseParser::EXTERNAL_ID_PUBLIC = T.let(T.unsafe(nil), Regexp)
4016
-
4017
- # source://rexml//lib/rexml/parsers/baseparser.rb#131
4018
- REXML::Parsers::BaseParser::EXTERNAL_ID_SYSTEM = T.let(T.unsafe(nil), Regexp)
4019
-
4020
- # source://rexml//lib/rexml/parsers/baseparser.rb#132
4021
- REXML::Parsers::BaseParser::PUBLIC_ID = T.let(T.unsafe(nil), Regexp)
4022
-
4023
- # source://rexml//lib/rexml/parsers/baseparser.rb#143
4024
- module REXML::Parsers::BaseParser::Private; end
4025
-
4026
- # source://rexml//lib/rexml/parsers/baseparser.rb#147
4027
- REXML::Parsers::BaseParser::Private::ATTLISTDECL_END = T.let(T.unsafe(nil), Regexp)
4028
-
4029
- # source://rexml//lib/rexml/parsers/baseparser.rb#152
4030
- REXML::Parsers::BaseParser::Private::CARRIAGE_RETURN_NEWLINE_PATTERN = T.let(T.unsafe(nil), Regexp)
4031
-
4032
- # source://rexml//lib/rexml/parsers/baseparser.rb#153
4033
- REXML::Parsers::BaseParser::Private::CHARACTER_REFERENCES = T.let(T.unsafe(nil), Regexp)
4034
-
4035
- # source://rexml//lib/rexml/parsers/baseparser.rb#146
4036
- REXML::Parsers::BaseParser::Private::CLOSE_PATTERN = T.let(T.unsafe(nil), Regexp)
4037
-
4038
- # source://rexml//lib/rexml/parsers/baseparser.rb#154
4039
- REXML::Parsers::BaseParser::Private::DEFAULT_ENTITIES_PATTERNS = T.let(T.unsafe(nil), Hash)
4040
-
4041
- # source://rexml//lib/rexml/parsers/baseparser.rb#151
4042
- REXML::Parsers::BaseParser::Private::ENTITYDECL_PATTERN = T.let(T.unsafe(nil), Regexp)
4043
-
4044
- # source://rexml//lib/rexml/parsers/baseparser.rb#149
4045
- REXML::Parsers::BaseParser::Private::GEDECL_PATTERN = T.let(T.unsafe(nil), String)
4046
-
4047
- # source://rexml//lib/rexml/parsers/baseparser.rb#148
4048
- REXML::Parsers::BaseParser::Private::NAME_PATTERN = T.let(T.unsafe(nil), Regexp)
4049
-
4050
- # source://rexml//lib/rexml/parsers/baseparser.rb#150
4051
- REXML::Parsers::BaseParser::Private::PEDECL_PATTERN = T.let(T.unsafe(nil), String)
4052
-
4053
- # source://rexml//lib/rexml/parsers/baseparser.rb#144
4054
- REXML::Parsers::BaseParser::Private::PEREFERENCE_PATTERN = T.let(T.unsafe(nil), Regexp)
4055
-
4056
- # source://rexml//lib/rexml/parsers/baseparser.rb#145
4057
- REXML::Parsers::BaseParser::Private::TAG_PATTERN = T.let(T.unsafe(nil), Regexp)
4058
-
4059
- # source://rexml//lib/rexml/parsers/baseparser.rb#159
4060
- REXML::Parsers::BaseParser::Private::XML_PREFIXED_NAMESPACE = T.let(T.unsafe(nil), String)
4061
-
4062
- # source://rexml//lib/rexml/parsers/baseparser.rb#66
4063
- REXML::Parsers::BaseParser::QNAME = T.let(T.unsafe(nil), Regexp)
4064
-
4065
- # source://rexml//lib/rexml/parsers/baseparser.rb#65
4066
- REXML::Parsers::BaseParser::QNAME_STR = T.let(T.unsafe(nil), String)
4067
-
4068
- # source://rexml//lib/rexml/parsers/streamparser.rb#6
4069
- class REXML::Parsers::StreamParser
4070
- # @return [StreamParser] a new instance of StreamParser
4071
- #
4072
- # source://rexml//lib/rexml/parsers/streamparser.rb#7
4073
- def initialize(source, listener); end
4074
-
4075
- # source://rexml//lib/rexml/parsers/streamparser.rb#13
4076
- def add_listener(listener); end
4077
-
4078
- # source://rexml//lib/rexml/parsers/streamparser.rb#17
4079
- def entity_expansion_count; end
4080
-
4081
- # source://rexml//lib/rexml/parsers/streamparser.rb#21
4082
- def entity_expansion_limit=(limit); end
4083
-
4084
- # source://rexml//lib/rexml/parsers/streamparser.rb#25
4085
- def entity_expansion_text_limit=(limit); end
4086
-
4087
- # source://rexml//lib/rexml/parsers/streamparser.rb#29
4088
- def parse; end
4089
- end
4090
-
4091
- # source://rexml//lib/rexml/parsers/baseparser.rb#28
4092
- module REXML::Parsers::StringScannerCaptures; end
4093
-
4094
- # source://rexml//lib/rexml/parsers/treeparser.rb#7
4095
- class REXML::Parsers::TreeParser
4096
- # @return [TreeParser] a new instance of TreeParser
4097
- #
4098
- # source://rexml//lib/rexml/parsers/treeparser.rb#8
4099
- def initialize(source, build_context = T.unsafe(nil)); end
4100
-
4101
- # source://rexml//lib/rexml/parsers/treeparser.rb#13
4102
- def add_listener(listener); end
4103
-
4104
- # source://rexml//lib/rexml/parsers/treeparser.rb#17
4105
- def parse; end
4106
- end
4107
-
4108
- # You don't want to use this class. Really. Use XPath, which is a wrapper
4109
- # for this class. Believe me. You don't want to poke around in here.
4110
- # There is strange, dark magic at work in this code. Beware. Go back! Go
4111
- # back while you still can!
4112
- #
4113
- # source://rexml//lib/rexml/parsers/xpathparser.rb#12
4114
- class REXML::Parsers::XPathParser
4115
- include ::REXML::XMLTokens
4116
-
4117
- # source://rexml//lib/rexml/parsers/xpathparser.rb#42
4118
- def abbreviate(path_or_parsed); end
4119
-
4120
- # source://rexml//lib/rexml/parsers/xpathparser.rb#132
4121
- def expand(path_or_parsed); end
4122
-
4123
- # source://rexml//lib/rexml/parsers/xpathparser.rb#16
4124
- def namespaces=(namespaces); end
4125
-
4126
- # source://rexml//lib/rexml/parsers/xpathparser.rb#21
4127
- def parse(path); end
4128
-
4129
- # For backward compatibility
4130
- #
4131
- # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4132
- def preciate_to_string(parsed, &block); end
4133
-
4134
- # source://rexml//lib/rexml/parsers/xpathparser.rb#36
4135
- def predicate(path); end
4136
-
4137
- # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4138
- def predicate_to_path(parsed, &block); end
4139
-
4140
- private
4141
-
4142
- # | AdditiveExpr ('+' | '-') MultiplicativeExpr
4143
- # | MultiplicativeExpr
4144
- #
4145
- # source://rexml//lib/rexml/parsers/xpathparser.rb#505
4146
- def AdditiveExpr(path, parsed); end
4147
-
4148
- # | AndExpr S 'and' S EqualityExpr
4149
- # | EqualityExpr
4150
- #
4151
- # source://rexml//lib/rexml/parsers/xpathparser.rb#438
4152
- def AndExpr(path, parsed); end
4153
-
4154
- # | EqualityExpr ('=' | '!=') RelationalExpr
4155
- # | RelationalExpr
4156
- #
4157
- # source://rexml//lib/rexml/parsers/xpathparser.rb#457
4158
- def EqualityExpr(path, parsed); end
4159
-
4160
- # | FilterExpr Predicate
4161
- # | PrimaryExpr
4162
- #
4163
- # source://rexml//lib/rexml/parsers/xpathparser.rb#608
4164
- def FilterExpr(path, parsed); end
4165
-
4166
- # | FUNCTION_NAME '(' ( expr ( ',' expr )* )? ')'
4167
- #
4168
- # source://rexml//lib/rexml/parsers/xpathparser.rb#663
4169
- def FunctionCall(rest, parsed); end
4170
-
4171
- # LocationPath
4172
- # | RelativeLocationPath
4173
- # | '/' RelativeLocationPath?
4174
- # | '//' RelativeLocationPath
4175
- #
4176
- # source://rexml//lib/rexml/parsers/xpathparser.rb#243
4177
- def LocationPath(path, parsed); end
4178
-
4179
- # | MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr
4180
- # | UnaryExpr
4181
- #
4182
- # source://rexml//lib/rexml/parsers/xpathparser.rb#528
4183
- def MultiplicativeExpr(path, parsed); end
4184
-
4185
- # source://rexml//lib/rexml/parsers/xpathparser.rb#343
4186
- def NodeTest(path, parsed); end
4187
-
4188
- # | OrExpr S 'or' S AndExpr
4189
- # | AndExpr
4190
- #
4191
- # source://rexml//lib/rexml/parsers/xpathparser.rb#419
4192
- def OrExpr(path, parsed); end
4193
-
4194
- # | LocationPath
4195
- # | FilterExpr ('/' | '//') RelativeLocationPath
4196
- #
4197
- # source://rexml//lib/rexml/parsers/xpathparser.rb#590
4198
- def PathExpr(path, parsed); end
4199
-
4200
- # Filters the supplied nodeset on the predicate(s)
4201
- #
4202
- # source://rexml//lib/rexml/parsers/xpathparser.rb#395
4203
- def Predicate(path, parsed); end
4204
-
4205
- # source://rexml//lib/rexml/parsers/xpathparser.rb#626
4206
- def PrimaryExpr(path, parsed); end
4207
-
4208
- # | RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr
4209
- # | AdditiveExpr
4210
- #
4211
- # source://rexml//lib/rexml/parsers/xpathparser.rb#480
4212
- def RelationalExpr(path, parsed); end
4213
-
4214
- # source://rexml//lib/rexml/parsers/xpathparser.rb#267
4215
- def RelativeLocationPath(path, parsed); end
4216
-
4217
- # | '-' UnaryExpr
4218
- # | UnionExpr
4219
- #
4220
- # source://rexml//lib/rexml/parsers/xpathparser.rb#553
4221
- def UnaryExpr(path, parsed); end
4222
-
4223
- # | UnionExpr '|' PathExpr
4224
- # | PathExpr
4225
- #
4226
- # source://rexml//lib/rexml/parsers/xpathparser.rb#571
4227
- def UnionExpr(path, parsed); end
4228
-
4229
- # get_group( '[foo]bar' ) -> ['bar', '[foo]']
4230
- #
4231
- # source://rexml//lib/rexml/parsers/xpathparser.rb#676
4232
- def get_group(string); end
4233
-
4234
- # source://rexml//lib/rexml/parsers/xpathparser.rb#694
4235
- def parse_args(string); end
4236
-
4237
- # source://rexml//lib/rexml/parsers/xpathparser.rb#224
4238
- def quote_literal(literal); end
4239
- end
4240
-
4241
- # source://rexml//lib/rexml/parsers/xpathparser.rb#339
4242
- REXML::Parsers::XPathParser::LOCAL_NAME_WILDCARD = T.let(T.unsafe(nil), Regexp)
4243
-
4244
- # Returns a 1-1 map of the nodeset
4245
- # The contents of the resulting array are either:
4246
- # true/false, if a positive match
4247
- # String, if a name match
4248
- # NodeTest
4249
- # | ('*' | NCNAME ':' '*' | QNAME) NameTest
4250
- # | '*' ':' NCNAME NameTest since XPath 2.0
4251
- # | NODE_TYPE '(' ')' NodeType
4252
- # | PI '(' LITERAL ')' PI
4253
- # | '[' expr ']' Predicate
4254
- #
4255
- # source://rexml//lib/rexml/parsers/xpathparser.rb#338
4256
- REXML::Parsers::XPathParser::PREFIX_WILDCARD = T.let(T.unsafe(nil), Regexp)
4257
-
4258
- # source://rexml//lib/rexml/doctype.rb#10
4259
- class REXML::ReferenceWriter
4260
- # @return [ReferenceWriter] a new instance of ReferenceWriter
4261
- #
4262
- # source://rexml//lib/rexml/doctype.rb#11
4263
- def initialize(id_type, public_id_literal, system_literal, context = T.unsafe(nil)); end
4264
-
4265
- # source://rexml//lib/rexml/doctype.rb#25
4266
- def write(output); end
4267
- end
4268
-
4269
- # A Source can be searched for patterns, and wraps buffers and other
4270
- # objects and provides consumption of text
4271
- #
4272
- # source://rexml//lib/rexml/source.rb#51
4273
- class REXML::Source
4274
- include ::REXML::Encoding
4275
-
4276
- # Constructor
4277
- # value, overriding all encoding detection
4278
- #
4279
- # @param arg must be a String, and should be a valid XML document
4280
- # @param encoding if non-null, sets the encoding of the source to this
4281
- # @return [Source] a new instance of Source
4282
- #
4283
- # source://rexml//lib/rexml/source.rb#71
4284
- def initialize(arg, encoding = T.unsafe(nil)); end
4285
-
4286
- # The current buffer (what we're going to read next)
4287
- #
4288
- # source://rexml//lib/rexml/source.rb#84
4289
- def buffer; end
4290
-
4291
- # source://rexml//lib/rexml/source.rb#94
4292
- def buffer_encoding=(encoding); end
4293
-
4294
- # @return the current line in the source
4295
- #
4296
- # source://rexml//lib/rexml/source.rb#143
4297
- def current_line; end
4298
-
4299
- # source://rexml//lib/rexml/source.rb#88
4300
- def drop_parsed_content; end
4301
-
4302
- # @return [Boolean] true if the Source is exhausted
4303
- #
4304
- # source://rexml//lib/rexml/source.rb#138
4305
- def empty?; end
4306
-
4307
- # Returns the value of attribute encoding.
4308
- #
4309
- # source://rexml//lib/rexml/source.rb#55
4310
- def encoding; end
4311
-
4312
- # Inherited from Encoding
4313
- # Overridden to support optimized en/decoding
4314
- #
4315
- # source://rexml//lib/rexml/source.rb#100
4316
- def encoding=(enc); end
4317
-
4318
- # source://rexml//lib/rexml/source.rb#118
4319
- def ensure_buffer; end
4320
-
4321
- # The line number of the last consumed text
4322
- #
4323
- # source://rexml//lib/rexml/source.rb#54
4324
- def line; end
4325
-
4326
- # source://rexml//lib/rexml/source.rb#121
4327
- def match(pattern, cons = T.unsafe(nil)); end
4328
-
4329
- # source://rexml//lib/rexml/source.rb#129
4330
- def position; end
4331
-
4332
- # source://rexml//lib/rexml/source.rb#133
4333
- def position=(pos); end
4334
-
4335
- # source://rexml//lib/rexml/source.rb#105
4336
- def read(term = T.unsafe(nil)); end
4337
-
4338
- # source://rexml//lib/rexml/source.rb#108
4339
- def read_until(term); end
4340
-
4341
- private
4342
-
4343
- # source://rexml//lib/rexml/source.rb#152
4344
- def detect_encoding; end
4345
-
4346
- # source://rexml//lib/rexml/source.rb#170
4347
- def encoding_updated; end
4348
- end
4349
-
4350
- # source://rexml//lib/rexml/source.rb#57
4351
- module REXML::Source::Private; end
4352
-
4353
- # source://rexml//lib/rexml/source.rb#59
4354
- REXML::Source::Private::PRE_DEFINED_TERM_PATTERNS = T.let(T.unsafe(nil), Hash)
4355
-
4356
- # source://rexml//lib/rexml/source.rb#58
4357
- REXML::Source::Private::SCANNER_RESET_SIZE = T.let(T.unsafe(nil), Integer)
4358
-
4359
- # Represents text nodes in an XML document
4360
- #
4361
- # source://rexml//lib/rexml/text.rb#11
4362
- class REXML::Text < ::REXML::Child
4363
- include ::Comparable
4364
-
4365
- # Constructor
4366
- # +arg+ if a String, the content is set to the String. If a Text,
4367
- # the object is shallowly cloned.
4368
- #
4369
- # +respect_whitespace+ (boolean, false) if true, whitespace is
4370
- # respected
4371
- #
4372
- # +parent+ (nil) if this is a Parent object, the parent
4373
- # will be set to this.
4374
- #
4375
- # +raw+ (nil) This argument can be given three values.
4376
- # If true, then the value of used to construct this object is expected to
4377
- # contain no unescaped XML markup, and REXML will not change the text. If
4378
- # this value is false, the string may contain any characters, and REXML will
4379
- # escape any and all defined entities whose values are contained in the
4380
- # text. If this value is nil (the default), then the raw value of the
4381
- # parent will be used as the raw value for this node. If there is no raw
4382
- # value for the parent, and no value is supplied, the default is false.
4383
- # Use this field if you have entities defined for some text, and you don't
4384
- # want REXML to escape that text in output.
4385
- # Text.new( "<&", false, nil, false ) #-> "&lt;&amp;"
4386
- # Text.new( "&lt;&amp;", false, nil, false ) #-> "&amp;lt;&amp;amp;"
4387
- # Text.new( "<&", false, nil, true ) #-> Parse exception
4388
- # Text.new( "&lt;&amp;", false, nil, true ) #-> "&lt;&amp;"
4389
- # # Assume that the entity "s" is defined to be "sean"
4390
- # # and that the entity "r" is defined to be "russell"
4391
- # Text.new( "sean russell" ) #-> "&s; &r;"
4392
- # Text.new( "sean russell", false, nil, true ) #-> "sean russell"
4393
- #
4394
- # +entity_filter+ (nil) This can be an array of entities to match in the
4395
- # supplied text. This argument is only useful if +raw+ is set to false.
4396
- # Text.new( "sean russell", false, nil, false, ["s"] ) #-> "&s; russell"
4397
- # Text.new( "sean russell", false, nil, true, ["s"] ) #-> "sean russell"
4398
- # In the last example, the +entity_filter+ argument is ignored.
4399
- #
4400
- # +illegal+ INTERNAL USE ONLY
4401
- #
4402
- # @return [Text] a new instance of Text
4403
- #
4404
- # source://rexml//lib/rexml/text.rb#94
4405
- def initialize(arg, respect_whitespace = T.unsafe(nil), parent = T.unsafe(nil), raw = T.unsafe(nil), entity_filter = T.unsafe(nil), illegal = T.unsafe(nil)); end
4406
-
4407
- # Appends text to this text node. The text is appended in the +raw+ mode
4408
- # of this text node.
4409
- #
4410
- # +returns+ the text itself to enable method chain like
4411
- # 'text << "XXX" << "YYY"'.
4412
- #
4413
- # source://rexml//lib/rexml/text.rb#214
4414
- def <<(to_append); end
4415
-
4416
- # +other+ a String or a Text
4417
- # +returns+ the result of (to_s <=> arg.to_s)
4418
- #
4419
- # source://rexml//lib/rexml/text.rb#223
4420
- def <=>(other); end
4421
-
4422
- # source://rexml//lib/rexml/text.rb#204
4423
- def clone; end
4424
-
4425
- # source://rexml//lib/rexml/text.rb#227
4426
- def doctype; end
4427
-
4428
- # @return [Boolean]
4429
- #
4430
- # source://rexml//lib/rexml/text.rb#199
4431
- def empty?; end
4432
-
4433
- # source://rexml//lib/rexml/text.rb#299
4434
- def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
4435
-
4436
- # source://rexml//lib/rexml/text.rb#253
4437
- def inspect; end
4438
-
4439
- # source://rexml//lib/rexml/text.rb#195
4440
- def node_type; end
4441
-
4442
- # source://rexml//lib/rexml/text.rb#125
4443
- def parent=(parent); end
4444
-
4445
- # If +raw+ is true, then REXML leaves the value alone
4446
- #
4447
- # source://rexml//lib/rexml/text.rb#21
4448
- def raw; end
4449
-
4450
- # If +raw+ is true, then REXML leaves the value alone
4451
- #
4452
- # source://rexml//lib/rexml/text.rb#21
4453
- def raw=(_arg0); end
4454
-
4455
- # Returns the string value of this text node. This string is always
4456
- # escaped, meaning that it is a valid XML text node string, and all
4457
- # entities that can be escaped, have been inserted. This method respects
4458
- # the entity filter set in the constructor.
4459
- #
4460
- # # Assume that the entity "s" is defined to be "sean", and that the
4461
- # # entity "r" is defined to be "russell"
4462
- # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4463
- # t.to_s #-> "&lt; &amp; &s; russell"
4464
- # t = Text.new( "< & &s; russell", false, nil, false )
4465
- # t.to_s #-> "&lt; &amp; &s; russell"
4466
- # u = Text.new( "sean russell", false, nil, true )
4467
- # u.to_s #-> "sean russell"
4468
- #
4469
- # source://rexml//lib/rexml/text.rb#248
4470
- def to_s; end
4471
-
4472
- # Returns the string value of this text. This is the text without
4473
- # entities, as it might be used programmatically, or printed to the
4474
- # console. This ignores the 'raw' attribute setting, and any
4475
- # entity_filter.
4476
- #
4477
- # # Assume that the entity "s" is defined to be "sean", and that the
4478
- # # entity "r" is defined to be "russell"
4479
- # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4480
- # t.value #-> "< & sean russell"
4481
- # t = Text.new( "< & &s; russell", false, nil, false )
4482
- # t.value #-> "< & sean russell"
4483
- # u = Text.new( "sean russell", false, nil, true )
4484
- # u.value #-> "sean russell"
4485
- #
4486
- # source://rexml//lib/rexml/text.rb#270
4487
- def value; end
4488
-
4489
- # Sets the contents of this text node. This expects the text to be
4490
- # unnormalized. It returns self.
4491
- #
4492
- # e = Element.new( "a" )
4493
- # e.add_text( "foo" ) # <a>foo</a>
4494
- # e[0].value = "bar" # <a>bar</a>
4495
- # e[0].value = "<a>" # <a>&lt;a&gt;</a>
4496
- #
4497
- # source://rexml//lib/rexml/text.rb#282
4498
- def value=(val); end
4499
-
4500
- # source://rexml//lib/rexml/text.rb#288
4501
- def wrap(string, width, addnewline = T.unsafe(nil)); end
4502
-
4503
- # == DEPRECATED
4504
- # See REXML::Formatters
4505
- #
4506
- # source://rexml//lib/rexml/text.rb#314
4507
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4508
-
4509
- # Writes out text, substituting special characters beforehand.
4510
- # +out+ A String, IO, or any other object supporting <<( String )
4511
- # +input+ the text to substitute and the write out
4512
- #
4513
- # z=utf8.unpack("U*")
4514
- # ascOut=""
4515
- # z.each{|r|
4516
- # if r < 0x100
4517
- # ascOut.concat(r.chr)
4518
- # else
4519
- # ascOut.concat(sprintf("&#x%x;", r))
4520
- # end
4521
- # }
4522
- # puts ascOut
4523
- #
4524
- # source://rexml//lib/rexml/text.rb#346
4525
- def write_with_substitution(out, input); end
4526
-
4527
- # FIXME
4528
- # This probably won't work properly
4529
- #
4530
- # source://rexml//lib/rexml/text.rb#326
4531
- def xpath; end
4532
-
4533
- private
4534
-
4535
- # source://rexml//lib/rexml/text.rb#359
4536
- def clear_cache; end
4537
-
4538
- class << self
4539
- # check for illegal characters
4540
- #
4541
- # source://rexml//lib/rexml/text.rb#131
4542
- def check(string, pattern, doctype); end
4543
-
4544
- # source://rexml//lib/rexml/text.rb#429
4545
- def expand(ref, doctype, filter); end
4546
-
4547
- # Escapes all possible entities
4548
- #
4549
- # source://rexml//lib/rexml/text.rb#391
4550
- def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
4551
-
4552
- # Reads text, substituting entities
4553
- #
4554
- # source://rexml//lib/rexml/text.rb#365
4555
- def read_with_substitution(input, illegal = T.unsafe(nil)); end
4556
-
4557
- # Unescapes all possible entities
4558
- #
4559
- # source://rexml//lib/rexml/text.rb#415
4560
- def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil), entity_expansion_text_limit: T.unsafe(nil)); end
4561
- end
4562
- end
4563
-
4564
- # source://rexml//lib/rexml/undefinednamespaceexception.rb#4
4565
- class REXML::UndefinedNamespaceException < ::REXML::ParseException
4566
- # @return [UndefinedNamespaceException] a new instance of UndefinedNamespaceException
4567
- #
4568
- # source://rexml//lib/rexml/undefinednamespaceexception.rb#5
4569
- def initialize(prefix, source, parser); end
4570
- end
4571
-
4572
- # source://rexml//lib/rexml/validation/validationexception.rb#4
4573
- class REXML::Validation::ValidationException < ::RuntimeError
4574
- # @return [ValidationException] a new instance of ValidationException
4575
- #
4576
- # source://rexml//lib/rexml/validation/validationexception.rb#5
4577
- def initialize(msg); end
4578
- end
4579
-
4580
- # NEEDS DOCUMENTATION
4581
- #
4582
- # source://rexml//lib/rexml/xmldecl.rb#8
4583
- class REXML::XMLDecl < ::REXML::Child
4584
- include ::REXML::Encoding
4585
-
4586
- # @return [XMLDecl] a new instance of XMLDecl
4587
- #
4588
- # source://rexml//lib/rexml/xmldecl.rb#20
4589
- def initialize(version = T.unsafe(nil), encoding = T.unsafe(nil), standalone = T.unsafe(nil)); end
4590
-
4591
- # source://rexml//lib/rexml/xmldecl.rb#56
4592
- def ==(other); end
4593
-
4594
- # source://rexml//lib/rexml/xmldecl.rb#39
4595
- def clone; end
4596
-
4597
- # source://rexml//lib/rexml/xmldecl.rb#102
4598
- def dowrite; end
4599
-
4600
- # source://rexml//lib/rexml/xmldecl.rb#76
4601
- def encoding=(enc); end
4602
-
4603
- # source://rexml//lib/rexml/xmldecl.rb#106
4604
- def inspect; end
4605
-
4606
- # source://rexml//lib/rexml/xmldecl.rb#69
4607
- def node_type; end
4608
-
4609
- # source://rexml//lib/rexml/xmldecl.rb#98
4610
- def nowrite; end
4611
-
4612
- # source://rexml//lib/rexml/encoding.rb#7
4613
- def old_enc=(encoding); end
4614
-
4615
- # Returns the value of attribute standalone.
4616
- #
4617
- # source://rexml//lib/rexml/xmldecl.rb#17
4618
- def stand_alone?; end
4619
-
4620
- # Returns the value of attribute standalone.
4621
- #
4622
- # source://rexml//lib/rexml/xmldecl.rb#17
4623
- def standalone; end
4624
-
4625
- # Sets the attribute standalone
4626
- #
4627
- # @param value the value to set the attribute standalone to.
4628
- #
4629
- # source://rexml//lib/rexml/xmldecl.rb#17
4630
- def standalone=(_arg0); end
4631
-
4632
- # Returns the value of attribute version.
4633
- #
4634
- # source://rexml//lib/rexml/xmldecl.rb#17
4635
- def version; end
4636
-
4637
- # Sets the attribute version
4638
- #
4639
- # @param value the value to set the attribute version to.
4640
- #
4641
- # source://rexml//lib/rexml/xmldecl.rb#17
4642
- def version=(_arg0); end
4643
-
4644
- # indent::
4645
- # Ignored. There must be no whitespace before an XML declaration
4646
- # transitive::
4647
- # Ignored
4648
- # ie_hack::
4649
- # Ignored
4650
- #
4651
- # source://rexml//lib/rexml/xmldecl.rb#49
4652
- def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4653
-
4654
- # Returns the value of attribute writeencoding.
4655
- #
4656
- # source://rexml//lib/rexml/xmldecl.rb#18
4657
- def writeencoding; end
4658
-
4659
- # Returns the value of attribute writethis.
4660
- #
4661
- # source://rexml//lib/rexml/xmldecl.rb#18
4662
- def writethis; end
4663
-
4664
- # source://rexml//lib/rexml/xmldecl.rb#63
4665
- def xmldecl(version, encoding, standalone); end
4666
-
4667
- private
4668
-
4669
- # source://rexml//lib/rexml/xmldecl.rb#111
4670
- def content(enc); end
4671
-
4672
- class << self
4673
- # Only use this if you do not want the XML declaration to be written;
4674
- # this object is ignored by the XML writer. Otherwise, instantiate your
4675
- # own XMLDecl and add it to the document.
4676
- #
4677
- # Note that XML 1.1 documents *must* include an XML declaration
4678
- #
4679
- # source://rexml//lib/rexml/xmldecl.rb#92
4680
- def default; end
4681
- end
4682
- end
4683
-
4684
- # @private
4685
- #
4686
- # source://rexml//lib/rexml/xpath_parser.rb#963
4687
- class REXML::XPathNode
4688
- # @return [XPathNode] a new instance of XPathNode
4689
- #
4690
- # source://rexml//lib/rexml/xpath_parser.rb#965
4691
- def initialize(node, context = T.unsafe(nil)); end
4692
-
4693
- # Returns the value of attribute context.
4694
- #
4695
- # source://rexml//lib/rexml/xpath_parser.rb#964
4696
- def context; end
4697
-
4698
- # source://rexml//lib/rexml/xpath_parser.rb#974
4699
- def position; end
4700
-
4701
- # Returns the value of attribute raw_node.
4702
- #
4703
- # source://rexml//lib/rexml/xpath_parser.rb#964
4704
- def raw_node; end
4705
- end
4706
-
4707
- # You don't want to use this class. Really. Use XPath, which is a wrapper
4708
- # for this class. Believe me. You don't want to poke around in here.
4709
- # There is strange, dark magic at work in this code. Beware. Go back! Go
4710
- # back while you still can!
4711
- #
4712
- # source://rexml//lib/rexml/xpath_parser.rb#54
4713
- class REXML::XPathParser
4714
- include ::REXML::XMLTokens
4715
-
4716
- # @return [XPathParser] a new instance of XPathParser
4717
- #
4718
- # source://rexml//lib/rexml/xpath_parser.rb#60
4719
- def initialize(strict: T.unsafe(nil)); end
4720
-
4721
- # source://rexml//lib/rexml/xpath_parser.rb#94
4722
- def []=(variable_name, value); end
4723
-
4724
- # Performs a depth-first (document order) XPath search, and returns the
4725
- # first match. This is the fastest, lightest way to return a single result.
4726
- #
4727
- # FIXME: This method is incomplete!
4728
- #
4729
- # source://rexml//lib/rexml/xpath_parser.rb#103
4730
- def first(path_stack, node); end
4731
-
4732
- # source://rexml//lib/rexml/xpath_parser.rb#84
4733
- def get_first(path, nodeset); end
4734
-
4735
- # source://rexml//lib/rexml/xpath_parser.rb#139
4736
- def match(path_stack, nodeset); end
4737
-
4738
- # source://rexml//lib/rexml/xpath_parser.rb#69
4739
- def namespaces=(namespaces = T.unsafe(nil)); end
4740
-
4741
- # source://rexml//lib/rexml/xpath_parser.rb#79
4742
- def parse(path, nodeset); end
4743
-
4744
- # source://rexml//lib/rexml/xpath_parser.rb#89
4745
- def predicate(path, nodeset); end
4746
-
4747
- # source://rexml//lib/rexml/xpath_parser.rb#74
4748
- def variables=(vars = T.unsafe(nil)); end
4749
-
4750
- private
4751
-
4752
- # source://rexml//lib/rexml/xpath_parser.rb#779
4753
- def child(nodeset); end
4754
-
4755
- # source://rexml//lib/rexml/xpath_parser.rb#920
4756
- def compare(a, operator, b); end
4757
-
4758
- # source://rexml//lib/rexml/xpath_parser.rb#682
4759
- def descendant(nodeset, include_self); end
4760
-
4761
- # source://rexml//lib/rexml/xpath_parser.rb#693
4762
- def descendant_recursive(raw_node, new_nodeset, new_nodes, include_self); end
4763
-
4764
- # source://rexml//lib/rexml/xpath_parser.rb#942
4765
- def each_unnode(nodeset); end
4766
-
4767
- # source://rexml//lib/rexml/xpath_parser.rb#641
4768
- def enter(tag, *args); end
4769
-
4770
- # source://rexml//lib/rexml/xpath_parser.rb#819
4771
- def equality_relational_compare(set1, op, set2); end
4772
-
4773
- # source://rexml//lib/rexml/xpath_parser.rb#591
4774
- def evaluate_predicate(expression, nodesets); end
4775
-
4776
- # Expr takes a stack of path elements and a set of nodes (either a Parent
4777
- # or an Array and returns an Array of matching nodes
4778
- #
4779
- # source://rexml//lib/rexml/xpath_parser.rb#175
4780
- def expr(path_stack, nodeset, context = T.unsafe(nil)); end
4781
-
4782
- # source://rexml//lib/rexml/xpath_parser.rb#582
4783
- def filter_nodeset(nodeset); end
4784
-
4785
- # source://rexml//lib/rexml/xpath_parser.rb#749
4786
- def following(node); end
4787
-
4788
- # source://rexml//lib/rexml/xpath_parser.rb#760
4789
- def following_node_of(node); end
4790
-
4791
- # Returns a String namespace for a node, given a prefix
4792
- # The rules are:
4793
- #
4794
- # 1. Use the supplied namespace mapping first.
4795
- # 2. If no mapping was supplied, use the context node to look up the namespace
4796
- #
4797
- # source://rexml//lib/rexml/xpath_parser.rb#163
4798
- def get_namespace(node, prefix); end
4799
-
4800
- # source://rexml//lib/rexml/xpath_parser.rb#646
4801
- def leave(tag, *args); end
4802
-
4803
- # source://rexml//lib/rexml/xpath_parser.rb#767
4804
- def next_sibling_node(node); end
4805
-
4806
- # source://rexml//lib/rexml/xpath_parser.rb#477
4807
- def node_test(path_stack, nodesets, any_type: T.unsafe(nil)); end
4808
-
4809
- # source://rexml//lib/rexml/xpath_parser.rb#806
4810
- def norm(b); end
4811
-
4812
- # source://rexml//lib/rexml/xpath_parser.rb#894
4813
- def normalize_compare_values(a, operator, b); end
4814
-
4815
- # Builds a nodeset of all of the preceding nodes of the supplied node,
4816
- # in reverse document order
4817
- # preceding:: includes every element in the document that precedes this node,
4818
- # except for ancestors
4819
- #
4820
- # source://rexml//lib/rexml/xpath_parser.rb#712
4821
- def preceding(node); end
4822
-
4823
- # source://rexml//lib/rexml/xpath_parser.rb#734
4824
- def preceding_node_of(node); end
4825
-
4826
- # Reorders an array of nodes so that they are in document order
4827
- # It tries to do this efficiently.
4828
- #
4829
- # FIXME: I need to get rid of this, but the issue is that most of the XPath
4830
- # interpreter functions as a filter, which means that we lose context going
4831
- # in and out of function calls. If I knew what the index of the nodes was,
4832
- # I wouldn't have to do this. Maybe add a document IDX for each node?
4833
- # Problems with mutable documents. Or, rewrite everything.
4834
- #
4835
- # source://rexml//lib/rexml/xpath_parser.rb#659
4836
- def sort(array_of_nodes, order); end
4837
-
4838
- # source://rexml//lib/rexml/xpath_parser.rb#441
4839
- def step(path_stack, any_type: T.unsafe(nil), order: T.unsafe(nil)); end
4840
-
4841
- # @return [Boolean]
4842
- #
4843
- # source://rexml//lib/rexml/xpath_parser.rb#154
4844
- def strict?; end
4845
-
4846
- # source://rexml//lib/rexml/xpath_parser.rb#634
4847
- def trace(*args); end
4848
-
4849
- # source://rexml//lib/rexml/xpath_parser.rb#954
4850
- def unnode(nodeset); end
4851
-
4852
- # source://rexml//lib/rexml/xpath_parser.rb#881
4853
- def value_type(value); end
4854
- end
4855
-
4856
- # source://rexml//lib/rexml/xpath_parser.rb#58
4857
- REXML::XPathParser::DEBUG = T.let(T.unsafe(nil), FalseClass)