stripe 10.13.0.pre.beta.1 → 10.13.0

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