optimistic-json 0.1.2 → 0.1.3

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