esquema 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/CHANGELOG.md +9 -1
  4. data/README.md +11 -9
  5. data/lib/esquema/builder.rb +73 -28
  6. data/lib/esquema/configuration.rb +2 -1
  7. data/lib/esquema/keyword_validator.rb +98 -0
  8. data/lib/esquema/model.rb +4 -0
  9. data/lib/esquema/property.rb +185 -26
  10. data/lib/esquema/schema_enhancer.rb +55 -30
  11. data/lib/esquema/type_caster.rb +16 -4
  12. data/lib/esquema/version.rb +1 -1
  13. data/lib/esquema/virtual_column.rb +46 -0
  14. data/lib/esquema.rb +7 -1
  15. data/lib/generators/esquema/install/install_generator.rb +1 -0
  16. data/sorbet/config +4 -0
  17. data/sorbet/rbi/annotations/.gitattributes +1 -0
  18. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  19. data/sorbet/rbi/annotations/activerecord.rbi +92 -0
  20. data/sorbet/rbi/annotations/activesupport.rbi +421 -0
  21. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  22. data/sorbet/rbi/gems/.gitattributes +1 -0
  23. data/sorbet/rbi/gems/activemodel@7.1.3.rbi +8 -0
  24. data/sorbet/rbi/gems/activerecord@7.1.3.rbi +8 -0
  25. data/sorbet/rbi/gems/activesupport@7.1.3.rbi +192 -0
  26. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  27. data/sorbet/rbi/gems/base64@0.2.0.rbi +8 -0
  28. data/sorbet/rbi/gems/bigdecimal@3.1.6.rbi +8 -0
  29. data/sorbet/rbi/gems/byebug@11.1.3.rbi +3606 -0
  30. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  31. data/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +8 -0
  32. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
  33. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +1130 -0
  34. data/sorbet/rbi/gems/drb@2.2.0.rbi +1272 -0
  35. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  36. data/sorbet/rbi/gems/i18n@1.14.1.rbi +8 -0
  37. data/sorbet/rbi/gems/json@2.7.1.rbi +1553 -0
  38. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  39. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  40. data/sorbet/rbi/gems/minitest@5.22.2.rbi +8 -0
  41. data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +8 -0
  42. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  43. data/sorbet/rbi/gems/parallel@1.24.0.rbi +280 -0
  44. data/sorbet/rbi/gems/parser@3.3.0.5.rbi +5472 -0
  45. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  46. data/sorbet/rbi/gems/prism@0.24.0.rbi +31040 -0
  47. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1150 -0
  48. data/sorbet/rbi/gems/pry@0.14.2.rbi +10075 -0
  49. data/sorbet/rbi/gems/racc@1.7.3.rbi +157 -0
  50. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  51. data/sorbet/rbi/gems/rake@13.1.0.rbi +3027 -0
  52. data/sorbet/rbi/gems/rbi@0.1.9.rbi +3006 -0
  53. data/sorbet/rbi/gems/regexp_parser@2.9.0.rbi +3771 -0
  54. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  55. data/sorbet/rbi/gems/rspec-core@3.13.0.rbi +10978 -0
  56. data/sorbet/rbi/gems/rspec-expectations@3.13.0.rbi +8153 -0
  57. data/sorbet/rbi/gems/rspec-mocks@3.13.0.rbi +5340 -0
  58. data/sorbet/rbi/gems/rspec-support@3.13.0.rbi +1629 -0
  59. data/sorbet/rbi/gems/rspec@3.13.0.rbi +82 -0
  60. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +7006 -0
  61. data/sorbet/rbi/gems/rubocop@1.60.2.rbi +57383 -0
  62. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  63. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  64. data/sorbet/rbi/gems/spoom@1.2.4.rbi +3777 -0
  65. data/sorbet/rbi/gems/sqlite3@1.7.2.rbi +1691 -0
  66. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +23133 -0
  67. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +3510 -0
  68. data/sorbet/rbi/gems/thor@1.3.0.rbi +4345 -0
  69. data/sorbet/rbi/gems/timeout@0.4.1.rbi +142 -0
  70. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +8 -0
  71. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +65 -0
  72. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  73. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  74. data/sorbet/rbi/todo.rbi +20 -0
  75. data/sorbet/tapioca/config.yml +13 -0
  76. data/sorbet/tapioca/require.rb +4 -0
  77. metadata +74 -12
  78. data/esquema.gemspec +0 -38
@@ -0,0 +1,4781 @@
1
+ # typed: true
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#163
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#171
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#197
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#193
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#157
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#184
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#189
220
+ def write(output, indent = T.unsafe(nil)); end
221
+
222
+ # source://rexml//lib/rexml/attribute.rb#203
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#2141
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#2160
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#2537
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#2185
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#2369
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#2537
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#2490
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#2559
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#2287
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#2254
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#2313
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#2585
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#2225
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#2446
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#2421
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#2225
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#2207
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#170
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#170
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#209
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#120
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#241
1110
+ def doctype; end
1111
+
1112
+ # source://rexml//lib/rexml/document.rb#442
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#290
1126
+ def encoding; end
1127
+
1128
+ # Returns the value of attribute entity_expansion_count.
1129
+ #
1130
+ # source://rexml//lib/rexml/document.rb#433
1131
+ def entity_expansion_count; end
1132
+
1133
+ # :call-seq:
1134
+ # expanded_name -> empty_string
1135
+ #
1136
+ # Returns an empty string.
1137
+ #
1138
+ # source://rexml//lib/rexml/document.rb#129
1139
+ def expanded_name; end
1140
+
1141
+ # :call-seq:
1142
+ # expanded_name -> empty_string
1143
+ #
1144
+ # Returns an empty string.
1145
+ # d = doc_type
1146
+ # d ? d.name : "UNDEFINED"
1147
+ #
1148
+ # source://rexml//lib/rexml/document.rb#129
1149
+ def name; end
1150
+
1151
+ # :call-seq:
1152
+ # node_type -> :document
1153
+ #
1154
+ # Returns the symbol +:document+.
1155
+ #
1156
+ # source://rexml//lib/rexml/document.rb#110
1157
+ def node_type; end
1158
+
1159
+ # source://rexml//lib/rexml/document.rb#435
1160
+ def record_entity_expansion; end
1161
+
1162
+ # :call-seq:
1163
+ # root -> root_element or nil
1164
+ #
1165
+ # Returns the root element of the document, if it exists, otherwise +nil+:
1166
+ #
1167
+ # d = REXML::Document.new('<root></root>')
1168
+ # d.root # => <root/>
1169
+ # d = REXML::Document.new('')
1170
+ # d.root # => nil
1171
+ #
1172
+ # source://rexml//lib/rexml/document.rb#225
1173
+ def root; end
1174
+
1175
+ # :call-seq:
1176
+ # stand_alone?
1177
+ #
1178
+ # Returns the XMLDecl standalone value of the document as a string,
1179
+ # if it has been set, otherwise the default standalone value:
1180
+ #
1181
+ # d = REXML::Document.new('<?xml standalone="yes"?>')
1182
+ # d.stand_alone? # => "yes"
1183
+ # d = REXML::Document.new('')
1184
+ # d.stand_alone? # => nil
1185
+ #
1186
+ # @return [Boolean]
1187
+ #
1188
+ # source://rexml//lib/rexml/document.rb#305
1189
+ def stand_alone?; end
1190
+
1191
+ # :call-seq:
1192
+ # version -> version_string
1193
+ #
1194
+ # Returns the XMLDecl version of this document as a string,
1195
+ # if it has been set, otherwise the default version:
1196
+ #
1197
+ # d = REXML::Document.new('<?xml version="2.0" encoding="UTF-8"?>')
1198
+ # d.version # => "2.0"
1199
+ # d = REXML::Document.new('')
1200
+ # d.version # => "1.0"
1201
+ #
1202
+ # source://rexml//lib/rexml/document.rb#275
1203
+ def version; end
1204
+
1205
+ # :call-seq:
1206
+ # doc.write(output=$stdout, indent=-1, transtive=false, ie_hack=false, encoding=nil)
1207
+ # doc.write(options={:output => $stdout, :indent => -1, :transtive => false, :ie_hack => false, :encoding => nil})
1208
+ #
1209
+ # Write the XML tree out, optionally with indent. This writes out the
1210
+ # entire XML document, including XML declarations, doctype declarations,
1211
+ # and processing instructions (if any are given).
1212
+ #
1213
+ # A controversial point is whether Document should always write the XML
1214
+ # declaration (<?xml version='1.0'?>) whether or not one is given by the
1215
+ # user (or source document). REXML does not write one if one was not
1216
+ # specified, because it adds unnecessary bandwidth to applications such
1217
+ # as XML-RPC.
1218
+ #
1219
+ # Accept Nth argument style and options Hash style as argument.
1220
+ # The recommended style is options Hash style for one or more
1221
+ # arguments case.
1222
+ #
1223
+ # _Examples_
1224
+ # Document.new("<a><b/></a>").write
1225
+ #
1226
+ # output = ""
1227
+ # Document.new("<a><b/></a>").write(output)
1228
+ #
1229
+ # output = ""
1230
+ # Document.new("<a><b/></a>").write(:output => output, :indent => 2)
1231
+ #
1232
+ # See also the classes in the rexml/formatters package for the proper way
1233
+ # to change the default formatting of XML output.
1234
+ #
1235
+ # _Examples_
1236
+ #
1237
+ # output = ""
1238
+ # tr = Transitive.new
1239
+ # tr.write(Document.new("<a><b/></a>"), output)
1240
+ #
1241
+ # output::
1242
+ # output an object which supports '<< string'; this is where the
1243
+ # document will be written.
1244
+ # indent::
1245
+ # An integer. If -1, no indenting will be used; otherwise, the
1246
+ # indentation will be twice this number of spaces, and children will be
1247
+ # indented an additional amount. For a value of 3, every item will be
1248
+ # indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1
1249
+ # transitive::
1250
+ # If transitive is true and indent is >= 0, then the output will be
1251
+ # pretty-printed in such a way that the added whitespace does not affect
1252
+ # the absolute *value* of the document -- that is, it leaves the value
1253
+ # and number of Text nodes in the document unchanged.
1254
+ # ie_hack::
1255
+ # This hack inserts a space before the /> on empty tags to address
1256
+ # a limitation of Internet Explorer. Defaults to false
1257
+ # Encoding name as String. Change output encoding to specified encoding
1258
+ # instead of encoding in XML declaration.
1259
+ # Defaults to nil. It means encoding in XML declaration is used.
1260
+ #
1261
+ # source://rexml//lib/rexml/document.rb#365
1262
+ def write(*arguments); end
1263
+
1264
+ # :call-seq:
1265
+ # xml_decl -> xml_decl
1266
+ #
1267
+ # Returns the XMLDecl object for the document, if it exists,
1268
+ # otherwise the default XMLDecl object:
1269
+ #
1270
+ # d = REXML::Document.new('<?xml version="1.0" encoding="UTF-8"?>')
1271
+ # d.xml_decl.class # => REXML::XMLDecl
1272
+ # d.xml_decl.to_s # => "<?xml version='1.0' encoding='UTF-8'?>"
1273
+ # d = REXML::Document.new('')
1274
+ # d.xml_decl.class # => REXML::XMLDecl
1275
+ # d.xml_decl.to_s # => ""
1276
+ #
1277
+ # source://rexml//lib/rexml/document.rb#258
1278
+ def xml_decl; end
1279
+
1280
+ private
1281
+
1282
+ # source://rexml//lib/rexml/document.rb#447
1283
+ def build(source); end
1284
+
1285
+ class << self
1286
+ # Get the entity expansion limit. By default the limit is set to 10000.
1287
+ #
1288
+ # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1289
+ #
1290
+ # source://rexml//lib/rexml/document.rb#415
1291
+ def entity_expansion_limit; end
1292
+
1293
+ # Set the entity expansion limit. By default the limit is set to 10000.
1294
+ #
1295
+ # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
1296
+ #
1297
+ # source://rexml//lib/rexml/document.rb#408
1298
+ def entity_expansion_limit=(val); end
1299
+
1300
+ # Get the entity expansion limit. By default the limit is set to 10240.
1301
+ #
1302
+ # Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
1303
+ #
1304
+ # source://rexml//lib/rexml/document.rb#429
1305
+ def entity_expansion_text_limit; end
1306
+
1307
+ # Set the entity expansion limit. By default the limit is set to 10240.
1308
+ #
1309
+ # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
1310
+ #
1311
+ # source://rexml//lib/rexml/document.rb#422
1312
+ def entity_expansion_text_limit=(val); end
1313
+
1314
+ # source://rexml//lib/rexml/document.rb#401
1315
+ def parse_stream(source, listener); end
1316
+ end
1317
+ end
1318
+
1319
+ # An \REXML::Element object represents an XML element.
1320
+ #
1321
+ # An element:
1322
+ #
1323
+ # - Has a name (string).
1324
+ # - May have a parent (another element).
1325
+ # - Has zero or more children
1326
+ # (other elements, text, CDATA, processing instructions, and comments).
1327
+ # - Has zero or more siblings
1328
+ # (other elements, text, CDATA, processing instructions, and comments).
1329
+ # - Has zero or more named attributes.
1330
+ #
1331
+ # == In a Hurry?
1332
+ #
1333
+ # If you're somewhat familiar with XML
1334
+ # and have a particular task in mind,
1335
+ # you may want to see the
1336
+ # {tasks pages}[../doc/rexml/tasks/tocs/master_toc_rdoc.html],
1337
+ # and in particular, the
1338
+ # {tasks page for elements}[../doc/rexml/tasks/tocs/element_toc_rdoc.html].
1339
+ #
1340
+ # === Name
1341
+ #
1342
+ # An element has a name, which is initially set when the element is created:
1343
+ #
1344
+ # e = REXML::Element.new('foo')
1345
+ # e.name # => "foo"
1346
+ #
1347
+ # The name may be changed:
1348
+ #
1349
+ # e.name = 'bar'
1350
+ # e.name # => "bar"
1351
+ #
1352
+ #
1353
+ # === \Parent
1354
+ #
1355
+ # An element may have a parent.
1356
+ #
1357
+ # Its parent may be assigned explicitly when the element is created:
1358
+ #
1359
+ # e0 = REXML::Element.new('foo')
1360
+ # e1 = REXML::Element.new('bar', e0)
1361
+ # e1.parent # => <foo> ... </>
1362
+ #
1363
+ # Note: the representation of an element always shows the element's name.
1364
+ # If the element has children, the representation indicates that
1365
+ # by including an ellipsis (<tt>...</tt>).
1366
+ #
1367
+ # The parent may be assigned explicitly at any time:
1368
+ #
1369
+ # e2 = REXML::Element.new('baz')
1370
+ # e1.parent = e2
1371
+ # e1.parent # => <baz/>
1372
+ #
1373
+ # When an element is added as a child, its parent is set automatically:
1374
+ #
1375
+ # e1.add_element(e0)
1376
+ # e0.parent # => <bar> ... </>
1377
+ #
1378
+ # For an element that has no parent, method +parent+ returns +nil+.
1379
+ #
1380
+ # === Children
1381
+ #
1382
+ # An element has zero or more children.
1383
+ # The children are an ordered collection
1384
+ # of all objects whose parent is the element itself.
1385
+ #
1386
+ # The children may include any combination of elements, text, comments,
1387
+ # processing instructions, and CDATA.
1388
+ # (This example keeps things clean by controlling whitespace
1389
+ # via a +context+ setting.)
1390
+ #
1391
+ # xml_string = <<-EOT
1392
+ # <root>
1393
+ # <ele_0/>
1394
+ # text 0
1395
+ # <!--comment 0-->
1396
+ # <?target_0 pi_0?>
1397
+ # <![CDATA[cdata 0]]>
1398
+ # <ele_1/>
1399
+ # text 1
1400
+ # <!--comment 1-->
1401
+ # <?target_0 pi_1?>
1402
+ # <![CDATA[cdata 1]]>
1403
+ # </root>
1404
+ # EOT
1405
+ # context = {ignore_whitespace_nodes: :all, compress_whitespace: :all}
1406
+ # d = REXML::Document.new(xml_string, context)
1407
+ # root = d.root
1408
+ # root.children.size # => 10
1409
+ # root.each {|child| p "#{child.class}: #{child}" }
1410
+ #
1411
+ # Output:
1412
+ #
1413
+ # "REXML::Element: <ele_0/>"
1414
+ # "REXML::Text: \n text 0\n "
1415
+ # "REXML::Comment: comment 0"
1416
+ # "REXML::Instruction: <?target_0 pi_0?>"
1417
+ # "REXML::CData: cdata 0"
1418
+ # "REXML::Element: <ele_1/>"
1419
+ # "REXML::Text: \n text 1\n "
1420
+ # "REXML::Comment: comment 1"
1421
+ # "REXML::Instruction: <?target_0 pi_1?>"
1422
+ # "REXML::CData: cdata 1"
1423
+ #
1424
+ # A child may be added using inherited methods
1425
+ # Parent#insert_before or Parent#insert_after:
1426
+ #
1427
+ # xml_string = '<root><a/><c/><d/></root>'
1428
+ # d = REXML::Document.new(xml_string)
1429
+ # root = d.root
1430
+ # c = d.root[1] # => <c/>
1431
+ # root.insert_before(c, REXML::Element.new('b'))
1432
+ # root.to_a # => [<a/>, <b/>, <c/>, <d/>]
1433
+ #
1434
+ # A child may be replaced using Parent#replace_child:
1435
+ #
1436
+ # root.replace_child(c, REXML::Element.new('x'))
1437
+ # root.to_a # => [<a/>, <b/>, <x/>, <d/>]
1438
+ #
1439
+ # A child may be removed using Parent#delete:
1440
+ #
1441
+ # x = root[2] # => <x/>
1442
+ # root.delete(x)
1443
+ # root.to_a # => [<a/>, <b/>, <d/>]
1444
+ #
1445
+ # === Siblings
1446
+ #
1447
+ # An element has zero or more siblings,
1448
+ # which are the other children of the element's parent.
1449
+ #
1450
+ # In the example above, element +ele_1+ is between a CDATA sibling
1451
+ # and a text sibling:
1452
+ #
1453
+ # ele_1 = root[5] # => <ele_1/>
1454
+ # ele_1.previous_sibling # => "cdata 0"
1455
+ # ele_1.next_sibling # => "\n text 1\n "
1456
+ #
1457
+ # === \Attributes
1458
+ #
1459
+ # An element has zero or more named attributes.
1460
+ #
1461
+ # A new element has no attributes:
1462
+ #
1463
+ # e = REXML::Element.new('foo')
1464
+ # e.attributes # => {}
1465
+ #
1466
+ # Attributes may be added:
1467
+ #
1468
+ # e.add_attribute('bar', 'baz')
1469
+ # e.add_attribute('bat', 'bam')
1470
+ # e.attributes.size # => 2
1471
+ # e['bar'] # => "baz"
1472
+ # e['bat'] # => "bam"
1473
+ #
1474
+ # An existing attribute may be modified:
1475
+ #
1476
+ # e.add_attribute('bar', 'bad')
1477
+ # e.attributes.size # => 2
1478
+ # e['bar'] # => "bad"
1479
+ #
1480
+ # An existing attribute may be deleted:
1481
+ #
1482
+ # e.delete_attribute('bar')
1483
+ # e.attributes.size # => 1
1484
+ # e['bar'] # => nil
1485
+ #
1486
+ # == What's Here
1487
+ #
1488
+ # To begin with, what's elsewhere?
1489
+ #
1490
+ # \Class \REXML::Element inherits from its ancestor classes:
1491
+ #
1492
+ # - REXML::Child
1493
+ # - REXML::Parent
1494
+ #
1495
+ # \REXML::Element itself and its ancestors also include modules:
1496
+ #
1497
+ # - {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html]
1498
+ # - REXML::Namespace
1499
+ # - REXML::Node
1500
+ # - REXML::XMLTokens
1501
+ #
1502
+ # === Methods for Creating an \Element
1503
+ #
1504
+ # ::new:: Returns a new empty element.
1505
+ # #clone:: Returns a clone of another element.
1506
+ #
1507
+ # === Methods for Attributes
1508
+ #
1509
+ # {[attribute_name]}[#method-i-5B-5D]:: Returns an attribute value.
1510
+ # #add_attribute:: Adds a new attribute.
1511
+ # #add_attributes:: Adds multiple new attributes.
1512
+ # #attribute:: Returns the attribute value for a given name and optional namespace.
1513
+ # #delete_attribute:: Removes an attribute.
1514
+ #
1515
+ # === Methods for Children
1516
+ #
1517
+ # {[index]}[#method-i-5B-5D]:: Returns the child at the given offset.
1518
+ # #add_element:: Adds an element as the last child.
1519
+ # #delete_element:: Deletes a child element.
1520
+ # #each_element:: Calls the given block with each child element.
1521
+ # #each_element_with_attribute:: Calls the given block with each child element
1522
+ # that meets given criteria,
1523
+ # which can include the attribute name.
1524
+ # #each_element_with_text:: Calls the given block with each child element
1525
+ # that meets given criteria,
1526
+ # which can include text.
1527
+ # #get_elements:: Returns an array of element children that match a given xpath.
1528
+ #
1529
+ # === Methods for \Text Children
1530
+ #
1531
+ # #add_text:: Adds a text node to the element.
1532
+ # #get_text:: Returns a text node that meets specified criteria.
1533
+ # #text:: Returns the text string from the first node that meets specified criteria.
1534
+ # #texts:: Returns an array of the text children of the element.
1535
+ # #text=:: Adds, removes, or replaces the first text child of the element
1536
+ #
1537
+ # === Methods for Other Children
1538
+ #
1539
+ # #cdatas:: Returns an array of the cdata children of the element.
1540
+ # #comments:: Returns an array of the comment children of the element.
1541
+ # #instructions:: Returns an array of the instruction children of the element.
1542
+ #
1543
+ # === Methods for Namespaces
1544
+ #
1545
+ # #add_namespace:: Adds a namespace to the element.
1546
+ # #delete_namespace:: Removes a namespace from the element.
1547
+ # #namespace:: Returns the string namespace URI for the element.
1548
+ # #namespaces:: Returns a hash of all defined namespaces in the element.
1549
+ # #prefixes:: Returns an array of the string prefixes (names)
1550
+ # of all defined namespaces in the element
1551
+ #
1552
+ # === Methods for Querying
1553
+ #
1554
+ # #document:: Returns the document, if any, that the element belongs to.
1555
+ # #root:: Returns the most distant element (not document) ancestor of the element.
1556
+ # #root_node:: Returns the most distant ancestor of the element.
1557
+ # #xpath:: Returns the string xpath to the element
1558
+ # relative to the most distant parent
1559
+ # #has_attributes?:: Returns whether the element has attributes.
1560
+ # #has_elements?:: Returns whether the element has elements.
1561
+ # #has_text?:: Returns whether the element has text.
1562
+ # #next_element:: Returns the next sibling that is an element.
1563
+ # #previous_element:: Returns the previous sibling that is an element.
1564
+ # #raw:: Returns whether raw mode is set for the element.
1565
+ # #whitespace:: Returns whether whitespace is respected for the element.
1566
+ # #ignore_whitespace_nodes:: Returns whether whitespace nodes
1567
+ # are to be ignored for the element.
1568
+ # #node_type:: Returns symbol <tt>:element</tt>.
1569
+ #
1570
+ # === One More Method
1571
+ #
1572
+ # #inspect:: Returns a string representation of the element.
1573
+ #
1574
+ # === Accessors
1575
+ #
1576
+ # #elements:: Returns the REXML::Elements object for the element.
1577
+ # #attributes:: Returns the REXML::Attributes object for the element.
1578
+ # #context:: Returns or sets the context hash for the element.
1579
+ #
1580
+ # source://rexml//lib/rexml/element.rb#279
1581
+ class REXML::Element < ::REXML::Parent
1582
+ include ::REXML::XMLTokens
1583
+ include ::REXML::Namespace
1584
+
1585
+ # :call-seq:
1586
+ # Element.new(name = 'UNDEFINED', parent = nil, context = nil) -> new_element
1587
+ # Element.new(element, parent = nil, context = nil) -> new_element
1588
+ #
1589
+ # Returns a new \REXML::Element object.
1590
+ #
1591
+ # When no arguments are given,
1592
+ # returns an element with name <tt>'UNDEFINED'</tt>:
1593
+ #
1594
+ # e = REXML::Element.new # => <UNDEFINED/>
1595
+ # e.class # => REXML::Element
1596
+ # e.name # => "UNDEFINED"
1597
+ #
1598
+ # When only argument +name+ is given,
1599
+ # returns an element of the given name:
1600
+ #
1601
+ # REXML::Element.new('foo') # => <foo/>
1602
+ #
1603
+ # When only argument +element+ is given, it must be an \REXML::Element object;
1604
+ # returns a shallow copy of the given element:
1605
+ #
1606
+ # e0 = REXML::Element.new('foo')
1607
+ # e1 = REXML::Element.new(e0) # => <foo/>
1608
+ #
1609
+ # When argument +parent+ is also given, it must be an REXML::Parent object:
1610
+ #
1611
+ # e = REXML::Element.new('foo', REXML::Parent.new)
1612
+ # e.parent # => #<REXML::Parent @parent=nil, @children=[<foo/>]>
1613
+ #
1614
+ # When argument +context+ is also given, it must be a hash
1615
+ # representing the context for the element;
1616
+ # see {Element Context}[../doc/rexml/context_rdoc.html]:
1617
+ #
1618
+ # e = REXML::Element.new('foo', nil, {raw: :all})
1619
+ # e.context # => {:raw=>:all}
1620
+ #
1621
+ # @return [Element] a new instance of Element
1622
+ #
1623
+ # source://rexml//lib/rexml/element.rb#327
1624
+ def initialize(arg = T.unsafe(nil), parent = T.unsafe(nil), context = T.unsafe(nil)); end
1625
+
1626
+ # :call-seq:
1627
+ # [index] -> object
1628
+ # [attr_name] -> attr_value
1629
+ # [attr_sym] -> attr_value
1630
+ #
1631
+ # With integer argument +index+ given,
1632
+ # returns the child at offset +index+, or +nil+ if none:
1633
+ #
1634
+ # d = REXML::Document.new '><root><a/>text<b/>more<c/></root>'
1635
+ # root = d.root
1636
+ # (0..root.size).each do |index|
1637
+ # node = root[index]
1638
+ # p "#{index}: #{node} (#{node.class})"
1639
+ # end
1640
+ #
1641
+ # Output:
1642
+ #
1643
+ # "0: <a/> (REXML::Element)"
1644
+ # "1: text (REXML::Text)"
1645
+ # "2: <b/> (REXML::Element)"
1646
+ # "3: more (REXML::Text)"
1647
+ # "4: <c/> (REXML::Element)"
1648
+ # "5: (NilClass)"
1649
+ #
1650
+ # With string argument +attr_name+ given,
1651
+ # returns the string value for the given attribute name if it exists,
1652
+ # otherwise +nil+:
1653
+ #
1654
+ # d = REXML::Document.new('<root attr="value"></root>')
1655
+ # root = d.root
1656
+ # root['attr'] # => "value"
1657
+ # root['nosuch'] # => nil
1658
+ #
1659
+ # With symbol argument +attr_sym+ given,
1660
+ # returns <tt>[attr_sym.to_s]</tt>:
1661
+ #
1662
+ # root[:attr] # => "value"
1663
+ # root[:nosuch] # => nil
1664
+ #
1665
+ # source://rexml//lib/rexml/element.rb#1245
1666
+ def [](name_or_index); end
1667
+
1668
+ # :call-seq:
1669
+ # add_attribute(name, value) -> value
1670
+ # add_attribute(attribute) -> attribute
1671
+ #
1672
+ # Adds an attribute to this element, overwriting any existing attribute
1673
+ # by the same name.
1674
+ #
1675
+ # With string argument +name+ and object +value+ are given,
1676
+ # adds the attribute created with that name and value:
1677
+ #
1678
+ # e = REXML::Element.new
1679
+ # e.add_attribute('attr', 'value') # => "value"
1680
+ # e['attr'] # => "value"
1681
+ # e.add_attribute('attr', 'VALUE') # => "VALUE"
1682
+ # e['attr'] # => "VALUE"
1683
+ #
1684
+ # With only attribute object +attribute+ given,
1685
+ # adds the given attribute:
1686
+ #
1687
+ # a = REXML::Attribute.new('attr', 'value')
1688
+ # e.add_attribute(a) # => attr='value'
1689
+ # e['attr'] # => "value"
1690
+ # a = REXML::Attribute.new('attr', 'VALUE')
1691
+ # e.add_attribute(a) # => attr='VALUE'
1692
+ # e['attr'] # => "VALUE"
1693
+ #
1694
+ # source://rexml//lib/rexml/element.rb#1349
1695
+ def add_attribute(key, value = T.unsafe(nil)); end
1696
+
1697
+ # :call-seq:
1698
+ # add_attributes(hash) -> hash
1699
+ # add_attributes(array)
1700
+ #
1701
+ # Adds zero or more attributes to the element;
1702
+ # returns the argument.
1703
+ #
1704
+ # If hash argument +hash+ is given,
1705
+ # each key must be a string;
1706
+ # adds each attribute created with the key/value pair:
1707
+ #
1708
+ # e = REXML::Element.new
1709
+ # h = {'foo' => 'bar', 'baz' => 'bat'}
1710
+ # e.add_attributes(h)
1711
+ #
1712
+ # If argument +array+ is given,
1713
+ # each array member must be a 2-element array <tt>[name, value];
1714
+ # each name must be a string:
1715
+ #
1716
+ # e = REXML::Element.new
1717
+ # a = [['foo' => 'bar'], ['baz' => 'bat']]
1718
+ # e.add_attributes(a)
1719
+ #
1720
+ # source://rexml//lib/rexml/element.rb#1380
1721
+ def add_attributes(hash); end
1722
+
1723
+ # :call-seq:
1724
+ # add_element(name, attributes = nil) -> new_element
1725
+ # add_element(element, attributes = nil) -> element
1726
+ #
1727
+ # Adds a child element, optionally setting attributes
1728
+ # on the added element; returns the added element.
1729
+ #
1730
+ # With string argument +name+, creates a new element with that name
1731
+ # and adds the new element as a child:
1732
+ #
1733
+ # e0 = REXML::Element.new('foo')
1734
+ # e0.add_element('bar')
1735
+ # e0[0] # => <bar/>
1736
+ #
1737
+ #
1738
+ # With argument +name+ and hash argument +attributes+,
1739
+ # sets attributes on the new element:
1740
+ #
1741
+ # e0.add_element('baz', {'bat' => '0', 'bam' => '1'})
1742
+ # e0[1] # => <baz bat='0' bam='1'/>
1743
+ #
1744
+ # With element argument +element+, adds that element as a child:
1745
+ #
1746
+ # e0 = REXML::Element.new('foo')
1747
+ # e1 = REXML::Element.new('bar')
1748
+ # e0.add_element(e1)
1749
+ # e0[0] # => <bar/>
1750
+ #
1751
+ # With argument +element+ and hash argument +attributes+,
1752
+ # sets attributes on the added element:
1753
+ #
1754
+ # e0.add_element(e1, {'bat' => '0', 'bam' => '1'})
1755
+ # e0[1] # => <bar bat='0' bam='1'/>
1756
+ #
1757
+ # source://rexml//lib/rexml/element.rb#731
1758
+ def add_element(element, attrs = T.unsafe(nil)); end
1759
+
1760
+ # :call-seq:
1761
+ # add_namespace(prefix, uri = nil) -> self
1762
+ #
1763
+ # Adds a namespace to the element; returns +self+.
1764
+ #
1765
+ # With the single argument +prefix+,
1766
+ # adds a namespace using the given +prefix+ and the namespace URI:
1767
+ #
1768
+ # e = REXML::Element.new('foo')
1769
+ # e.add_namespace('bar')
1770
+ # e.namespaces # => {"xmlns"=>"bar"}
1771
+ #
1772
+ # With both arguments +prefix+ and +uri+ given,
1773
+ # adds a namespace using both arguments:
1774
+ #
1775
+ # e.add_namespace('baz', 'bat')
1776
+ # e.namespaces # => {"xmlns"=>"bar", "baz"=>"bat"}
1777
+ #
1778
+ # source://rexml//lib/rexml/element.rb#654
1779
+ def add_namespace(prefix, uri = T.unsafe(nil)); end
1780
+
1781
+ # :call-seq:
1782
+ # add_text(string) -> nil
1783
+ # add_text(text_node) -> self
1784
+ #
1785
+ # Adds text to the element.
1786
+ #
1787
+ # When string argument +string+ is given, returns +nil+.
1788
+ #
1789
+ # If the element has no child text node,
1790
+ # creates a \REXML::Text object using the string,
1791
+ # honoring the current settings for whitespace and raw,
1792
+ # then adds that node to the element:
1793
+ #
1794
+ # d = REXML::Document.new('<a><b/></a>')
1795
+ # a = d.root
1796
+ # a.add_text('foo')
1797
+ # a.to_a # => [<b/>, "foo"]
1798
+ #
1799
+ # If the element has child text nodes,
1800
+ # appends the string to the _last_ text node:
1801
+ #
1802
+ # d = REXML::Document.new('<a>foo<b/>bar</a>')
1803
+ # a = d.root
1804
+ # a.add_text('baz')
1805
+ # a.to_a # => ["foo", <b/>, "barbaz"]
1806
+ # a.add_text('baz')
1807
+ # a.to_a # => ["foo", <b/>, "barbazbaz"]
1808
+ #
1809
+ # When text node argument +text_node+ is given,
1810
+ # appends the node as the last text node in the element;
1811
+ # returns +self+:
1812
+ #
1813
+ # d = REXML::Document.new('<a>foo<b/>bar</a>')
1814
+ # a = d.root
1815
+ # a.add_text(REXML::Text.new('baz'))
1816
+ # a.to_a # => ["foo", <b/>, "bar", "baz"]
1817
+ # a.add_text(REXML::Text.new('baz'))
1818
+ # a.to_a # => ["foo", <b/>, "bar", "baz", "baz"]
1819
+ #
1820
+ # source://rexml//lib/rexml/element.rb#1146
1821
+ def add_text(text); end
1822
+
1823
+ # :call-seq:
1824
+ # attribute(name, namespace = nil)
1825
+ #
1826
+ # Returns the string value for the given attribute name.
1827
+ #
1828
+ # With only argument +name+ given,
1829
+ # returns the value of the named attribute if it exists, otherwise +nil+:
1830
+ #
1831
+ # xml_string = <<-EOT
1832
+ # <root xmlns="ns0">
1833
+ # <a xmlns="ns1" attr="value"></a>
1834
+ # <b xmlns="ns2" attr="value"></b>
1835
+ # <c attr="value"/>
1836
+ # </root>
1837
+ # EOT
1838
+ # d = REXML::Document.new(xml_string)
1839
+ # root = d.root
1840
+ # a = root[1] # => <a xmlns='ns1' attr='value'/>
1841
+ # a.attribute('attr') # => attr='value'
1842
+ # a.attribute('nope') # => nil
1843
+ #
1844
+ # With arguments +name+ and +namespace+ given,
1845
+ # returns the value of the named attribute if it exists, otherwise +nil+:
1846
+ #
1847
+ # xml_string = "<root xmlns:a='a' a:x='a:x' x='x'/>"
1848
+ # document = REXML::Document.new(xml_string)
1849
+ # document.root.attribute("x") # => x='x'
1850
+ # document.root.attribute("x", "a") # => a:x='a:x'
1851
+ #
1852
+ # source://rexml//lib/rexml/element.rb#1286
1853
+ def attribute(name, namespace = T.unsafe(nil)); end
1854
+
1855
+ # Mechanisms for accessing attributes and child elements of this
1856
+ # element.
1857
+ #
1858
+ # source://rexml//lib/rexml/element.rb#286
1859
+ def attributes; end
1860
+
1861
+ # :call-seq:
1862
+ # cdatas -> array_of_cdata_children
1863
+ #
1864
+ # Returns a frozen array of the REXML::CData children of the element:
1865
+ #
1866
+ # xml_string = <<-EOT
1867
+ # <root>
1868
+ # <![CDATA[foo]]>
1869
+ # <![CDATA[bar]]>
1870
+ # </root>
1871
+ # EOT
1872
+ # d = REXML::Document.new(xml_string)
1873
+ # cds = d.root.cdatas # => ["foo", "bar"]
1874
+ # cds.frozen? # => true
1875
+ # cds.map {|cd| cd.class } # => [REXML::CData, REXML::CData]
1876
+ #
1877
+ # source://rexml//lib/rexml/element.rb#1424
1878
+ def cdatas; end
1879
+
1880
+ # :call-seq:
1881
+ # clone -> new_element
1882
+ #
1883
+ # Returns a shallow copy of the element, containing the name and attributes,
1884
+ # but not the parent or children:
1885
+ #
1886
+ # e = REXML::Element.new('foo')
1887
+ # e.add_attributes({'bar' => 0, 'baz' => 1})
1888
+ # e.clone # => <foo bar='0' baz='1'/>
1889
+ #
1890
+ # source://rexml//lib/rexml/element.rb#391
1891
+ def clone; end
1892
+
1893
+ # :call-seq:
1894
+ # comments -> array_of_comment_children
1895
+ #
1896
+ # Returns a frozen array of the REXML::Comment children of the element:
1897
+ #
1898
+ # xml_string = <<-EOT
1899
+ # <root>
1900
+ # <!--foo-->
1901
+ # <!--bar-->
1902
+ # </root>
1903
+ # EOT
1904
+ # d = REXML::Document.new(xml_string)
1905
+ # cs = d.root.comments
1906
+ # cs.frozen? # => true
1907
+ # cs.map {|c| c.class } # => [REXML::Comment, REXML::Comment]
1908
+ # cs.map {|c| c.to_s } # => ["foo", "bar"]
1909
+ #
1910
+ # source://rexml//lib/rexml/element.rb#1445
1911
+ def comments; end
1912
+
1913
+ # The context holds information about the processing environment, such as
1914
+ # whitespace handling.
1915
+ #
1916
+ # source://rexml//lib/rexml/element.rb#289
1917
+ def context; end
1918
+
1919
+ # The context holds information about the processing environment, such as
1920
+ # whitespace handling.
1921
+ #
1922
+ # source://rexml//lib/rexml/element.rb#289
1923
+ def context=(_arg0); end
1924
+
1925
+ # :call-seq:
1926
+ # delete_attribute(name) -> removed_attribute or nil
1927
+ #
1928
+ # Removes a named attribute if it exists;
1929
+ # returns the removed attribute if found, otherwise +nil+:
1930
+ #
1931
+ # e = REXML::Element.new('foo')
1932
+ # e.add_attribute('bar', 'baz')
1933
+ # e.delete_attribute('bar') # => <bar/>
1934
+ # e.delete_attribute('bar') # => nil
1935
+ #
1936
+ # source://rexml//lib/rexml/element.rb#1399
1937
+ def delete_attribute(key); end
1938
+
1939
+ # :call-seq:
1940
+ # delete_element(index) -> removed_element or nil
1941
+ # delete_element(element) -> removed_element or nil
1942
+ # delete_element(xpath) -> removed_element or nil
1943
+ #
1944
+ # Deletes a child element.
1945
+ #
1946
+ # When 1-based integer argument +index+ is given,
1947
+ # removes and returns the child element at that offset if it exists;
1948
+ # indexing does not include text nodes;
1949
+ # returns +nil+ if the element does not exist:
1950
+ #
1951
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
1952
+ # a = d.root # => <a> ... </>
1953
+ # a.delete_element(1) # => <b/>
1954
+ # a.delete_element(1) # => <c/>
1955
+ # a.delete_element(1) # => nil
1956
+ #
1957
+ # When element argument +element+ is given,
1958
+ # removes and returns that child element if it exists,
1959
+ # otherwise returns +nil+:
1960
+ #
1961
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
1962
+ # a = d.root # => <a> ... </>
1963
+ # c = a[2] # => <c/>
1964
+ # a.delete_element(c) # => <c/>
1965
+ # a.delete_element(c) # => nil
1966
+ #
1967
+ # When xpath argument +xpath+ is given,
1968
+ # removes and returns the element at xpath if it exists,
1969
+ # otherwise returns +nil+:
1970
+ #
1971
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
1972
+ # a = d.root # => <a> ... </>
1973
+ # a.delete_element('//c') # => <c/>
1974
+ # a.delete_element('//c') # => nil
1975
+ #
1976
+ # source://rexml//lib/rexml/element.rb#777
1977
+ def delete_element(element); end
1978
+
1979
+ # :call-seq:
1980
+ # delete_namespace(namespace = 'xmlns') -> self
1981
+ #
1982
+ # Removes a namespace from the element.
1983
+ #
1984
+ # With no argument, removes the default namespace:
1985
+ #
1986
+ # d = REXML::Document.new "<a xmlns:foo='bar' xmlns='twiddle'/>"
1987
+ # d.to_s # => "<a xmlns:foo='bar' xmlns='twiddle'/>"
1988
+ # d.root.delete_namespace # => <a xmlns:foo='bar'/>
1989
+ # d.to_s # => "<a xmlns:foo='bar'/>"
1990
+ #
1991
+ # With argument +namespace+, removes the specified namespace:
1992
+ #
1993
+ # d.root.delete_namespace('foo')
1994
+ # d.to_s # => "<a/>"
1995
+ #
1996
+ # Does nothing if no such namespace is found:
1997
+ #
1998
+ # d.root.delete_namespace('nosuch')
1999
+ # d.to_s # => "<a/>"
2000
+ #
2001
+ # source://rexml//lib/rexml/element.rb#686
2002
+ def delete_namespace(namespace = T.unsafe(nil)); end
2003
+
2004
+ # :call-seq:
2005
+ # document -> document or nil
2006
+ #
2007
+ # If the element is part of a document, returns that document:
2008
+ #
2009
+ # d = REXML::Document.new('<a><b><c/></b></a>')
2010
+ # top_element = d.first
2011
+ # child = top_element.first
2012
+ # top_element.document == d # => true
2013
+ # child.document == d # => true
2014
+ #
2015
+ # If the element is not part of a document, returns +nil+:
2016
+ #
2017
+ # REXML::Element.new.document # => nil
2018
+ #
2019
+ # For a document, returns +self+:
2020
+ #
2021
+ # d.document == d # => true
2022
+ #
2023
+ # Related: #root, #root_node.
2024
+ #
2025
+ # source://rexml//lib/rexml/element.rb#478
2026
+ def document; end
2027
+
2028
+ # :call-seq:
2029
+ # each_element {|e| ... }
2030
+ #
2031
+ # Calls the given block with each child element:
2032
+ #
2033
+ # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2034
+ # a = d.root
2035
+ # a.each_element {|e| p e }
2036
+ #
2037
+ # Output:
2038
+ #
2039
+ # <b> ... </>
2040
+ # <c> ... </>
2041
+ # <d> ... </>
2042
+ # <e/>
2043
+ #
2044
+ # source://rexml//lib/rexml/element.rb#929
2045
+ def each_element(xpath = T.unsafe(nil), &block); end
2046
+
2047
+ # :call-seq:
2048
+ # each_element_with_attribute(attr_name, value = nil, max = 0, xpath = nil) {|e| ... }
2049
+ #
2050
+ # Calls the given block with each child element that meets given criteria.
2051
+ #
2052
+ # When only string argument +attr_name+ is given,
2053
+ # calls the block with each child element that has that attribute:
2054
+ #
2055
+ # d = REXML::Document.new '<a><b id="1"/><c id="2"/><d id="1"/><e/></a>'
2056
+ # a = d.root
2057
+ # a.each_element_with_attribute('id') {|e| p e }
2058
+ #
2059
+ # Output:
2060
+ #
2061
+ # <b id='1'/>
2062
+ # <c id='2'/>
2063
+ # <d id='1'/>
2064
+ #
2065
+ # With argument +attr_name+ and string argument +value+ given,
2066
+ # calls the block with each child element that has that attribute
2067
+ # with that value:
2068
+ #
2069
+ # a.each_element_with_attribute('id', '1') {|e| p e }
2070
+ #
2071
+ # Output:
2072
+ #
2073
+ # <b id='1'/>
2074
+ # <d id='1'/>
2075
+ #
2076
+ # With arguments +attr_name+, +value+, and integer argument +max+ given,
2077
+ # calls the block with at most +max+ child elements:
2078
+ #
2079
+ # a.each_element_with_attribute('id', '1', 1) {|e| p e }
2080
+ #
2081
+ # Output:
2082
+ #
2083
+ # <b id='1'/>
2084
+ #
2085
+ # With all arguments given, including +xpath+,
2086
+ # calls the block with only those child elements
2087
+ # that meet the first three criteria,
2088
+ # and also match the given +xpath+:
2089
+ #
2090
+ # a.each_element_with_attribute('id', '1', 2, '//d') {|e| p e }
2091
+ #
2092
+ # Output:
2093
+ #
2094
+ # <d id='1'/>
2095
+ #
2096
+ # source://rexml//lib/rexml/element.rb#846
2097
+ def each_element_with_attribute(key, value = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2098
+
2099
+ # :call-seq:
2100
+ # each_element_with_text(text = nil, max = 0, xpath = nil) {|e| ... }
2101
+ #
2102
+ # Calls the given block with each child element that meets given criteria.
2103
+ #
2104
+ # With no arguments, calls the block with each child element that has text:
2105
+ #
2106
+ # d = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
2107
+ # a = d.root
2108
+ # a.each_element_with_text {|e| p e }
2109
+ #
2110
+ # Output:
2111
+ #
2112
+ # <b> ... </>
2113
+ # <c> ... </>
2114
+ # <d> ... </>
2115
+ #
2116
+ # With the single string argument +text+,
2117
+ # calls the block with each element that has exactly that text:
2118
+ #
2119
+ # a.each_element_with_text('b') {|e| p e }
2120
+ #
2121
+ # Output:
2122
+ #
2123
+ # <b> ... </>
2124
+ # <c> ... </>
2125
+ #
2126
+ # With argument +text+ and integer argument +max+,
2127
+ # calls the block with at most +max+ elements:
2128
+ #
2129
+ # a.each_element_with_text('b', 1) {|e| p e }
2130
+ #
2131
+ # Output:
2132
+ #
2133
+ # <b> ... </>
2134
+ #
2135
+ # With all arguments given, including +xpath+,
2136
+ # calls the block with only those child elements
2137
+ # that meet the first two criteria,
2138
+ # and also match the given +xpath+:
2139
+ #
2140
+ # a.each_element_with_text('b', 2, '//c') {|e| p e }
2141
+ #
2142
+ # Output:
2143
+ #
2144
+ # <c> ... </>
2145
+ #
2146
+ # source://rexml//lib/rexml/element.rb#903
2147
+ def each_element_with_text(text = T.unsafe(nil), max = T.unsafe(nil), name = T.unsafe(nil), &block); end
2148
+
2149
+ # Mechanisms for accessing attributes and child elements of this
2150
+ # element.
2151
+ #
2152
+ # source://rexml//lib/rexml/element.rb#286
2153
+ def elements; end
2154
+
2155
+ # :call-seq:
2156
+ # get_elements(xpath)
2157
+ #
2158
+ # Returns an array of the elements that match the given +xpath+:
2159
+ #
2160
+ # xml_string = <<-EOT
2161
+ # <root>
2162
+ # <a level='1'>
2163
+ # <a level='2'/>
2164
+ # </a>
2165
+ # </root>
2166
+ # EOT
2167
+ # d = REXML::Document.new(xml_string)
2168
+ # d.root.get_elements('//a') # => [<a level='1'> ... </>, <a level='2'/>]
2169
+ #
2170
+ # source://rexml//lib/rexml/element.rb#948
2171
+ def get_elements(xpath); end
2172
+
2173
+ # :call-seq:
2174
+ # get_text(xpath = nil) -> text_node or nil
2175
+ #
2176
+ # Returns the first text node child in a specified element, if it exists,
2177
+ # +nil+ otherwise.
2178
+ #
2179
+ # With no argument, returns the first text node from +self+:
2180
+ #
2181
+ # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2182
+ # d.root.get_text.class # => REXML::Text
2183
+ # d.root.get_text # => "some text "
2184
+ #
2185
+ # With argument +xpath+, returns the first text node from the element
2186
+ # that matches +xpath+:
2187
+ #
2188
+ # d.root.get_text(1) # => "this is bold!"
2189
+ #
2190
+ # source://rexml//lib/rexml/element.rb#1052
2191
+ def get_text(path = T.unsafe(nil)); end
2192
+
2193
+ # :call-seq:
2194
+ # has_attributes? -> true or false
2195
+ #
2196
+ # Returns +true+ if the element has attributes, +false+ otherwise:
2197
+ #
2198
+ # d = REXML::Document.new('<root><a attr="val"/><b/></root>')
2199
+ # a, b = *d.root
2200
+ # a.has_attributes? # => true
2201
+ # b.has_attributes? # => false
2202
+ #
2203
+ # @return [Boolean]
2204
+ #
2205
+ # source://rexml//lib/rexml/element.rb#1319
2206
+ def has_attributes?; end
2207
+
2208
+ # :call-seq:
2209
+ # has_elements?
2210
+ #
2211
+ # Returns +true+ if the element has one or more element children,
2212
+ # +false+ otherwise:
2213
+ #
2214
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
2215
+ # a = d.root # => <a> ... </>
2216
+ # a.has_elements? # => true
2217
+ # b = a[0] # => <b/>
2218
+ # b.has_elements? # => false
2219
+ #
2220
+ # @return [Boolean]
2221
+ #
2222
+ # source://rexml//lib/rexml/element.rb#793
2223
+ def has_elements?; end
2224
+
2225
+ # :call-seq:
2226
+ # has_text? -> true or false
2227
+ #
2228
+ # Returns +true+ if the element has one or more text noded,
2229
+ # +false+ otherwise:
2230
+ #
2231
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
2232
+ # a = d.root
2233
+ # a.has_text? # => true
2234
+ # b = a[0]
2235
+ # b.has_text? # => false
2236
+ #
2237
+ # @return [Boolean]
2238
+ #
2239
+ # source://rexml//lib/rexml/element.rb#1001
2240
+ def has_text?; end
2241
+
2242
+ # :call-seq:
2243
+ # ignore_whitespace_nodes
2244
+ #
2245
+ # Returns +true+ if whitespace nodes are ignored for the element.
2246
+ #
2247
+ # See {Element Context}[../doc/rexml/context_rdoc.html].
2248
+ #
2249
+ # source://rexml//lib/rexml/element.rb#516
2250
+ def ignore_whitespace_nodes; end
2251
+
2252
+ # :call-seq:
2253
+ # inspect -> string
2254
+ #
2255
+ # Returns a string representation of the element.
2256
+ #
2257
+ # For an element with no attributes and no children, shows the element name:
2258
+ #
2259
+ # REXML::Element.new.inspect # => "<UNDEFINED/>"
2260
+ #
2261
+ # Shows attributes, if any:
2262
+ #
2263
+ # e = REXML::Element.new('foo')
2264
+ # e.add_attributes({'bar' => 0, 'baz' => 1})
2265
+ # e.inspect # => "<foo bar='0' baz='1'/>"
2266
+ #
2267
+ # Shows an ellipsis (<tt>...</tt>), if there are child elements:
2268
+ #
2269
+ # e.add_element(REXML::Element.new('bar'))
2270
+ # e.add_element(REXML::Element.new('baz'))
2271
+ # e.inspect # => "<foo bar='0' baz='1'> ... </>"
2272
+ #
2273
+ # source://rexml//lib/rexml/element.rb#366
2274
+ def inspect; end
2275
+
2276
+ # :call-seq:
2277
+ # instructions -> array_of_instruction_children
2278
+ #
2279
+ # Returns a frozen array of the REXML::Instruction children of the element:
2280
+ #
2281
+ # xml_string = <<-EOT
2282
+ # <root>
2283
+ # <?target0 foo?>
2284
+ # <?target1 bar?>
2285
+ # </root>
2286
+ # EOT
2287
+ # d = REXML::Document.new(xml_string)
2288
+ # is = d.root.instructions
2289
+ # is.frozen? # => true
2290
+ # is.map {|i| i.class } # => [REXML::Instruction, REXML::Instruction]
2291
+ # is.map {|i| i.to_s } # => ["<?target0 foo?>", "<?target1 bar?>"]
2292
+ #
2293
+ # source://rexml//lib/rexml/element.rb#1466
2294
+ def instructions; end
2295
+
2296
+ # :call-seq:
2297
+ # namespace(prefix = nil) -> string_uri or nil
2298
+ #
2299
+ # Returns the string namespace URI for the element,
2300
+ # possibly deriving from one of its ancestors.
2301
+ #
2302
+ # xml_string = <<-EOT
2303
+ # <root>
2304
+ # <a xmlns='1' xmlns:y='2'>
2305
+ # <b/>
2306
+ # <c xmlns:z='3'/>
2307
+ # </a>
2308
+ # </root>
2309
+ # EOT
2310
+ # d = REXML::Document.new(xml_string)
2311
+ # b = d.elements['//b']
2312
+ # b.namespace # => "1"
2313
+ # b.namespace('y') # => "2"
2314
+ # b.namespace('nosuch') # => nil
2315
+ #
2316
+ # source://rexml//lib/rexml/element.rb#621
2317
+ def namespace(prefix = T.unsafe(nil)); end
2318
+
2319
+ # :call-seq:
2320
+ # namespaces -> array_of_namespace_names
2321
+ #
2322
+ # Returns a hash of all defined namespaces
2323
+ # in the element and its ancestors:
2324
+ #
2325
+ # xml_string = <<-EOT
2326
+ # <root>
2327
+ # <a xmlns:x='1' xmlns:y='2'>
2328
+ # <b/>
2329
+ # <c xmlns:z='3'/>
2330
+ # </a>
2331
+ # </root>
2332
+ # EOT
2333
+ # d = REXML::Document.new(xml_string)
2334
+ # d.elements['//a'].namespaces # => {"x"=>"1", "y"=>"2"}
2335
+ # d.elements['//b'].namespaces # => {"x"=>"1", "y"=>"2"}
2336
+ # d.elements['//c'].namespaces # => {"x"=>"1", "y"=>"2", "z"=>"3"}
2337
+ #
2338
+ # source://rexml//lib/rexml/element.rb#594
2339
+ def namespaces; end
2340
+
2341
+ # :call-seq:
2342
+ # next_element
2343
+ #
2344
+ # Returns the next sibling that is an element if it exists,
2345
+ # +niL+ otherwise:
2346
+ #
2347
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
2348
+ # d.root.elements['b'].next_element #-> <c/>
2349
+ # d.root.elements['c'].next_element #-> nil
2350
+ #
2351
+ # source://rexml//lib/rexml/element.rb#962
2352
+ def next_element; end
2353
+
2354
+ # :call-seq:
2355
+ # node_type -> :element
2356
+ #
2357
+ # Returns symbol <tt>:element</tt>:
2358
+ #
2359
+ # d = REXML::Document.new('<a/>')
2360
+ # a = d.root # => <a/>
2361
+ # a.node_type # => :element
2362
+ #
2363
+ # source://rexml//lib/rexml/element.rb#1167
2364
+ def node_type; end
2365
+
2366
+ # :call-seq:
2367
+ # prefixes -> array_of_namespace_prefixes
2368
+ #
2369
+ # Returns an array of the string prefixes (names) of all defined namespaces
2370
+ # in the element and its ancestors:
2371
+ #
2372
+ # xml_string = <<-EOT
2373
+ # <root>
2374
+ # <a xmlns:x='1' xmlns:y='2'>
2375
+ # <b/>
2376
+ # <c xmlns:z='3'/>
2377
+ # </a>
2378
+ # </root>
2379
+ # EOT
2380
+ # d = REXML::Document.new(xml_string, {compress_whitespace: :all})
2381
+ # d.elements['//a'].prefixes # => ["x", "y"]
2382
+ # d.elements['//b'].prefixes # => ["x", "y"]
2383
+ # d.elements['//c'].prefixes # => ["x", "y", "z"]
2384
+ #
2385
+ # source://rexml//lib/rexml/element.rb#568
2386
+ def prefixes; end
2387
+
2388
+ # :call-seq:
2389
+ # previous_element
2390
+ #
2391
+ # Returns the previous sibling that is an element if it exists,
2392
+ # +niL+ otherwise:
2393
+ #
2394
+ # d = REXML::Document.new '<a><b/>text<c/></a>'
2395
+ # d.root.elements['c'].previous_element #-> <b/>
2396
+ # d.root.elements['b'].previous_element #-> nil
2397
+ #
2398
+ # source://rexml//lib/rexml/element.rb#978
2399
+ def previous_element; end
2400
+
2401
+ # :call-seq:
2402
+ # raw
2403
+ #
2404
+ # Returns +true+ if raw mode is set for the element.
2405
+ #
2406
+ # See {Element Context}[../doc/rexml/context_rdoc.html].
2407
+ #
2408
+ # The evaluation is tested against +expanded_name+, and so is namespace
2409
+ # sensitive.
2410
+ #
2411
+ # source://rexml//lib/rexml/element.rb#536
2412
+ def raw; end
2413
+
2414
+ # :call-seq:
2415
+ # root -> element
2416
+ #
2417
+ # Returns the most distant _element_ (not document) ancestor of the element:
2418
+ #
2419
+ # d = REXML::Document.new('<a><b><c/></b></a>')
2420
+ # top_element = d.first
2421
+ # child = top_element.first
2422
+ # top_element.root == top_element # => true
2423
+ # child.root == top_element # => true
2424
+ #
2425
+ # For a document, returns the topmost element:
2426
+ #
2427
+ # d.root == top_element # => true
2428
+ #
2429
+ # Related: #root_node, #document.
2430
+ #
2431
+ # source://rexml//lib/rexml/element.rb#451
2432
+ def root; end
2433
+
2434
+ # :call-seq:
2435
+ # root_node -> document or element
2436
+ #
2437
+ # Returns the most distant ancestor of +self+.
2438
+ #
2439
+ # When the element is part of a document,
2440
+ # returns the root node of the document.
2441
+ # Note that the root node is different from the document element;
2442
+ # in this example +a+ is document element and the root node is its parent:
2443
+ #
2444
+ # d = REXML::Document.new('<a><b><c/></b></a>')
2445
+ # top_element = d.first # => <a> ... </>
2446
+ # child = top_element.first # => <b> ... </>
2447
+ # d.root_node == d # => true
2448
+ # top_element.root_node == d # => true
2449
+ # child.root_node == d # => true
2450
+ #
2451
+ # When the element is not part of a document, but does have ancestor elements,
2452
+ # returns the most distant ancestor element:
2453
+ #
2454
+ # e0 = REXML::Element.new('foo')
2455
+ # e1 = REXML::Element.new('bar')
2456
+ # e1.parent = e0
2457
+ # e2 = REXML::Element.new('baz')
2458
+ # e2.parent = e1
2459
+ # e2.root_node == e0 # => true
2460
+ #
2461
+ # When the element has no ancestor elements,
2462
+ # returns +self+:
2463
+ #
2464
+ # e = REXML::Element.new('foo')
2465
+ # e.root_node == e # => true
2466
+ #
2467
+ # Related: #root, #document.
2468
+ #
2469
+ # source://rexml//lib/rexml/element.rb#430
2470
+ def root_node; end
2471
+
2472
+ # :call-seq:
2473
+ # text(xpath = nil) -> text_string or nil
2474
+ #
2475
+ # Returns the text string from the first text node child
2476
+ # in a specified element, if it exists, +nil+ otherwise.
2477
+ #
2478
+ # With no argument, returns the text from the first text node in +self+:
2479
+ #
2480
+ # d = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
2481
+ # d.root.text.class # => String
2482
+ # d.root.text # => "some text "
2483
+ #
2484
+ # With argument +xpath+, returns text from the first text node
2485
+ # in the element that matches +xpath+:
2486
+ #
2487
+ # d.root.text(1) # => "this is bold!"
2488
+ #
2489
+ # Note that an element may have multiple text nodes,
2490
+ # possibly separated by other non-text children, as above.
2491
+ # Even so, the returned value is the string text from the first such node.
2492
+ #
2493
+ # Note also that the text note is retrieved by method get_text,
2494
+ # and so is always normalized text.
2495
+ #
2496
+ # source://rexml//lib/rexml/element.rb#1029
2497
+ def text(path = T.unsafe(nil)); end
2498
+
2499
+ # :call-seq:
2500
+ # text = string -> string
2501
+ # text = nil -> nil
2502
+ #
2503
+ # Adds, replaces, or removes the first text node child in the element.
2504
+ #
2505
+ # With string argument +string+,
2506
+ # creates a new \REXML::Text node containing that string,
2507
+ # honoring the current settings for whitespace and row,
2508
+ # then places the node as the first text child in the element;
2509
+ # returns +string+.
2510
+ #
2511
+ # If the element has no text child, the text node is added:
2512
+ #
2513
+ # d = REXML::Document.new '<a><b/></a>'
2514
+ # d.root.text = 'foo' #-> '<a><b/>foo</a>'
2515
+ #
2516
+ # If the element has a text child, it is replaced:
2517
+ #
2518
+ # d.root.text = 'bar' #-> '<a><b/>bar</a>'
2519
+ #
2520
+ # With argument +nil+, removes the first text child:
2521
+ #
2522
+ # d.root.text = nil #-> '<a><b/><c/></a>'
2523
+ #
2524
+ # source://rexml//lib/rexml/element.rb#1088
2525
+ def text=(text); end
2526
+
2527
+ # :call-seq:
2528
+ # texts -> array_of_text_children
2529
+ #
2530
+ # Returns a frozen array of the REXML::Text children of the element:
2531
+ #
2532
+ # xml_string = '<root><a/>text<b/>more<c/></root>'
2533
+ # d = REXML::Document.new(xml_string)
2534
+ # ts = d.root.texts
2535
+ # ts.frozen? # => true
2536
+ # ts.map {|t| t.class } # => [REXML::Text, REXML::Text]
2537
+ # ts.map {|t| t.to_s } # => ["text", "more"]
2538
+ #
2539
+ # source://rexml//lib/rexml/element.rb#1482
2540
+ def texts; end
2541
+
2542
+ # :call-seq:
2543
+ # whitespace
2544
+ #
2545
+ # Returns +true+ if whitespace is respected for this element,
2546
+ # +false+ otherwise.
2547
+ #
2548
+ # See {Element Context}[../doc/rexml/context_rdoc.html].
2549
+ #
2550
+ # The evaluation is tested against the element's +expanded_name+,
2551
+ # and so is namespace-sensitive.
2552
+ #
2553
+ # source://rexml//lib/rexml/element.rb#493
2554
+ def whitespace; end
2555
+
2556
+ # == DEPRECATED
2557
+ # See REXML::Formatters
2558
+ #
2559
+ # Writes out this element, and recursively, all children.
2560
+ # output::
2561
+ # output an object which supports '<< string'; this is where the
2562
+ # document will be written.
2563
+ # indent::
2564
+ # An integer. If -1, no indenting will be used; otherwise, the
2565
+ # indentation will be this number of spaces, and children will be
2566
+ # indented an additional amount. Defaults to -1
2567
+ # transitive::
2568
+ # If transitive is true and indent is >= 0, then the output will be
2569
+ # pretty-printed in such a way that the added whitespace does not affect
2570
+ # the parse tree of the document
2571
+ # ie_hack::
2572
+ # This hack inserts a space before the /> on empty tags to address
2573
+ # a limitation of Internet Explorer. Defaults to false
2574
+ #
2575
+ # out = ''
2576
+ # doc.write( out ) #-> doc is written to the string 'out'
2577
+ # doc.write( $stdout ) #-> doc written to the console
2578
+ #
2579
+ # source://rexml//lib/rexml/element.rb#1508
2580
+ def write(output = T.unsafe(nil), indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
2581
+
2582
+ # :call-seq:
2583
+ # xpath -> string_xpath
2584
+ #
2585
+ # Returns the string xpath to the element
2586
+ # relative to the most distant parent:
2587
+ #
2588
+ # d = REXML::Document.new('<a><b><c/></b></a>')
2589
+ # a = d.root # => <a> ... </>
2590
+ # b = a[0] # => <b> ... </>
2591
+ # c = b[0] # => <c/>
2592
+ # d.xpath # => ""
2593
+ # a.xpath # => "/a"
2594
+ # b.xpath # => "/a/b"
2595
+ # c.xpath # => "/a/b/c"
2596
+ #
2597
+ # If there is no parent, returns the expanded name of the element:
2598
+ #
2599
+ # e = REXML::Element.new('foo')
2600
+ # e.xpath # => "foo"
2601
+ #
2602
+ # source://rexml//lib/rexml/element.rb#1191
2603
+ def xpath; end
2604
+
2605
+ private
2606
+
2607
+ # source://rexml//lib/rexml/element.rb#1525
2608
+ def __to_xpath_helper(node); end
2609
+
2610
+ # A private helper method
2611
+ #
2612
+ # source://rexml//lib/rexml/element.rb#1540
2613
+ def each_with_something(test, max = T.unsafe(nil), name = T.unsafe(nil)); end
2614
+ end
2615
+
2616
+ # source://rexml//lib/rexml/doctype.rb#261
2617
+ class REXML::ElementDecl < ::REXML::Declaration
2618
+ # @return [ElementDecl] a new instance of ElementDecl
2619
+ #
2620
+ # source://rexml//lib/rexml/doctype.rb#262
2621
+ def initialize(src); end
2622
+ end
2623
+
2624
+ # A class which provides filtering of children for Elements, and
2625
+ # XPath search support. You are expected to only encounter this class as
2626
+ # the <tt>element.elements</tt> object. Therefore, you are
2627
+ # _not_ expected to instantiate this yourself.
2628
+ #
2629
+ # xml_string = <<-EOT
2630
+ # <?xml version="1.0" encoding="UTF-8"?>
2631
+ # <bookstore>
2632
+ # <book category="cooking">
2633
+ # <title lang="en">Everyday Italian</title>
2634
+ # <author>Giada De Laurentiis</author>
2635
+ # <year>2005</year>
2636
+ # <price>30.00</price>
2637
+ # </book>
2638
+ # <book category="children">
2639
+ # <title lang="en">Harry Potter</title>
2640
+ # <author>J K. Rowling</author>
2641
+ # <year>2005</year>
2642
+ # <price>29.99</price>
2643
+ # </book>
2644
+ # <book category="web">
2645
+ # <title lang="en">XQuery Kick Start</title>
2646
+ # <author>James McGovern</author>
2647
+ # <author>Per Bothner</author>
2648
+ # <author>Kurt Cagle</author>
2649
+ # <author>James Linn</author>
2650
+ # <author>Vaidyanathan Nagarajan</author>
2651
+ # <year>2003</year>
2652
+ # <price>49.99</price>
2653
+ # </book>
2654
+ # <book category="web" cover="paperback">
2655
+ # <title lang="en">Learning XML</title>
2656
+ # <author>Erik T. Ray</author>
2657
+ # <year>2003</year>
2658
+ # <price>39.95</price>
2659
+ # </book>
2660
+ # </bookstore>
2661
+ # EOT
2662
+ # d = REXML::Document.new(xml_string)
2663
+ # elements = d.root.elements
2664
+ # elements # => #<REXML::Elements @element=<bookstore> ... </>>
2665
+ #
2666
+ # source://rexml//lib/rexml/element.rb#1595
2667
+ class REXML::Elements
2668
+ include ::Enumerable
2669
+
2670
+ # :call-seq:
2671
+ # new(parent) -> new_elements_object
2672
+ #
2673
+ # Returns a new \Elements object with the given +parent+.
2674
+ # Does _not_ assign <tt>parent.elements = self</tt>:
2675
+ #
2676
+ # d = REXML::Document.new(xml_string)
2677
+ # eles = REXML::Elements.new(d.root)
2678
+ # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2679
+ # eles == d.root.elements # => false
2680
+ #
2681
+ # @return [Elements] a new instance of Elements
2682
+ #
2683
+ # source://rexml//lib/rexml/element.rb#1608
2684
+ def initialize(parent); end
2685
+
2686
+ # :call-seq:
2687
+ # add -> new_element
2688
+ # add(name) -> new_element
2689
+ # add(element) -> element
2690
+ #
2691
+ # Adds an element; returns the element added.
2692
+ #
2693
+ # With no argument, creates and adds a new element.
2694
+ # The new element has:
2695
+ #
2696
+ # - No name.
2697
+ # - \Parent from the \Elements object.
2698
+ # - Context from the that parent.
2699
+ #
2700
+ # Example:
2701
+ #
2702
+ # d = REXML::Document.new(xml_string)
2703
+ # elements = d.root.elements
2704
+ # parent = elements.parent # => <bookstore> ... </>
2705
+ # parent.context = {raw: :all}
2706
+ # elements.size # => 4
2707
+ # new_element = elements.add # => </>
2708
+ # elements.size # => 5
2709
+ # new_element.name # => nil
2710
+ # new_element.parent # => <bookstore> ... </>
2711
+ # new_element.context # => {:raw=>:all}
2712
+ #
2713
+ # With string argument +name+, creates and adds a new element.
2714
+ # The new element has:
2715
+ #
2716
+ # - Name +name+.
2717
+ # - \Parent from the \Elements object.
2718
+ # - Context from the that parent.
2719
+ #
2720
+ # Example:
2721
+ #
2722
+ # d = REXML::Document.new(xml_string)
2723
+ # elements = d.root.elements
2724
+ # parent = elements.parent # => <bookstore> ... </>
2725
+ # parent.context = {raw: :all}
2726
+ # elements.size # => 4
2727
+ # new_element = elements.add('foo') # => <foo/>
2728
+ # elements.size # => 5
2729
+ # new_element.name # => "foo"
2730
+ # new_element.parent # => <bookstore> ... </>
2731
+ # new_element.context # => {:raw=>:all}
2732
+ #
2733
+ # With argument +element+,
2734
+ # creates and adds a clone of the given +element+.
2735
+ # The new element has name, parent, and context from the given +element+.
2736
+ #
2737
+ # d = REXML::Document.new(xml_string)
2738
+ # elements = d.root.elements
2739
+ # elements.size # => 4
2740
+ # e0 = REXML::Element.new('foo')
2741
+ # e1 = REXML::Element.new('bar', e0, {raw: :all})
2742
+ # element = elements.add(e1) # => <bar/>
2743
+ # elements.size # => 5
2744
+ # element.name # => "bar"
2745
+ # element.parent # => <bookstore> ... </>
2746
+ # element.context # => {:raw=>:all}
2747
+ #
2748
+ # source://rexml//lib/rexml/element.rb#1925
2749
+ def <<(element = T.unsafe(nil)); end
2750
+
2751
+ # :call-seq:
2752
+ # elements[index] -> element or nil
2753
+ # elements[xpath] -> element or nil
2754
+ # elements[n, name] -> element or nil
2755
+ #
2756
+ # Returns the first \Element object selected by the arguments,
2757
+ # if any found, or +nil+ if none found.
2758
+ #
2759
+ # Notes:
2760
+ # - The +index+ is 1-based, not 0-based, so that:
2761
+ # - The first element has index <tt>1</tt>
2762
+ # - The _nth_ element has index +n+.
2763
+ # - The selection ignores non-\Element nodes.
2764
+ #
2765
+ # When the single argument +index+ is given,
2766
+ # returns the element given by the index, if any; otherwise, +nil+:
2767
+ #
2768
+ # d = REXML::Document.new(xml_string)
2769
+ # eles = d.root.elements
2770
+ # eles # => #<REXML::Elements @element=<bookstore> ... </>>
2771
+ # eles[1] # => <book category='cooking'> ... </>
2772
+ # eles.size # => 4
2773
+ # eles[4] # => <book category='web' cover='paperback'> ... </>
2774
+ # eles[5] # => nil
2775
+ #
2776
+ # The node at this index is not an \Element, and so is not returned:
2777
+ #
2778
+ # eles = d.root.first.first # => <title lang='en'> ... </>
2779
+ # eles.to_a # => ["Everyday Italian"]
2780
+ # eles[1] # => nil
2781
+ #
2782
+ # When the single argument +xpath+ is given,
2783
+ # returns the first element found via that +xpath+, if any; otherwise, +nil+:
2784
+ #
2785
+ # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2786
+ # eles['/bookstore'] # => <bookstore> ... </>
2787
+ # eles['//book'] # => <book category='cooking'> ... </>
2788
+ # eles['//book [@category="children"]'] # => <book category='children'> ... </>
2789
+ # eles['/nosuch'] # => nil
2790
+ # eles['//nosuch'] # => nil
2791
+ # eles['//book [@category="nosuch"]'] # => nil
2792
+ # eles['.'] # => <bookstore> ... </>
2793
+ # eles['..'].class # => REXML::Document
2794
+ #
2795
+ # With arguments +n+ and +name+ given,
2796
+ # returns the _nth_ found element that has the given +name+,
2797
+ # or +nil+ if there is no such _nth_ element:
2798
+ #
2799
+ # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2800
+ # eles[1, 'book'] # => <book category='cooking'> ... </>
2801
+ # eles[4, 'book'] # => <book category='web' cover='paperback'> ... </>
2802
+ # eles[5, 'book'] # => nil
2803
+ #
2804
+ # source://rexml//lib/rexml/element.rb#1680
2805
+ def [](index, name = T.unsafe(nil)); end
2806
+
2807
+ # :call-seq:
2808
+ # elements[] = index, replacement_element -> replacement_element or nil
2809
+ #
2810
+ # Replaces or adds an element.
2811
+ #
2812
+ # When <tt>eles[index]</tt> exists, replaces it with +replacement_element+
2813
+ # and returns +replacement_element+:
2814
+ #
2815
+ # d = REXML::Document.new(xml_string)
2816
+ # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2817
+ # eles[1] # => <book category='cooking'> ... </>
2818
+ # eles[1] = REXML::Element.new('foo')
2819
+ # eles[1] # => <foo/>
2820
+ #
2821
+ # Does nothing (or raises an exception)
2822
+ # if +replacement_element+ is not an \Element:
2823
+ # eles[2] # => <book category='web' cover='paperback'> ... </>
2824
+ # eles[2] = REXML::Text.new('bar')
2825
+ # eles[2] # => <book category='web' cover='paperback'> ... </>
2826
+ #
2827
+ # When <tt>eles[index]</tt> does not exist,
2828
+ # adds +replacement_element+ to the element and returns
2829
+ #
2830
+ # d = REXML::Document.new(xml_string)
2831
+ # eles = d.root.elements # => #<REXML::Elements @element=<bookstore> ... </>>
2832
+ # eles.size # => 4
2833
+ # eles[50] = REXML::Element.new('foo') # => <foo/>
2834
+ # eles.size # => 5
2835
+ # eles[5] # => <foo/>
2836
+ #
2837
+ # Does nothing (or raises an exception)
2838
+ # if +replacement_element+ is not an \Element:
2839
+ #
2840
+ # eles[50] = REXML::Text.new('bar') # => "bar"
2841
+ # eles.size # => 5
2842
+ #
2843
+ # source://rexml//lib/rexml/element.rb#1735
2844
+ def []=(index, element); end
2845
+
2846
+ # :call-seq:
2847
+ # add -> new_element
2848
+ # add(name) -> new_element
2849
+ # add(element) -> element
2850
+ #
2851
+ # Adds an element; returns the element added.
2852
+ #
2853
+ # With no argument, creates and adds a new element.
2854
+ # The new element has:
2855
+ #
2856
+ # - No name.
2857
+ # - \Parent from the \Elements object.
2858
+ # - Context from the that parent.
2859
+ #
2860
+ # Example:
2861
+ #
2862
+ # d = REXML::Document.new(xml_string)
2863
+ # elements = d.root.elements
2864
+ # parent = elements.parent # => <bookstore> ... </>
2865
+ # parent.context = {raw: :all}
2866
+ # elements.size # => 4
2867
+ # new_element = elements.add # => </>
2868
+ # elements.size # => 5
2869
+ # new_element.name # => nil
2870
+ # new_element.parent # => <bookstore> ... </>
2871
+ # new_element.context # => {:raw=>:all}
2872
+ #
2873
+ # With string argument +name+, creates and adds a new element.
2874
+ # The new element has:
2875
+ #
2876
+ # - Name +name+.
2877
+ # - \Parent from the \Elements object.
2878
+ # - Context from the that parent.
2879
+ #
2880
+ # Example:
2881
+ #
2882
+ # d = REXML::Document.new(xml_string)
2883
+ # elements = d.root.elements
2884
+ # parent = elements.parent # => <bookstore> ... </>
2885
+ # parent.context = {raw: :all}
2886
+ # elements.size # => 4
2887
+ # new_element = elements.add('foo') # => <foo/>
2888
+ # elements.size # => 5
2889
+ # new_element.name # => "foo"
2890
+ # new_element.parent # => <bookstore> ... </>
2891
+ # new_element.context # => {:raw=>:all}
2892
+ #
2893
+ # With argument +element+,
2894
+ # creates and adds a clone of the given +element+.
2895
+ # The new element has name, parent, and context from the given +element+.
2896
+ #
2897
+ # d = REXML::Document.new(xml_string)
2898
+ # elements = d.root.elements
2899
+ # elements.size # => 4
2900
+ # e0 = REXML::Element.new('foo')
2901
+ # e1 = REXML::Element.new('bar', e0, {raw: :all})
2902
+ # element = elements.add(e1) # => <bar/>
2903
+ # elements.size # => 5
2904
+ # element.name # => "bar"
2905
+ # element.parent # => <bookstore> ... </>
2906
+ # element.context # => {:raw=>:all}
2907
+ #
2908
+ # source://rexml//lib/rexml/element.rb#1925
2909
+ def add(element = T.unsafe(nil)); end
2910
+
2911
+ # :call-seq:
2912
+ # collect(xpath = nil) {|element| ... } -> array
2913
+ #
2914
+ # Iterates over the elements; returns the array of block return values.
2915
+ #
2916
+ # With no argument, iterates over all elements:
2917
+ #
2918
+ # d = REXML::Document.new(xml_string)
2919
+ # elements = d.root.elements
2920
+ # elements.collect {|element| element.size } # => [9, 9, 17, 9]
2921
+ #
2922
+ # With argument +xpath+, iterates over elements that match
2923
+ # the given +xpath+:
2924
+ #
2925
+ # xpath = '//book [@category="web"]'
2926
+ # elements.collect(xpath) {|element| element.size } # => [17, 9]
2927
+ #
2928
+ # source://rexml//lib/rexml/element.rb#1988
2929
+ def collect(xpath = T.unsafe(nil)); end
2930
+
2931
+ # :call-seq:
2932
+ # delete(index) -> removed_element or nil
2933
+ # delete(element) -> removed_element or nil
2934
+ # delete(xpath) -> removed_element or nil
2935
+ #
2936
+ # Removes an element; returns the removed element, or +nil+ if none removed.
2937
+ #
2938
+ # With integer argument +index+ given,
2939
+ # removes the child element at that offset:
2940
+ #
2941
+ # d = REXML::Document.new(xml_string)
2942
+ # elements = d.root.elements
2943
+ # elements.size # => 4
2944
+ # elements[2] # => <book category='children'> ... </>
2945
+ # elements.delete(2) # => <book category='children'> ... </>
2946
+ # elements.size # => 3
2947
+ # elements[2] # => <book category='web'> ... </>
2948
+ # elements.delete(50) # => nil
2949
+ #
2950
+ # With element argument +element+ given,
2951
+ # removes that child element:
2952
+ #
2953
+ # d = REXML::Document.new(xml_string)
2954
+ # elements = d.root.elements
2955
+ # ele_1, ele_2, ele_3, ele_4 = *elements
2956
+ # elements.size # => 4
2957
+ # elements[2] # => <book category='children'> ... </>
2958
+ # elements.delete(ele_2) # => <book category='children'> ... </>
2959
+ # elements.size # => 3
2960
+ # elements[2] # => <book category='web'> ... </>
2961
+ # elements.delete(ele_2) # => nil
2962
+ #
2963
+ # With string argument +xpath+ given,
2964
+ # removes the first element found via that xpath:
2965
+ #
2966
+ # d = REXML::Document.new(xml_string)
2967
+ # elements = d.root.elements
2968
+ # elements.delete('//book') # => <book category='cooking'> ... </>
2969
+ # elements.delete('//book [@category="children"]') # => <book category='children'> ... </>
2970
+ # elements.delete('//nosuch') # => nil
2971
+ #
2972
+ # source://rexml//lib/rexml/element.rb#1825
2973
+ def delete(element); end
2974
+
2975
+ # :call-seq:
2976
+ # delete_all(xpath)
2977
+ #
2978
+ # Removes all elements found via the given +xpath+;
2979
+ # returns the array of removed elements, if any, else +nil+.
2980
+ #
2981
+ # d = REXML::Document.new(xml_string)
2982
+ # elements = d.root.elements
2983
+ # elements.size # => 4
2984
+ # deleted_elements = elements.delete_all('//book [@category="web"]')
2985
+ # deleted_elements.size # => 2
2986
+ # elements.size # => 2
2987
+ # deleted_elements = elements.delete_all('//book')
2988
+ # deleted_elements.size # => 2
2989
+ # elements.size # => 0
2990
+ # elements.delete_all('//book') # => []
2991
+ #
2992
+ # source://rexml//lib/rexml/element.rb#1851
2993
+ def delete_all(xpath); end
2994
+
2995
+ # :call-seq:
2996
+ # each(xpath = nil) {|element| ... } -> self
2997
+ #
2998
+ # Iterates over the elements.
2999
+ #
3000
+ # With no argument, calls the block with each element:
3001
+ #
3002
+ # d = REXML::Document.new(xml_string)
3003
+ # elements = d.root.elements
3004
+ # elements.each {|element| p element }
3005
+ #
3006
+ # Output:
3007
+ #
3008
+ # <book category='cooking'> ... </>
3009
+ # <book category='children'> ... </>
3010
+ # <book category='web'> ... </>
3011
+ # <book category='web' cover='paperback'> ... </>
3012
+ #
3013
+ # With argument +xpath+, calls the block with each element
3014
+ # that matches the given +xpath+:
3015
+ #
3016
+ # elements.each('//book [@category="web"]') {|element| p element }
3017
+ #
3018
+ # Output:
3019
+ #
3020
+ # <book category='web'> ... </>
3021
+ # <book category='web' cover='paperback'> ... </>
3022
+ #
3023
+ # source://rexml//lib/rexml/element.rb#1967
3024
+ def each(xpath = T.unsafe(nil)); end
3025
+
3026
+ # :call-seq:
3027
+ # empty? -> true or false
3028
+ #
3029
+ # Returns +true+ if there are no children, +false+ otherwise.
3030
+ #
3031
+ # d = REXML::Document.new('')
3032
+ # d.elements.empty? # => true
3033
+ # d = REXML::Document.new(xml_string)
3034
+ # d.elements.empty? # => false
3035
+ #
3036
+ # @return [Boolean]
3037
+ #
3038
+ # source://rexml//lib/rexml/element.rb#1755
3039
+ def empty?; end
3040
+
3041
+ # :call-seq:
3042
+ # index(element)
3043
+ #
3044
+ # Returns the 1-based index of the given +element+, if found;
3045
+ # otherwise, returns -1:
3046
+ #
3047
+ # d = REXML::Document.new(xml_string)
3048
+ # elements = d.root.elements
3049
+ # ele_1, ele_2, ele_3, ele_4 = *elements
3050
+ # elements.index(ele_4) # => 4
3051
+ # elements.delete(ele_3)
3052
+ # elements.index(ele_4) # => 3
3053
+ # elements.index(ele_3) # => -1
3054
+ #
3055
+ # source://rexml//lib/rexml/element.rb#1773
3056
+ def index(element); end
3057
+
3058
+ # :call-seq:
3059
+ # inject(xpath = nil, initial = nil) -> object
3060
+ #
3061
+ # Calls the block with elements; returns the last block return value.
3062
+ #
3063
+ # With no argument, iterates over the elements, calling the block
3064
+ # <tt>elements.size - 1</tt> times.
3065
+ #
3066
+ # - The first call passes the first and second elements.
3067
+ # - The second call passes the first block return value and the third element.
3068
+ # - The third call passes the second block return value and the fourth element.
3069
+ # - And so on.
3070
+ #
3071
+ # In this example, the block returns the passed element,
3072
+ # which is then the object argument to the next call:
3073
+ #
3074
+ # d = REXML::Document.new(xml_string)
3075
+ # elements = d.root.elements
3076
+ # elements.inject do |object, element|
3077
+ # p [elements.index(object), elements.index(element)]
3078
+ # element
3079
+ # end
3080
+ #
3081
+ # Output:
3082
+ #
3083
+ # [1, 2]
3084
+ # [2, 3]
3085
+ # [3, 4]
3086
+ #
3087
+ # With the single argument +xpath+, calls the block only with
3088
+ # elements matching that xpath:
3089
+ #
3090
+ # elements.inject('//book [@category="web"]') do |object, element|
3091
+ # p [elements.index(object), elements.index(element)]
3092
+ # element
3093
+ # end
3094
+ #
3095
+ # Output:
3096
+ #
3097
+ # [3, 4]
3098
+ #
3099
+ # With argument +xpath+ given as +nil+
3100
+ # and argument +initial+ also given,
3101
+ # calls the block once for each element.
3102
+ #
3103
+ # - The first call passes the +initial+ and the first element.
3104
+ # - The second call passes the first block return value and the second element.
3105
+ # - The third call passes the second block return value and the third element.
3106
+ # - And so on.
3107
+ #
3108
+ # In this example, the first object index is <tt>-1</tt>
3109
+ #
3110
+ # elements.inject(nil, 'Initial') do |object, element|
3111
+ # p [elements.index(object), elements.index(element)]
3112
+ # element
3113
+ # end
3114
+ #
3115
+ # Output:
3116
+ #
3117
+ # [-1, 1]
3118
+ # [1, 2]
3119
+ # [2, 3]
3120
+ # [3, 4]
3121
+ #
3122
+ # In this form the passed object can be used as an accumulator:
3123
+ #
3124
+ # elements.inject(nil, 0) do |total, element|
3125
+ # total += element.size
3126
+ # end # => 44
3127
+ #
3128
+ # With both arguments +xpath+ and +initial+ are given,
3129
+ # calls the block only with elements matching that xpath:
3130
+ #
3131
+ # elements.inject('//book [@category="web"]', 0) do |total, element|
3132
+ # total += element.size
3133
+ # end # => 26
3134
+ #
3135
+ # source://rexml//lib/rexml/element.rb#2073
3136
+ def inject(xpath = T.unsafe(nil), initial = T.unsafe(nil)); end
3137
+
3138
+ # :call-seq:
3139
+ # parent
3140
+ #
3141
+ # Returns the parent element cited in creating the \Elements object.
3142
+ # This element is also the default starting point for searching
3143
+ # in the \Elements object.
3144
+ #
3145
+ # d = REXML::Document.new(xml_string)
3146
+ # elements = REXML::Elements.new(d.root)
3147
+ # elements.parent == d.root # => true
3148
+ #
3149
+ # source://rexml//lib/rexml/element.rb#1623
3150
+ def parent; end
3151
+
3152
+ # :call-seq:
3153
+ # size -> integer
3154
+ #
3155
+ # Returns the count of \Element children:
3156
+ #
3157
+ # d = REXML::Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
3158
+ # d.root.elements.size # => 3 # Three elements.
3159
+ # d.root.size # => 6 # Three elements plus three text nodes..
3160
+ #
3161
+ # source://rexml//lib/rexml/element.rb#2097
3162
+ def size; end
3163
+
3164
+ # :call-seq:
3165
+ # to_a(xpath = nil) -> array_of_elements
3166
+ #
3167
+ # Returns an array of element children (not including non-element children).
3168
+ #
3169
+ # With no argument, returns an array of all element children:
3170
+ #
3171
+ # d = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
3172
+ # elements = d.root.elements
3173
+ # elements.to_a # => [<b/>, <c/>] # Omits non-element children.
3174
+ # children = d.root.children
3175
+ # children # => ["sean", <b/>, "elliott", <c/>] # Includes non-element children.
3176
+ #
3177
+ # With argument +xpath+, returns an array of element children
3178
+ # that match the xpath:
3179
+ #
3180
+ # elements.to_a('//c') # => [<c/>]
3181
+ #
3182
+ # source://rexml//lib/rexml/element.rb#2121
3183
+ def to_a(xpath = T.unsafe(nil)); end
3184
+
3185
+ private
3186
+
3187
+ # Private helper class. Removes quotes from quoted strings
3188
+ #
3189
+ # source://rexml//lib/rexml/element.rb#2129
3190
+ def literalize(name); end
3191
+ end
3192
+
3193
+ # source://rexml//lib/rexml/encoding.rb#4
3194
+ module REXML::Encoding
3195
+ # source://rexml//lib/rexml/encoding.rb#29
3196
+ def decode(string); end
3197
+
3198
+ # source://rexml//lib/rexml/encoding.rb#25
3199
+ def encode(string); end
3200
+
3201
+ # ID ---> Encoding name
3202
+ #
3203
+ # source://rexml//lib/rexml/encoding.rb#6
3204
+ def encoding; end
3205
+
3206
+ # source://rexml//lib/rexml/encoding.rb#7
3207
+ def encoding=(encoding); end
3208
+
3209
+ private
3210
+
3211
+ # source://rexml//lib/rexml/encoding.rb#34
3212
+ def find_encoding(name); end
3213
+ end
3214
+
3215
+ # source://rexml//lib/rexml/entity.rb#7
3216
+ class REXML::Entity < ::REXML::Child
3217
+ include ::REXML::XMLTokens
3218
+
3219
+ # Create a new entity. Simple entities can be constructed by passing a
3220
+ # name, value to the constructor; this creates a generic, plain entity
3221
+ # reference. For anything more complicated, you have to pass a Source to
3222
+ # the constructor with the entity definition, or use the accessor methods.
3223
+ # +WARNING+: There is no validation of entity state except when the entity
3224
+ # is read from a stream. If you start poking around with the accessors,
3225
+ # you can easily create a non-conformant Entity.
3226
+ #
3227
+ # e = Entity.new( 'amp', '&' )
3228
+ #
3229
+ # @return [Entity] a new instance of Entity
3230
+ #
3231
+ # source://rexml//lib/rexml/entity.rb#33
3232
+ def initialize(stream, value = T.unsafe(nil), parent = T.unsafe(nil), reference = T.unsafe(nil)); end
3233
+
3234
+ # Returns the value of attribute external.
3235
+ #
3236
+ # source://rexml//lib/rexml/entity.rb#22
3237
+ def external; end
3238
+
3239
+ # Returns the value of attribute name.
3240
+ #
3241
+ # source://rexml//lib/rexml/entity.rb#22
3242
+ def name; end
3243
+
3244
+ # Returns the value of attribute ndata.
3245
+ #
3246
+ # source://rexml//lib/rexml/entity.rb#22
3247
+ def ndata; end
3248
+
3249
+ # Returns the value of this entity unprocessed -- raw. This is the
3250
+ # normalized value; that is, with all %ent; and &ent; entities intact
3251
+ #
3252
+ # source://rexml//lib/rexml/entity.rb#85
3253
+ def normalized; end
3254
+
3255
+ # source://rexml//lib/rexml/entity.rb#138
3256
+ def parent=(other); end
3257
+
3258
+ # Returns the value of attribute pubid.
3259
+ #
3260
+ # source://rexml//lib/rexml/entity.rb#22
3261
+ def pubid; end
3262
+
3263
+ # Returns the value of attribute ref.
3264
+ #
3265
+ # source://rexml//lib/rexml/entity.rb#22
3266
+ def ref; end
3267
+
3268
+ # Returns this entity as a string. See write().
3269
+ #
3270
+ # source://rexml//lib/rexml/entity.rb#119
3271
+ def to_s; end
3272
+
3273
+ # Evaluates to the unnormalized value of this entity; that is, replacing
3274
+ # all entities -- both %ent; and &ent; entities. This differs from
3275
+ # +value()+ in that +value+ only replaces %ent; entities.
3276
+ #
3277
+ # source://rexml//lib/rexml/entity.rb#73
3278
+ def unnormalized; end
3279
+
3280
+ # Returns the value of this entity. At the moment, only internal entities
3281
+ # are processed. If the value contains internal references (IE,
3282
+ # %blah;), those are replaced with their values. IE, if the doctype
3283
+ # contains:
3284
+ # <!ENTITY % foo "bar">
3285
+ # <!ENTITY yada "nanoo %foo; nanoo>
3286
+ # then:
3287
+ # doctype.entity('yada').value #-> "nanoo bar nanoo"
3288
+ #
3289
+ # source://rexml//lib/rexml/entity.rb#134
3290
+ def value; end
3291
+
3292
+ # Write out a fully formed, correct entity definition (assuming the Entity
3293
+ # object itself is valid.)
3294
+ #
3295
+ # out::
3296
+ # An object implementing <TT>&lt;&lt;</TT> to which the entity will be
3297
+ # output
3298
+ # indent::
3299
+ # *DEPRECATED* and ignored
3300
+ #
3301
+ # source://rexml//lib/rexml/entity.rb#97
3302
+ def write(out, indent = T.unsafe(nil)); end
3303
+
3304
+ private
3305
+
3306
+ # source://rexml//lib/rexml/entity.rb#144
3307
+ def resolve_value; end
3308
+
3309
+ class << self
3310
+ # Evaluates whether the given string matches an entity definition,
3311
+ # returning true if so, and false otherwise.
3312
+ #
3313
+ # @return [Boolean]
3314
+ #
3315
+ # source://rexml//lib/rexml/entity.rb#66
3316
+ def matches?(string); end
3317
+ end
3318
+ end
3319
+
3320
+ # source://rexml//lib/rexml/doctype.rb#267
3321
+ class REXML::ExternalEntity < ::REXML::Child
3322
+ # @return [ExternalEntity] a new instance of ExternalEntity
3323
+ #
3324
+ # source://rexml//lib/rexml/doctype.rb#268
3325
+ def initialize(src); end
3326
+
3327
+ # source://rexml//lib/rexml/doctype.rb#272
3328
+ def to_s; end
3329
+
3330
+ # source://rexml//lib/rexml/doctype.rb#275
3331
+ def write(output, indent); end
3332
+ end
3333
+
3334
+ # source://rexml//lib/rexml/formatters/default.rb#5
3335
+ class REXML::Formatters::Default
3336
+ # Prints out the XML document with no formatting -- except if ie_hack is
3337
+ # set.
3338
+ #
3339
+ # ie_hack::
3340
+ # If set to true, then inserts whitespace before the close of an empty
3341
+ # tag, so that IE's bad XML parser doesn't choke.
3342
+ #
3343
+ # @return [Default] a new instance of Default
3344
+ #
3345
+ # source://rexml//lib/rexml/formatters/default.rb#12
3346
+ def initialize(ie_hack = T.unsafe(nil)); end
3347
+
3348
+ # Writes the node to some output.
3349
+ #
3350
+ # node::
3351
+ # The node to write
3352
+ # output::
3353
+ # A class implementing <TT>&lt;&lt;</TT>. Pass in an Output object to
3354
+ # change the output encoding.
3355
+ #
3356
+ # source://rexml//lib/rexml/formatters/default.rb#23
3357
+ def write(node, output); end
3358
+
3359
+ protected
3360
+
3361
+ # source://rexml//lib/rexml/formatters/default.rb#98
3362
+ def write_cdata(node, output); end
3363
+
3364
+ # source://rexml//lib/rexml/formatters/default.rb#92
3365
+ def write_comment(node, output); end
3366
+
3367
+ # source://rexml//lib/rexml/formatters/default.rb#61
3368
+ def write_document(node, output); end
3369
+
3370
+ # source://rexml//lib/rexml/formatters/default.rb#65
3371
+ def write_element(node, output); end
3372
+
3373
+ # source://rexml//lib/rexml/formatters/default.rb#104
3374
+ def write_instruction(node, output); end
3375
+
3376
+ # source://rexml//lib/rexml/formatters/default.rb#88
3377
+ def write_text(node, output); end
3378
+ end
3379
+
3380
+ # Pretty-prints an XML document. This destroys whitespace in text nodes
3381
+ # and will insert carriage returns and indentations.
3382
+ #
3383
+ # TODO: Add an option to print attributes on new lines
3384
+ #
3385
+ # source://rexml//lib/rexml/formatters/pretty.rb#10
3386
+ class REXML::Formatters::Pretty < ::REXML::Formatters::Default
3387
+ # Create a new pretty printer.
3388
+ #
3389
+ # output::
3390
+ # An object implementing '<<(String)', to which the output will be written.
3391
+ # indentation::
3392
+ # An integer greater than 0. The indentation of each level will be
3393
+ # this number of spaces. If this is < 1, the behavior of this object
3394
+ # is undefined. Defaults to 2.
3395
+ # ie_hack::
3396
+ # If true, the printer will insert whitespace before closing empty
3397
+ # tags, thereby allowing Internet Explorer's XML parser to
3398
+ # function. Defaults to false.
3399
+ #
3400
+ # @return [Pretty] a new instance of Pretty
3401
+ #
3402
+ # source://rexml//lib/rexml/formatters/pretty.rb#30
3403
+ def initialize(indentation = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
3404
+
3405
+ # If compact is set to true, then the formatter will attempt to use as
3406
+ # little space as possible
3407
+ #
3408
+ # source://rexml//lib/rexml/formatters/pretty.rb#14
3409
+ def compact; end
3410
+
3411
+ # If compact is set to true, then the formatter will attempt to use as
3412
+ # little space as possible
3413
+ #
3414
+ # source://rexml//lib/rexml/formatters/pretty.rb#14
3415
+ def compact=(_arg0); end
3416
+
3417
+ # The width of a page. Used for formatting text
3418
+ #
3419
+ # source://rexml//lib/rexml/formatters/pretty.rb#16
3420
+ def width; end
3421
+
3422
+ # The width of a page. Used for formatting text
3423
+ #
3424
+ # source://rexml//lib/rexml/formatters/pretty.rb#16
3425
+ def width=(_arg0); end
3426
+
3427
+ protected
3428
+
3429
+ # source://rexml//lib/rexml/formatters/pretty.rb#102
3430
+ def write_cdata(node, output); end
3431
+
3432
+ # source://rexml//lib/rexml/formatters/pretty.rb#97
3433
+ def write_comment(node, output); end
3434
+
3435
+ # source://rexml//lib/rexml/formatters/pretty.rb#107
3436
+ def write_document(node, output); end
3437
+
3438
+ # source://rexml//lib/rexml/formatters/pretty.rb#39
3439
+ def write_element(node, output); end
3440
+
3441
+ # source://rexml//lib/rexml/formatters/pretty.rb#88
3442
+ def write_text(node, output); end
3443
+
3444
+ private
3445
+
3446
+ # source://rexml//lib/rexml/formatters/pretty.rb#124
3447
+ def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
3448
+
3449
+ # source://rexml//lib/rexml/formatters/pretty.rb#129
3450
+ def wrap(string, width); end
3451
+ end
3452
+
3453
+ # A Source that wraps an IO. See the Source class for method
3454
+ # documentation
3455
+ #
3456
+ # source://rexml//lib/rexml/source.rb#159
3457
+ class REXML::IOSource < ::REXML::Source
3458
+ # block_size has been deprecated
3459
+ #
3460
+ # @return [IOSource] a new instance of IOSource
3461
+ #
3462
+ # source://rexml//lib/rexml/source.rb#163
3463
+ def initialize(arg, block_size = T.unsafe(nil), encoding = T.unsafe(nil)); end
3464
+
3465
+ # source://rexml//lib/rexml/source.rb#215
3466
+ def consume(pattern); end
3467
+
3468
+ # @return the current line in the source
3469
+ #
3470
+ # source://rexml//lib/rexml/source.rb#244
3471
+ def current_line; end
3472
+
3473
+ # @return [Boolean]
3474
+ #
3475
+ # source://rexml//lib/rexml/source.rb#235
3476
+ def empty?; end
3477
+
3478
+ # source://rexml//lib/rexml/source.rb#219
3479
+ def match(pattern, cons = T.unsafe(nil)); end
3480
+
3481
+ # source://rexml//lib/rexml/source.rb#239
3482
+ def position; end
3483
+
3484
+ # source://rexml//lib/rexml/source.rb#207
3485
+ def read; end
3486
+
3487
+ # source://rexml//lib/rexml/source.rb#184
3488
+ def scan(pattern, cons = T.unsafe(nil)); end
3489
+
3490
+ private
3491
+
3492
+ # source://rexml//lib/rexml/source.rb#286
3493
+ def encoding_updated; end
3494
+
3495
+ # source://rexml//lib/rexml/source.rb#266
3496
+ def readline; 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#48
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#43
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#38
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#29
3889
+ class REXML::Parsers::BaseParser
3890
+ # @return [BaseParser] a new instance of BaseParser
3891
+ #
3892
+ # source://rexml//lib/rexml/parsers/baseparser.rb#115
3893
+ def initialize(source); end
3894
+
3895
+ # source://rexml//lib/rexml/parsers/baseparser.rb#120
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#146
3903
+ def empty?; end
3904
+
3905
+ # source://rexml//lib/rexml/parsers/baseparser.rb#438
3906
+ def entity(reference, entities); end
3907
+
3908
+ # Returns true if there are more events. Synonymous with !empty?
3909
+ #
3910
+ # @return [Boolean]
3911
+ #
3912
+ # source://rexml//lib/rexml/parsers/baseparser.rb#151
3913
+ def has_next?; end
3914
+
3915
+ # Escapes all possible entities
3916
+ #
3917
+ # source://rexml//lib/rexml/parsers/baseparser.rb#449
3918
+ def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
3919
+
3920
+ # Peek at the +depth+ event in the stack. The first element on the stack
3921
+ # is at depth 0. If +depth+ is -1, will parse to the end of the input
3922
+ # stream and return the last event, which is always :end_document.
3923
+ # Be aware that this causes the stream to be parsed up to the +depth+
3924
+ # event, so you can effectively pre-parse the entire document (pull the
3925
+ # entire thing into memory) using this method.
3926
+ #
3927
+ # source://rexml//lib/rexml/parsers/baseparser.rb#167
3928
+ def peek(depth = T.unsafe(nil)); end
3929
+
3930
+ # source://rexml//lib/rexml/parsers/baseparser.rb#136
3931
+ def position; end
3932
+
3933
+ # Returns the next event. This is a +PullEvent+ object.
3934
+ #
3935
+ # source://rexml//lib/rexml/parsers/baseparser.rb#182
3936
+ def pull; end
3937
+
3938
+ # Returns the value of attribute source.
3939
+ #
3940
+ # source://rexml//lib/rexml/parsers/baseparser.rb#124
3941
+ def source; end
3942
+
3943
+ # source://rexml//lib/rexml/parsers/baseparser.rb#126
3944
+ def stream=(source); end
3945
+
3946
+ # Unescapes all possible entities
3947
+ #
3948
+ # source://rexml//lib/rexml/parsers/baseparser.rb#465
3949
+ def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end
3950
+
3951
+ # Push an event back on the head of the stream. This method
3952
+ # has (theoretically) infinite depth.
3953
+ #
3954
+ # source://rexml//lib/rexml/parsers/baseparser.rb#157
3955
+ def unshift(token); end
3956
+
3957
+ private
3958
+
3959
+ # @return [Boolean]
3960
+ #
3961
+ # source://rexml//lib/rexml/parsers/baseparser.rb#495
3962
+ def need_source_encoding_update?(xml_declaration_encoding); end
3963
+
3964
+ # source://rexml//lib/rexml/parsers/baseparser.rb#589
3965
+ def parse_attributes(prefixes, curr_ns); end
3966
+
3967
+ # source://rexml//lib/rexml/parsers/baseparser.rb#514
3968
+ def parse_id(base_error_message, accept_external_id:, accept_public_id:); end
3969
+
3970
+ # source://rexml//lib/rexml/parsers/baseparser.rb#542
3971
+ def parse_id_invalid_details(accept_external_id:, accept_public_id:); end
3972
+
3973
+ # source://rexml//lib/rexml/parsers/baseparser.rb#501
3974
+ def parse_name(base_error_message); end
3975
+
3976
+ # source://rexml//lib/rexml/parsers/baseparser.rb#580
3977
+ def process_instruction; end
3978
+
3979
+ # source://rexml//lib/rexml/parsers/baseparser.rb#190
3980
+ def pull_event; end
3981
+ end
3982
+
3983
+ # source://rexml//lib/rexml/parsers/baseparser.rb#102
3984
+ REXML::Parsers::BaseParser::EXTERNAL_ID_PUBLIC = T.let(T.unsafe(nil), Regexp)
3985
+
3986
+ # source://rexml//lib/rexml/parsers/baseparser.rb#103
3987
+ REXML::Parsers::BaseParser::EXTERNAL_ID_SYSTEM = T.let(T.unsafe(nil), Regexp)
3988
+
3989
+ # source://rexml//lib/rexml/parsers/baseparser.rb#104
3990
+ REXML::Parsers::BaseParser::PUBLIC_ID = T.let(T.unsafe(nil), Regexp)
3991
+
3992
+ # source://rexml//lib/rexml/parsers/baseparser.rb#38
3993
+ REXML::Parsers::BaseParser::QNAME = T.let(T.unsafe(nil), Regexp)
3994
+
3995
+ # source://rexml//lib/rexml/parsers/baseparser.rb#37
3996
+ REXML::Parsers::BaseParser::QNAME_STR = T.let(T.unsafe(nil), String)
3997
+
3998
+ # source://rexml//lib/rexml/parsers/streamparser.rb#6
3999
+ class REXML::Parsers::StreamParser
4000
+ # @return [StreamParser] a new instance of StreamParser
4001
+ #
4002
+ # source://rexml//lib/rexml/parsers/streamparser.rb#7
4003
+ def initialize(source, listener); end
4004
+
4005
+ # source://rexml//lib/rexml/parsers/streamparser.rb#13
4006
+ def add_listener(listener); end
4007
+
4008
+ # source://rexml//lib/rexml/parsers/streamparser.rb#17
4009
+ def parse; end
4010
+ end
4011
+
4012
+ # source://rexml//lib/rexml/parsers/treeparser.rb#7
4013
+ class REXML::Parsers::TreeParser
4014
+ # @return [TreeParser] a new instance of TreeParser
4015
+ #
4016
+ # source://rexml//lib/rexml/parsers/treeparser.rb#8
4017
+ def initialize(source, build_context = T.unsafe(nil)); end
4018
+
4019
+ # source://rexml//lib/rexml/parsers/treeparser.rb#13
4020
+ def add_listener(listener); end
4021
+
4022
+ # source://rexml//lib/rexml/parsers/treeparser.rb#17
4023
+ def parse; end
4024
+ end
4025
+
4026
+ # You don't want to use this class. Really. Use XPath, which is a wrapper
4027
+ # for this class. Believe me. You don't want to poke around in here.
4028
+ # There is strange, dark magic at work in this code. Beware. Go back! Go
4029
+ # back while you still can!
4030
+ #
4031
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#12
4032
+ class REXML::Parsers::XPathParser
4033
+ include ::REXML::XMLTokens
4034
+
4035
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#42
4036
+ def abbreviate(path_or_parsed); end
4037
+
4038
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#132
4039
+ def expand(path_or_parsed); end
4040
+
4041
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#16
4042
+ def namespaces=(namespaces); end
4043
+
4044
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#21
4045
+ def parse(path); end
4046
+
4047
+ # For backward compatibility
4048
+ #
4049
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4050
+ def preciate_to_string(parsed, &block); end
4051
+
4052
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#36
4053
+ def predicate(path); end
4054
+
4055
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#174
4056
+ def predicate_to_path(parsed, &block); end
4057
+
4058
+ private
4059
+
4060
+ # | AdditiveExpr ('+' | '-') MultiplicativeExpr
4061
+ # | MultiplicativeExpr
4062
+ #
4063
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#505
4064
+ def AdditiveExpr(path, parsed); end
4065
+
4066
+ # | AndExpr S 'and' S EqualityExpr
4067
+ # | EqualityExpr
4068
+ #
4069
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#438
4070
+ def AndExpr(path, parsed); end
4071
+
4072
+ # | EqualityExpr ('=' | '!=') RelationalExpr
4073
+ # | RelationalExpr
4074
+ #
4075
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#457
4076
+ def EqualityExpr(path, parsed); end
4077
+
4078
+ # | FilterExpr Predicate
4079
+ # | PrimaryExpr
4080
+ #
4081
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#608
4082
+ def FilterExpr(path, parsed); end
4083
+
4084
+ # | FUNCTION_NAME '(' ( expr ( ',' expr )* )? ')'
4085
+ #
4086
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#663
4087
+ def FunctionCall(rest, parsed); end
4088
+
4089
+ # LocationPath
4090
+ # | RelativeLocationPath
4091
+ # | '/' RelativeLocationPath?
4092
+ # | '//' RelativeLocationPath
4093
+ #
4094
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#243
4095
+ def LocationPath(path, parsed); end
4096
+
4097
+ # | MultiplicativeExpr ('*' | S ('div' | 'mod') S) UnaryExpr
4098
+ # | UnaryExpr
4099
+ #
4100
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#528
4101
+ def MultiplicativeExpr(path, parsed); end
4102
+
4103
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#343
4104
+ def NodeTest(path, parsed); end
4105
+
4106
+ # | OrExpr S 'or' S AndExpr
4107
+ # | AndExpr
4108
+ #
4109
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#419
4110
+ def OrExpr(path, parsed); end
4111
+
4112
+ # | LocationPath
4113
+ # | FilterExpr ('/' | '//') RelativeLocationPath
4114
+ #
4115
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#590
4116
+ def PathExpr(path, parsed); end
4117
+
4118
+ # Filters the supplied nodeset on the predicate(s)
4119
+ #
4120
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#395
4121
+ def Predicate(path, parsed); end
4122
+
4123
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#626
4124
+ def PrimaryExpr(path, parsed); end
4125
+
4126
+ # | RelationalExpr ('<' | '>' | '<=' | '>=') AdditiveExpr
4127
+ # | AdditiveExpr
4128
+ #
4129
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#480
4130
+ def RelationalExpr(path, parsed); end
4131
+
4132
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#267
4133
+ def RelativeLocationPath(path, parsed); end
4134
+
4135
+ # | '-' UnaryExpr
4136
+ # | UnionExpr
4137
+ #
4138
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#553
4139
+ def UnaryExpr(path, parsed); end
4140
+
4141
+ # | UnionExpr '|' PathExpr
4142
+ # | PathExpr
4143
+ #
4144
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#571
4145
+ def UnionExpr(path, parsed); end
4146
+
4147
+ # get_group( '[foo]bar' ) -> ['bar', '[foo]']
4148
+ #
4149
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#676
4150
+ def get_group(string); end
4151
+
4152
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#694
4153
+ def parse_args(string); end
4154
+
4155
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#224
4156
+ def quote_literal(literal); end
4157
+ end
4158
+
4159
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#339
4160
+ REXML::Parsers::XPathParser::LOCAL_NAME_WILDCARD = T.let(T.unsafe(nil), Regexp)
4161
+
4162
+ # Returns a 1-1 map of the nodeset
4163
+ # The contents of the resulting array are either:
4164
+ # true/false, if a positive match
4165
+ # String, if a name match
4166
+ # NodeTest
4167
+ # | ('*' | NCNAME ':' '*' | QNAME) NameTest
4168
+ # | '*' ':' NCNAME NameTest since XPath 2.0
4169
+ # | NODE_TYPE '(' ')' NodeType
4170
+ # | PI '(' LITERAL ')' PI
4171
+ # | '[' expr ']' Predicate
4172
+ #
4173
+ # source://rexml//lib/rexml/parsers/xpathparser.rb#338
4174
+ REXML::Parsers::XPathParser::PREFIX_WILDCARD = T.let(T.unsafe(nil), Regexp)
4175
+
4176
+ # source://rexml//lib/rexml/doctype.rb#10
4177
+ class REXML::ReferenceWriter
4178
+ # @return [ReferenceWriter] a new instance of ReferenceWriter
4179
+ #
4180
+ # source://rexml//lib/rexml/doctype.rb#11
4181
+ def initialize(id_type, public_id_literal, system_literal, context = T.unsafe(nil)); end
4182
+
4183
+ # source://rexml//lib/rexml/doctype.rb#25
4184
+ def write(output); end
4185
+ end
4186
+
4187
+ # A Source can be searched for patterns, and wraps buffers and other
4188
+ # objects and provides consumption of text
4189
+ #
4190
+ # source://rexml//lib/rexml/source.rb#31
4191
+ class REXML::Source
4192
+ include ::REXML::Encoding
4193
+
4194
+ # Constructor
4195
+ # value, overriding all encoding detection
4196
+ #
4197
+ # @param arg must be a String, and should be a valid XML document
4198
+ # @param encoding if non-null, sets the encoding of the source to this
4199
+ # @return [Source] a new instance of Source
4200
+ #
4201
+ # source://rexml//lib/rexml/source.rb#43
4202
+ def initialize(arg, encoding = T.unsafe(nil)); end
4203
+
4204
+ # The current buffer (what we're going to read next)
4205
+ #
4206
+ # source://rexml//lib/rexml/source.rb#34
4207
+ def buffer; end
4208
+
4209
+ # source://rexml//lib/rexml/source.rb#87
4210
+ def consume(pattern); end
4211
+
4212
+ # @return the current line in the source
4213
+ #
4214
+ # source://rexml//lib/rexml/source.rb#117
4215
+ def current_line; end
4216
+
4217
+ # @return [Boolean] true if the Source is exhausted
4218
+ #
4219
+ # source://rexml//lib/rexml/source.rb#108
4220
+ def empty?; end
4221
+
4222
+ # Returns the value of attribute encoding.
4223
+ #
4224
+ # source://rexml//lib/rexml/source.rb#37
4225
+ def encoding; end
4226
+
4227
+ # Inherited from Encoding
4228
+ # Overridden to support optimized en/decoding
4229
+ #
4230
+ # source://rexml//lib/rexml/source.rb#56
4231
+ def encoding=(enc); end
4232
+
4233
+ # The line number of the last consumed text
4234
+ #
4235
+ # source://rexml//lib/rexml/source.rb#36
4236
+ def line; end
4237
+
4238
+ # source://rexml//lib/rexml/source.rb#101
4239
+ def match(pattern, cons = T.unsafe(nil)); end
4240
+
4241
+ # source://rexml//lib/rexml/source.rb#91
4242
+ def match_to(char, pattern); end
4243
+
4244
+ # source://rexml//lib/rexml/source.rb#95
4245
+ def match_to_consume(char, pattern); end
4246
+
4247
+ # source://rexml//lib/rexml/source.rb#112
4248
+ def position; end
4249
+
4250
+ # source://rexml//lib/rexml/source.rb#84
4251
+ def read; end
4252
+
4253
+ # Scans the source for a given pattern. Note, that this is not your
4254
+ # usual scan() method. For one thing, the pattern argument has some
4255
+ # requirements; for another, the source can be consumed. You can easily
4256
+ # confuse this method. Originally, the patterns were easier
4257
+ # to construct and this method more robust, because this method
4258
+ # generated search regexps on the fly; however, this was
4259
+ # computationally expensive and slowed down the entire REXML package
4260
+ # considerably, since this is by far the most commonly called method.
4261
+ # /^\s*(#{your pattern, with no groups})(.*)/. The first group
4262
+ # will be returned; the second group is used if the consume flag is
4263
+ # set.
4264
+ # everything after it in the Source.
4265
+ # pattern is not found.
4266
+ #
4267
+ # @param pattern must be a Regexp, and must be in the form of
4268
+ # @param consume if true, the pattern returned will be consumed, leaving
4269
+ # @return the pattern, if found, or nil if the Source is empty or the
4270
+ #
4271
+ # source://rexml//lib/rexml/source.rb#77
4272
+ def scan(pattern, cons = T.unsafe(nil)); end
4273
+
4274
+ private
4275
+
4276
+ # source://rexml//lib/rexml/source.rb#125
4277
+ def detect_encoding; end
4278
+
4279
+ # source://rexml//lib/rexml/source.rb#146
4280
+ def encoding_updated; end
4281
+ end
4282
+
4283
+ # Represents text nodes in an XML document
4284
+ #
4285
+ # source://rexml//lib/rexml/text.rb#11
4286
+ class REXML::Text < ::REXML::Child
4287
+ include ::Comparable
4288
+
4289
+ # Constructor
4290
+ # +arg+ if a String, the content is set to the String. If a Text,
4291
+ # the object is shallowly cloned.
4292
+ #
4293
+ # +respect_whitespace+ (boolean, false) if true, whitespace is
4294
+ # respected
4295
+ #
4296
+ # +parent+ (nil) if this is a Parent object, the parent
4297
+ # will be set to this.
4298
+ #
4299
+ # +raw+ (nil) This argument can be given three values.
4300
+ # If true, then the value of used to construct this object is expected to
4301
+ # contain no unescaped XML markup, and REXML will not change the text. If
4302
+ # this value is false, the string may contain any characters, and REXML will
4303
+ # escape any and all defined entities whose values are contained in the
4304
+ # text. If this value is nil (the default), then the raw value of the
4305
+ # parent will be used as the raw value for this node. If there is no raw
4306
+ # value for the parent, and no value is supplied, the default is false.
4307
+ # Use this field if you have entities defined for some text, and you don't
4308
+ # want REXML to escape that text in output.
4309
+ # Text.new( "<&", false, nil, false ) #-> "&lt;&amp;"
4310
+ # Text.new( "&lt;&amp;", false, nil, false ) #-> "&amp;lt;&amp;amp;"
4311
+ # Text.new( "<&", false, nil, true ) #-> Parse exception
4312
+ # Text.new( "&lt;&amp;", false, nil, true ) #-> "&lt;&amp;"
4313
+ # # Assume that the entity "s" is defined to be "sean"
4314
+ # # and that the entity "r" is defined to be "russell"
4315
+ # Text.new( "sean russell" ) #-> "&s; &r;"
4316
+ # Text.new( "sean russell", false, nil, true ) #-> "sean russell"
4317
+ #
4318
+ # +entity_filter+ (nil) This can be an array of entities to match in the
4319
+ # supplied text. This argument is only useful if +raw+ is set to false.
4320
+ # Text.new( "sean russell", false, nil, false, ["s"] ) #-> "&s; russell"
4321
+ # Text.new( "sean russell", false, nil, true, ["s"] ) #-> "sean russell"
4322
+ # In the last example, the +entity_filter+ argument is ignored.
4323
+ #
4324
+ # +illegal+ INTERNAL USE ONLY
4325
+ #
4326
+ # @return [Text] a new instance of Text
4327
+ #
4328
+ # source://rexml//lib/rexml/text.rb#94
4329
+ 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
4330
+
4331
+ # Appends text to this text node. The text is appended in the +raw+ mode
4332
+ # of this text node.
4333
+ #
4334
+ # +returns+ the text itself to enable method chain like
4335
+ # 'text << "XXX" << "YYY"'.
4336
+ #
4337
+ # source://rexml//lib/rexml/text.rb#194
4338
+ def <<(to_append); end
4339
+
4340
+ # +other+ a String or a Text
4341
+ # +returns+ the result of (to_s <=> arg.to_s)
4342
+ #
4343
+ # source://rexml//lib/rexml/text.rb#203
4344
+ def <=>(other); end
4345
+
4346
+ # source://rexml//lib/rexml/text.rb#184
4347
+ def clone; end
4348
+
4349
+ # source://rexml//lib/rexml/text.rb#207
4350
+ def doctype; end
4351
+
4352
+ # @return [Boolean]
4353
+ #
4354
+ # source://rexml//lib/rexml/text.rb#179
4355
+ def empty?; end
4356
+
4357
+ # source://rexml//lib/rexml/text.rb#278
4358
+ def indent_text(string, level = T.unsafe(nil), style = T.unsafe(nil), indentfirstline = T.unsafe(nil)); end
4359
+
4360
+ # source://rexml//lib/rexml/text.rb#233
4361
+ def inspect; end
4362
+
4363
+ # source://rexml//lib/rexml/text.rb#175
4364
+ def node_type; end
4365
+
4366
+ # source://rexml//lib/rexml/text.rb#125
4367
+ def parent=(parent); end
4368
+
4369
+ # If +raw+ is true, then REXML leaves the value alone
4370
+ #
4371
+ # source://rexml//lib/rexml/text.rb#21
4372
+ def raw; end
4373
+
4374
+ # If +raw+ is true, then REXML leaves the value alone
4375
+ #
4376
+ # source://rexml//lib/rexml/text.rb#21
4377
+ def raw=(_arg0); end
4378
+
4379
+ # Returns the string value of this text node. This string is always
4380
+ # escaped, meaning that it is a valid XML text node string, and all
4381
+ # entities that can be escaped, have been inserted. This method respects
4382
+ # the entity filter set in the constructor.
4383
+ #
4384
+ # # Assume that the entity "s" is defined to be "sean", and that the
4385
+ # # entity "r" is defined to be "russell"
4386
+ # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4387
+ # t.to_s #-> "&lt; &amp; &s; russell"
4388
+ # t = Text.new( "< & &s; russell", false, nil, false )
4389
+ # t.to_s #-> "&lt; &amp; &s; russell"
4390
+ # u = Text.new( "sean russell", false, nil, true )
4391
+ # u.to_s #-> "sean russell"
4392
+ #
4393
+ # source://rexml//lib/rexml/text.rb#228
4394
+ def to_s; end
4395
+
4396
+ # Returns the string value of this text. This is the text without
4397
+ # entities, as it might be used programmatically, or printed to the
4398
+ # console. This ignores the 'raw' attribute setting, and any
4399
+ # entity_filter.
4400
+ #
4401
+ # # Assume that the entity "s" is defined to be "sean", and that the
4402
+ # # entity "r" is defined to be "russell"
4403
+ # t = Text.new( "< & sean russell", false, nil, false, ['s'] )
4404
+ # t.value #-> "< & sean russell"
4405
+ # t = Text.new( "< & &s; russell", false, nil, false )
4406
+ # t.value #-> "< & sean russell"
4407
+ # u = Text.new( "sean russell", false, nil, true )
4408
+ # u.value #-> "sean russell"
4409
+ #
4410
+ # source://rexml//lib/rexml/text.rb#250
4411
+ def value; end
4412
+
4413
+ # Sets the contents of this text node. This expects the text to be
4414
+ # unnormalized. It returns self.
4415
+ #
4416
+ # e = Element.new( "a" )
4417
+ # e.add_text( "foo" ) # <a>foo</a>
4418
+ # e[0].value = "bar" # <a>bar</a>
4419
+ # e[0].value = "<a>" # <a>&lt;a&gt;</a>
4420
+ #
4421
+ # source://rexml//lib/rexml/text.rb#261
4422
+ def value=(val); end
4423
+
4424
+ # source://rexml//lib/rexml/text.rb#267
4425
+ def wrap(string, width, addnewline = T.unsafe(nil)); end
4426
+
4427
+ # == DEPRECATED
4428
+ # See REXML::Formatters
4429
+ #
4430
+ # source://rexml//lib/rexml/text.rb#293
4431
+ def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4432
+
4433
+ # Writes out text, substituting special characters beforehand.
4434
+ # +out+ A String, IO, or any other object supporting <<( String )
4435
+ # +input+ the text to substitute and the write out
4436
+ #
4437
+ # z=utf8.unpack("U*")
4438
+ # ascOut=""
4439
+ # z.each{|r|
4440
+ # if r < 0x100
4441
+ # ascOut.concat(r.chr)
4442
+ # else
4443
+ # ascOut.concat(sprintf("&#x%x;", r))
4444
+ # end
4445
+ # }
4446
+ # puts ascOut
4447
+ #
4448
+ # source://rexml//lib/rexml/text.rb#325
4449
+ def write_with_substitution(out, input); end
4450
+
4451
+ # FIXME
4452
+ # This probably won't work properly
4453
+ #
4454
+ # source://rexml//lib/rexml/text.rb#305
4455
+ def xpath; end
4456
+
4457
+ private
4458
+
4459
+ # source://rexml//lib/rexml/text.rb#338
4460
+ def clear_cache; end
4461
+
4462
+ class << self
4463
+ # check for illegal characters
4464
+ #
4465
+ # source://rexml//lib/rexml/text.rb#131
4466
+ def check(string, pattern, doctype); end
4467
+
4468
+ # source://rexml//lib/rexml/text.rb#407
4469
+ def expand(ref, doctype, filter); end
4470
+
4471
+ # Escapes all possible entities
4472
+ #
4473
+ # source://rexml//lib/rexml/text.rb#370
4474
+ def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end
4475
+
4476
+ # Reads text, substituting entities
4477
+ #
4478
+ # source://rexml//lib/rexml/text.rb#344
4479
+ def read_with_substitution(input, illegal = T.unsafe(nil)); end
4480
+
4481
+ # Unescapes all possible entities
4482
+ #
4483
+ # source://rexml//lib/rexml/text.rb#394
4484
+ def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil)); end
4485
+ end
4486
+ end
4487
+
4488
+ # source://rexml//lib/rexml/undefinednamespaceexception.rb#4
4489
+ class REXML::UndefinedNamespaceException < ::REXML::ParseException
4490
+ # @return [UndefinedNamespaceException] a new instance of UndefinedNamespaceException
4491
+ #
4492
+ # source://rexml//lib/rexml/undefinednamespaceexception.rb#5
4493
+ def initialize(prefix, source, parser); end
4494
+ end
4495
+
4496
+ # source://rexml//lib/rexml/validation/validationexception.rb#4
4497
+ class REXML::Validation::ValidationException < ::RuntimeError
4498
+ # @return [ValidationException] a new instance of ValidationException
4499
+ #
4500
+ # source://rexml//lib/rexml/validation/validationexception.rb#5
4501
+ def initialize(msg); end
4502
+ end
4503
+
4504
+ # NEEDS DOCUMENTATION
4505
+ #
4506
+ # source://rexml//lib/rexml/xmldecl.rb#8
4507
+ class REXML::XMLDecl < ::REXML::Child
4508
+ include ::REXML::Encoding
4509
+
4510
+ # @return [XMLDecl] a new instance of XMLDecl
4511
+ #
4512
+ # source://rexml//lib/rexml/xmldecl.rb#20
4513
+ def initialize(version = T.unsafe(nil), encoding = T.unsafe(nil), standalone = T.unsafe(nil)); end
4514
+
4515
+ # source://rexml//lib/rexml/xmldecl.rb#56
4516
+ def ==(other); end
4517
+
4518
+ # source://rexml//lib/rexml/xmldecl.rb#39
4519
+ def clone; end
4520
+
4521
+ # source://rexml//lib/rexml/xmldecl.rb#102
4522
+ def dowrite; end
4523
+
4524
+ # source://rexml//lib/rexml/xmldecl.rb#76
4525
+ def encoding=(enc); end
4526
+
4527
+ # source://rexml//lib/rexml/xmldecl.rb#106
4528
+ def inspect; end
4529
+
4530
+ # source://rexml//lib/rexml/xmldecl.rb#69
4531
+ def node_type; end
4532
+
4533
+ # source://rexml//lib/rexml/xmldecl.rb#98
4534
+ def nowrite; end
4535
+
4536
+ # source://rexml//lib/rexml/encoding.rb#7
4537
+ def old_enc=(encoding); end
4538
+
4539
+ # Returns the value of attribute standalone.
4540
+ #
4541
+ # source://rexml//lib/rexml/xmldecl.rb#17
4542
+ def stand_alone?; end
4543
+
4544
+ # Returns the value of attribute standalone.
4545
+ #
4546
+ # source://rexml//lib/rexml/xmldecl.rb#17
4547
+ def standalone; end
4548
+
4549
+ # Sets the attribute standalone
4550
+ #
4551
+ # @param value the value to set the attribute standalone to.
4552
+ #
4553
+ # source://rexml//lib/rexml/xmldecl.rb#17
4554
+ def standalone=(_arg0); end
4555
+
4556
+ # Returns the value of attribute version.
4557
+ #
4558
+ # source://rexml//lib/rexml/xmldecl.rb#17
4559
+ def version; end
4560
+
4561
+ # Sets the attribute version
4562
+ #
4563
+ # @param value the value to set the attribute version to.
4564
+ #
4565
+ # source://rexml//lib/rexml/xmldecl.rb#17
4566
+ def version=(_arg0); end
4567
+
4568
+ # indent::
4569
+ # Ignored. There must be no whitespace before an XML declaration
4570
+ # transitive::
4571
+ # Ignored
4572
+ # ie_hack::
4573
+ # Ignored
4574
+ #
4575
+ # source://rexml//lib/rexml/xmldecl.rb#49
4576
+ def write(writer, indent = T.unsafe(nil), transitive = T.unsafe(nil), ie_hack = T.unsafe(nil)); end
4577
+
4578
+ # Returns the value of attribute writeencoding.
4579
+ #
4580
+ # source://rexml//lib/rexml/xmldecl.rb#18
4581
+ def writeencoding; end
4582
+
4583
+ # Returns the value of attribute writethis.
4584
+ #
4585
+ # source://rexml//lib/rexml/xmldecl.rb#18
4586
+ def writethis; end
4587
+
4588
+ # source://rexml//lib/rexml/xmldecl.rb#63
4589
+ def xmldecl(version, encoding, standalone); end
4590
+
4591
+ private
4592
+
4593
+ # source://rexml//lib/rexml/xmldecl.rb#111
4594
+ def content(enc); end
4595
+
4596
+ class << self
4597
+ # Only use this if you do not want the XML declaration to be written;
4598
+ # this object is ignored by the XML writer. Otherwise, instantiate your
4599
+ # own XMLDecl and add it to the document.
4600
+ #
4601
+ # Note that XML 1.1 documents *must* include an XML declaration
4602
+ #
4603
+ # source://rexml//lib/rexml/xmldecl.rb#92
4604
+ def default; end
4605
+ end
4606
+ end
4607
+
4608
+ # @private
4609
+ #
4610
+ # source://rexml//lib/rexml/xpath_parser.rb#959
4611
+ class REXML::XPathNode
4612
+ # @return [XPathNode] a new instance of XPathNode
4613
+ #
4614
+ # source://rexml//lib/rexml/xpath_parser.rb#961
4615
+ def initialize(node, context = T.unsafe(nil)); end
4616
+
4617
+ # Returns the value of attribute context.
4618
+ #
4619
+ # source://rexml//lib/rexml/xpath_parser.rb#960
4620
+ def context; end
4621
+
4622
+ # source://rexml//lib/rexml/xpath_parser.rb#970
4623
+ def position; end
4624
+
4625
+ # Returns the value of attribute raw_node.
4626
+ #
4627
+ # source://rexml//lib/rexml/xpath_parser.rb#960
4628
+ def raw_node; end
4629
+ end
4630
+
4631
+ # You don't want to use this class. Really. Use XPath, which is a wrapper
4632
+ # for this class. Believe me. You don't want to poke around in here.
4633
+ # There is strange, dark magic at work in this code. Beware. Go back! Go
4634
+ # back while you still can!
4635
+ #
4636
+ # source://rexml//lib/rexml/xpath_parser.rb#54
4637
+ class REXML::XPathParser
4638
+ include ::REXML::XMLTokens
4639
+
4640
+ # @return [XPathParser] a new instance of XPathParser
4641
+ #
4642
+ # source://rexml//lib/rexml/xpath_parser.rb#60
4643
+ def initialize(strict: T.unsafe(nil)); end
4644
+
4645
+ # source://rexml//lib/rexml/xpath_parser.rb#94
4646
+ def []=(variable_name, value); end
4647
+
4648
+ # Performs a depth-first (document order) XPath search, and returns the
4649
+ # first match. This is the fastest, lightest way to return a single result.
4650
+ #
4651
+ # FIXME: This method is incomplete!
4652
+ #
4653
+ # source://rexml//lib/rexml/xpath_parser.rb#103
4654
+ def first(path_stack, node); end
4655
+
4656
+ # source://rexml//lib/rexml/xpath_parser.rb#84
4657
+ def get_first(path, nodeset); end
4658
+
4659
+ # source://rexml//lib/rexml/xpath_parser.rb#139
4660
+ def match(path_stack, nodeset); end
4661
+
4662
+ # source://rexml//lib/rexml/xpath_parser.rb#69
4663
+ def namespaces=(namespaces = T.unsafe(nil)); end
4664
+
4665
+ # source://rexml//lib/rexml/xpath_parser.rb#79
4666
+ def parse(path, nodeset); end
4667
+
4668
+ # source://rexml//lib/rexml/xpath_parser.rb#89
4669
+ def predicate(path, nodeset); end
4670
+
4671
+ # source://rexml//lib/rexml/xpath_parser.rb#74
4672
+ def variables=(vars = T.unsafe(nil)); end
4673
+
4674
+ private
4675
+
4676
+ # source://rexml//lib/rexml/xpath_parser.rb#775
4677
+ def child(nodeset); end
4678
+
4679
+ # source://rexml//lib/rexml/xpath_parser.rb#916
4680
+ def compare(a, operator, b); end
4681
+
4682
+ # source://rexml//lib/rexml/xpath_parser.rb#678
4683
+ def descendant(nodeset, include_self); end
4684
+
4685
+ # source://rexml//lib/rexml/xpath_parser.rb#689
4686
+ def descendant_recursive(raw_node, new_nodeset, new_nodes, include_self); end
4687
+
4688
+ # source://rexml//lib/rexml/xpath_parser.rb#938
4689
+ def each_unnode(nodeset); end
4690
+
4691
+ # source://rexml//lib/rexml/xpath_parser.rb#637
4692
+ def enter(tag, *args); end
4693
+
4694
+ # source://rexml//lib/rexml/xpath_parser.rb#815
4695
+ def equality_relational_compare(set1, op, set2); end
4696
+
4697
+ # source://rexml//lib/rexml/xpath_parser.rb#591
4698
+ def evaluate_predicate(expression, nodesets); end
4699
+
4700
+ # Expr takes a stack of path elements and a set of nodes (either a Parent
4701
+ # or an Array and returns an Array of matching nodes
4702
+ #
4703
+ # source://rexml//lib/rexml/xpath_parser.rb#175
4704
+ def expr(path_stack, nodeset, context = T.unsafe(nil)); end
4705
+
4706
+ # source://rexml//lib/rexml/xpath_parser.rb#582
4707
+ def filter_nodeset(nodeset); end
4708
+
4709
+ # source://rexml//lib/rexml/xpath_parser.rb#745
4710
+ def following(node); end
4711
+
4712
+ # source://rexml//lib/rexml/xpath_parser.rb#756
4713
+ def following_node_of(node); end
4714
+
4715
+ # Returns a String namespace for a node, given a prefix
4716
+ # The rules are:
4717
+ #
4718
+ # 1. Use the supplied namespace mapping first.
4719
+ # 2. If no mapping was supplied, use the context node to look up the namespace
4720
+ #
4721
+ # source://rexml//lib/rexml/xpath_parser.rb#163
4722
+ def get_namespace(node, prefix); end
4723
+
4724
+ # source://rexml//lib/rexml/xpath_parser.rb#642
4725
+ def leave(tag, *args); end
4726
+
4727
+ # source://rexml//lib/rexml/xpath_parser.rb#763
4728
+ def next_sibling_node(node); end
4729
+
4730
+ # source://rexml//lib/rexml/xpath_parser.rb#477
4731
+ def node_test(path_stack, nodesets, any_type: T.unsafe(nil)); end
4732
+
4733
+ # source://rexml//lib/rexml/xpath_parser.rb#802
4734
+ def norm(b); end
4735
+
4736
+ # source://rexml//lib/rexml/xpath_parser.rb#890
4737
+ def normalize_compare_values(a, operator, b); end
4738
+
4739
+ # Builds a nodeset of all of the preceding nodes of the supplied node,
4740
+ # in reverse document order
4741
+ # preceding:: includes every element in the document that precedes this node,
4742
+ # except for ancestors
4743
+ #
4744
+ # source://rexml//lib/rexml/xpath_parser.rb#708
4745
+ def preceding(node); end
4746
+
4747
+ # source://rexml//lib/rexml/xpath_parser.rb#730
4748
+ def preceding_node_of(node); end
4749
+
4750
+ # Reorders an array of nodes so that they are in document order
4751
+ # It tries to do this efficiently.
4752
+ #
4753
+ # FIXME: I need to get rid of this, but the issue is that most of the XPath
4754
+ # interpreter functions as a filter, which means that we lose context going
4755
+ # in and out of function calls. If I knew what the index of the nodes was,
4756
+ # I wouldn't have to do this. Maybe add a document IDX for each node?
4757
+ # Problems with mutable documents. Or, rewrite everything.
4758
+ #
4759
+ # source://rexml//lib/rexml/xpath_parser.rb#655
4760
+ def sort(array_of_nodes, order); end
4761
+
4762
+ # source://rexml//lib/rexml/xpath_parser.rb#441
4763
+ def step(path_stack, any_type: T.unsafe(nil), order: T.unsafe(nil)); end
4764
+
4765
+ # @return [Boolean]
4766
+ #
4767
+ # source://rexml//lib/rexml/xpath_parser.rb#154
4768
+ def strict?; end
4769
+
4770
+ # source://rexml//lib/rexml/xpath_parser.rb#630
4771
+ def trace(*args); end
4772
+
4773
+ # source://rexml//lib/rexml/xpath_parser.rb#950
4774
+ def unnode(nodeset); end
4775
+
4776
+ # source://rexml//lib/rexml/xpath_parser.rb#877
4777
+ def value_type(value); end
4778
+ end
4779
+
4780
+ # source://rexml//lib/rexml/xpath_parser.rb#58
4781
+ REXML::XPathParser::DEBUG = T.let(T.unsafe(nil), FalseClass)