danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,4916 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `nokogiri` gem.
5
+ # Please instead update this file by running `bin/tapioca gem nokogiri`.
6
+
7
+ # --
8
+ # DO NOT MODIFY!!!!
9
+ # This file is automatically generated by rex 1.0.7
10
+ # from lexical definition file "lib/nokogiri/css/tokenizer.rex".
11
+ # ++
12
+ module Nokogiri
13
+ class << self
14
+ def HTML(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
15
+
16
+ # :call-seq:
17
+ # HTML4(input, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block) → Nokogiri::HTML4::Document
18
+ #
19
+ # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse
20
+ def HTML4(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
21
+
22
+ # Since v1.12.0
23
+ #
24
+ # ⚠ HTML5 functionality is not available when running JRuby.
25
+ #
26
+ # Parse an HTML5 document. Convenience method for {Nokogiri::HTML5::Document.parse}
27
+ def HTML5(input, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
28
+
29
+ # Parse a document and add the Slop decorator. The Slop decorator
30
+ # implements method_missing such that methods may be used instead of CSS
31
+ # or XPath. For example:
32
+ #
33
+ # doc = Nokogiri::Slop(<<-eohtml)
34
+ # <html>
35
+ # <body>
36
+ # <p>first</p>
37
+ # <p>second</p>
38
+ # </body>
39
+ # </html>
40
+ # eohtml
41
+ # assert_equal('second', doc.html.body.p[1].text)
42
+ def Slop(*args, &block); end
43
+
44
+ # Parse XML. Convenience method for Nokogiri::XML::Document.parse
45
+ def XML(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
46
+
47
+ # Create a Nokogiri::XSLT::Stylesheet with +stylesheet+.
48
+ #
49
+ # Example:
50
+ #
51
+ # xslt = Nokogiri::XSLT(File.read(ARGV[0]))
52
+ def XSLT(stylesheet, modules = T.unsafe(nil)); end
53
+
54
+ def install_default_aliases; end
55
+
56
+ # @return [Boolean]
57
+ def jruby?; end
58
+
59
+ def libxml2_patches; end
60
+
61
+ # Create a new Nokogiri::XML::DocumentFragment
62
+ def make(input = T.unsafe(nil), opts = T.unsafe(nil), &blk); end
63
+
64
+ # Parse an HTML or XML document. +string+ contains the document.
65
+ def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
66
+
67
+ # @return [Boolean]
68
+ def uses_gumbo?; end
69
+
70
+ # @return [Boolean]
71
+ def uses_libxml?(requirement = T.unsafe(nil)); end
72
+ end
73
+ end
74
+
75
+ # Translate a CSS selector into an XPath 1.0 query
76
+ module Nokogiri::CSS
77
+ class << self
78
+ # TODO: Deprecate this method ahead of 2.0 and delete it in 2.0.
79
+ # It is not used by Nokogiri and shouldn't be part of the public API.
80
+ def parse(selector); end
81
+
82
+ # :call-seq:
83
+ # xpath_for(selector) → String
84
+ # xpath_for(selector [, prefix:] [, visitor:] [, ns:]) → String
85
+ #
86
+ # Translate a CSS selector to the equivalent XPath query.
87
+ #
88
+ # [Parameters]
89
+ # - +selector+ (String) The CSS selector to be translated into XPath
90
+ #
91
+ # - +prefix:+ (String)
92
+ #
93
+ # The XPath prefix for the query, see Nokogiri::XML::XPath for some options. Default is
94
+ # +XML::XPath::GLOBAL_SEARCH_PREFIX+.
95
+ #
96
+ # - +visitor:+ (Nokogiri::CSS::XPathVisitor)
97
+ #
98
+ # The visitor class to use to transform the AST into XPath. Default is
99
+ # +Nokogiri::CSS::XPathVisitor.new+.
100
+ #
101
+ # - +ns:+ (Hash<String ⇒ String>)
102
+ #
103
+ # The namespaces that are referenced in the query, if any. This is a hash where the keys are
104
+ # the namespace prefix and the values are the namespace URIs. Default is an empty Hash.
105
+ #
106
+ # [Returns] (String) The equivalent XPath query for +selector+
107
+ #
108
+ # 💡 Note that translated queries are cached for performance concerns.
109
+ def xpath_for(selector, options = T.unsafe(nil)); end
110
+ end
111
+ end
112
+
113
+ class Nokogiri::CSS::Node
114
+ # Create a new Node with +type+ and +value+
115
+ #
116
+ # @return [Node] a new instance of Node
117
+ def initialize(type, value); end
118
+
119
+ # Accept +visitor+
120
+ def accept(visitor); end
121
+
122
+ # Find a node by type using +types+
123
+ def find_by_type(types); end
124
+
125
+ # Convert to array
126
+ def to_a; end
127
+
128
+ # Convert to_type
129
+ def to_type; end
130
+
131
+ # Convert this CSS node to xpath with +prefix+ using +visitor+
132
+ def to_xpath(prefix, visitor); end
133
+
134
+ # Get the type of this node
135
+ def type; end
136
+
137
+ # Get the type of this node
138
+ def type=(_arg0); end
139
+
140
+ # Get the value of this node
141
+ def value; end
142
+
143
+ # Get the value of this node
144
+ def value=(_arg0); end
145
+ end
146
+
147
+ Nokogiri::CSS::Node::ALLOW_COMBINATOR_ON_SELF = T.let(T.unsafe(nil), Array)
148
+
149
+ class Nokogiri::CSS::Parser < ::Racc::Parser
150
+ # Create a new CSS parser with respect to +namespaces+
151
+ #
152
+ # @return [Parser] a new instance of Parser
153
+ def initialize(namespaces = T.unsafe(nil)); end
154
+
155
+ # reduce 0 omitted
156
+ def _reduce_1(val, _values, result); end
157
+
158
+ def _reduce_10(val, _values, result); end
159
+ def _reduce_11(val, _values, result); end
160
+
161
+ # reduce 12 omitted
162
+ def _reduce_13(val, _values, result); end
163
+
164
+ def _reduce_14(val, _values, result); end
165
+ def _reduce_15(val, _values, result); end
166
+
167
+ # reduce 16 omitted
168
+ def _reduce_17(val, _values, result); end
169
+
170
+ def _reduce_18(val, _values, result); end
171
+ def _reduce_19(val, _values, result); end
172
+ def _reduce_2(val, _values, result); end
173
+
174
+ # reduce 20 omitted
175
+ def _reduce_21(val, _values, result); end
176
+
177
+ # reduce 22 omitted
178
+ def _reduce_23(val, _values, result); end
179
+
180
+ def _reduce_24(val, _values, result); end
181
+ def _reduce_25(val, _values, result); end
182
+ def _reduce_26(val, _values, result); end
183
+
184
+ # reduce 27 omitted
185
+ def _reduce_28(val, _values, result); end
186
+
187
+ def _reduce_29(val, _values, result); end
188
+ def _reduce_3(val, _values, result); end
189
+ def _reduce_30(val, _values, result); end
190
+ def _reduce_31(val, _values, result); end
191
+ def _reduce_32(val, _values, result); end
192
+
193
+ # reduce 33 omitted
194
+ def _reduce_34(val, _values, result); end
195
+
196
+ def _reduce_35(val, _values, result); end
197
+ def _reduce_36(val, _values, result); end
198
+ def _reduce_37(val, _values, result); end
199
+ def _reduce_38(val, _values, result); end
200
+ def _reduce_39(val, _values, result); end
201
+ def _reduce_4(val, _values, result); end
202
+ def _reduce_40(val, _values, result); end
203
+ def _reduce_41(val, _values, result); end
204
+ def _reduce_42(val, _values, result); end
205
+
206
+ # reduce 44 omitted
207
+ def _reduce_45(val, _values, result); end
208
+
209
+ # reduce 46 omitted
210
+ def _reduce_47(val, _values, result); end
211
+
212
+ def _reduce_48(val, _values, result); end
213
+ def _reduce_49(val, _values, result); end
214
+ def _reduce_5(val, _values, result); end
215
+ def _reduce_50(val, _values, result); end
216
+ def _reduce_51(val, _values, result); end
217
+
218
+ # reduce 53 omitted
219
+ def _reduce_54(val, _values, result); end
220
+
221
+ def _reduce_55(val, _values, result); end
222
+ def _reduce_56(val, _values, result); end
223
+ def _reduce_57(val, _values, result); end
224
+ def _reduce_58(val, _values, result); end
225
+ def _reduce_6(val, _values, result); end
226
+
227
+ # reduce 63 omitted
228
+ def _reduce_64(val, _values, result); end
229
+
230
+ def _reduce_65(val, _values, result); end
231
+ def _reduce_66(val, _values, result); end
232
+ def _reduce_67(val, _values, result); end
233
+
234
+ # reduce 68 omitted
235
+ def _reduce_69(val, _values, result); end
236
+
237
+ def _reduce_7(val, _values, result); end
238
+ def _reduce_70(val, _values, result); end
239
+ def _reduce_71(val, _values, result); end
240
+ def _reduce_72(val, _values, result); end
241
+ def _reduce_73(val, _values, result); end
242
+ def _reduce_74(val, _values, result); end
243
+ def _reduce_75(val, _values, result); end
244
+ def _reduce_76(val, _values, result); end
245
+ def _reduce_8(val, _values, result); end
246
+ def _reduce_9(val, _values, result); end
247
+
248
+ # reduce 81 omitted
249
+ def _reduce_none(val, _values, result); end
250
+
251
+ def cache_key(query, prefix, visitor); end
252
+ def next_token; end
253
+
254
+ # On CSS parser error, raise an exception
255
+ #
256
+ # @raise [SyntaxError]
257
+ def on_error(error_token_id, error_value, value_stack); end
258
+
259
+ def parse(string); end
260
+ def unescape_css_identifier(identifier); end
261
+ def unescape_css_string(str); end
262
+
263
+ # Get the xpath for +string+ using +options+
264
+ def xpath_for(string, prefix, visitor); end
265
+
266
+ class << self
267
+ # Get the css selector in +string+ from the cache
268
+ def [](string); end
269
+
270
+ # Set the css selector in +string+ in the cache to +value+
271
+ def []=(string, value); end
272
+
273
+ # Return a thread-local boolean indicating whether the CSS-to-XPath cache is active. (Default is `true`.)
274
+ #
275
+ # @return [Boolean]
276
+ def cache_on?; end
277
+
278
+ # Clear the cache
279
+ def clear_cache(create_new_object = T.unsafe(nil)); end
280
+
281
+ # Set a thread-local boolean to turn cacheing on and off. Truthy values turn the cache on, falsey values turn the cache off.
282
+ def set_cache(value); end
283
+
284
+ # Execute +block+ without cache
285
+ def without_cache(&block); end
286
+ end
287
+ end
288
+
289
+ Nokogiri::CSS::Parser::CACHE_SWITCH_NAME = T.let(T.unsafe(nil), Symbol)
290
+ Nokogiri::CSS::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
291
+ Nokogiri::CSS::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
292
+ class Nokogiri::CSS::SyntaxError < ::Nokogiri::SyntaxError; end
293
+
294
+ class Nokogiri::CSS::Tokenizer
295
+ def _next_token; end
296
+ def action; end
297
+
298
+ # Returns the value of attribute filename.
299
+ def filename; end
300
+
301
+ # Returns the value of attribute lineno.
302
+ def lineno; end
303
+
304
+ def load_file(filename); end
305
+ def next_token; end
306
+ def scan(str); end
307
+ def scan_file(filename); end
308
+ def scan_setup(str); end
309
+ def scan_str(str); end
310
+
311
+ # Returns the value of attribute state.
312
+ def state; end
313
+
314
+ # Sets the attribute state
315
+ #
316
+ # @param value the value to set the attribute state to.
317
+ def state=(_arg0); end
318
+ end
319
+
320
+ class Nokogiri::CSS::Tokenizer::ScanError < ::StandardError; end
321
+
322
+ # When translating CSS selectors to XPath queries with Nokogiri::CSS.xpath_for, the XPathVisitor
323
+ # class allows for changing some of the behaviors related to builtin xpath functions and quirks
324
+ # of HTML5.
325
+ class Nokogiri::CSS::XPathVisitor
326
+ # :call-seq:
327
+ # new() → XPathVisitor
328
+ # new(builtins:, doctype:) → XPathVisitor
329
+ #
330
+ # [Parameters]
331
+ # - +builtins:+ (BuiltinsConfig) Determine when to use Nokogiri's built-in xpath functions for performance improvements.
332
+ # - +doctype:+ (DoctypeConfig) Make document-type-specific accommodations for CSS queries.
333
+ #
334
+ # [Returns] XPathVisitor
335
+ #
336
+ # @return [XPathVisitor] a new instance of XPathVisitor
337
+ def initialize(builtins: T.unsafe(nil), doctype: T.unsafe(nil)); end
338
+
339
+ def accept(node); end
340
+
341
+ # :call-seq: config() → Hash
342
+ #
343
+ # [Returns]
344
+ # a Hash representing the configuration of the XPathVisitor, suitable for use as
345
+ # part of the CSS cache key.
346
+ def config; end
347
+
348
+ def visit_attrib_name(node); end
349
+ def visit_attribute_condition(node); end
350
+ def visit_child_selector(node); end
351
+ def visit_class_condition(node); end
352
+ def visit_combinator(node); end
353
+ def visit_conditional_selector(node); end
354
+ def visit_descendant_selector(node); end
355
+ def visit_direct_adjacent_selector(node); end
356
+ def visit_element_name(node); end
357
+ def visit_following_selector(node); end
358
+
359
+ # :stopdoc:
360
+ def visit_function(node); end
361
+
362
+ def visit_id(node); end
363
+ def visit_not(node); end
364
+ def visit_pseudo_class(node); end
365
+
366
+ private
367
+
368
+ def css_class(hay, needle); end
369
+ def html5_element_name_needs_namespace_handling(node); end
370
+
371
+ # @return [Boolean]
372
+ def is_of_type_pseudo_class?(node); end
373
+
374
+ # @raise [ArgumentError]
375
+ def nth(node, options = T.unsafe(nil)); end
376
+
377
+ def read_a_and_positive_b(values); end
378
+ end
379
+
380
+ # Enum to direct XPathVisitor when to use Nokogiri builtin XPath functions.
381
+ module Nokogiri::CSS::XPathVisitor::BuiltinsConfig; end
382
+
383
+ # Always use Nokogiri builtin functions whenever possible. This is probably only useful for testing.
384
+ Nokogiri::CSS::XPathVisitor::BuiltinsConfig::ALWAYS = T.let(T.unsafe(nil), Symbol)
385
+
386
+ # Never use Nokogiri builtin functions, always generate vanilla XPath 1.0 queries. This is
387
+ # the default when calling Nokogiri::CSS.xpath_for directly.
388
+ Nokogiri::CSS::XPathVisitor::BuiltinsConfig::NEVER = T.let(T.unsafe(nil), Symbol)
389
+
390
+ # Only use Nokogiri builtin functions when they will be faster than vanilla XPath. This is
391
+ # the behavior chosen when searching for CSS selectors on a Nokogiri document, fragment, or
392
+ # node.
393
+ Nokogiri::CSS::XPathVisitor::BuiltinsConfig::OPTIMAL = T.let(T.unsafe(nil), Symbol)
394
+
395
+ Nokogiri::CSS::XPathVisitor::BuiltinsConfig::VALUES = T.let(T.unsafe(nil), Array)
396
+
397
+ # Enum to direct XPathVisitor when to tweak the XPath query to suit the nature of the document
398
+ # being searched. Note that searches for CSS selectors from a Nokogiri document, fragment, or
399
+ # node will choose the correct option automatically.
400
+ module Nokogiri::CSS::XPathVisitor::DoctypeConfig; end
401
+
402
+ # The document being searched is an HTML4 document.
403
+ Nokogiri::CSS::XPathVisitor::DoctypeConfig::HTML4 = T.let(T.unsafe(nil), Symbol)
404
+
405
+ # The document being searched is an HTML5 document.
406
+ Nokogiri::CSS::XPathVisitor::DoctypeConfig::HTML5 = T.let(T.unsafe(nil), Symbol)
407
+
408
+ Nokogiri::CSS::XPathVisitor::DoctypeConfig::VALUES = T.let(T.unsafe(nil), Array)
409
+
410
+ # The document being searched is an XML document. This is the default.
411
+ Nokogiri::CSS::XPathVisitor::DoctypeConfig::XML = T.let(T.unsafe(nil), Symbol)
412
+
413
+ Nokogiri::CSS::XPathVisitor::WILDCARD_NAMESPACES = T.let(T.unsafe(nil), TrueClass)
414
+
415
+ module Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins
416
+ class << self
417
+ def new; end
418
+ end
419
+ end
420
+
421
+ module Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins
422
+ class << self
423
+ def new; end
424
+ end
425
+ end
426
+
427
+ # Some classes in Nokogiri are namespaced as a group, for example
428
+ # Document, DocumentFragment, and Builder.
429
+ #
430
+ # It's sometimes necessary to look up the related class, e.g.:
431
+ #
432
+ # XML::Builder → XML::Document
433
+ # HTML4::Builder → HTML4::Document
434
+ # HTML5::Document → HTML5::DocumentFragment
435
+ #
436
+ # This module is included into those key classes who need to do this.
437
+ module Nokogiri::ClassResolver
438
+ # :call-seq:
439
+ # related_class(class_name) → Class
440
+ #
441
+ # Find a class constant within the
442
+ #
443
+ # Some examples:
444
+ #
445
+ # Nokogiri::XML::Document.new.related_class("DocumentFragment")
446
+ # # => Nokogiri::XML::DocumentFragment
447
+ # Nokogiri::HTML4::Document.new.related_class("DocumentFragment")
448
+ # # => Nokogiri::HTML4::DocumentFragment
449
+ #
450
+ # Note this will also work for subclasses that follow the same convention, e.g.:
451
+ #
452
+ # Loofah::HTML::Document.new.related_class("DocumentFragment")
453
+ # # => Loofah::HTML::DocumentFragment
454
+ #
455
+ # And even if it's a subclass, this will iterate through the superclasses:
456
+ #
457
+ # class ThisIsATopLevelClass < Nokogiri::HTML4::Builder ; end
458
+ # ThisIsATopLevelClass.new.related_class("Document")
459
+ # # => Nokogiri::HTML4::Document
460
+ def related_class(class_name); end
461
+ end
462
+
463
+ # #related_class restricts matching namespaces to those matching this set.
464
+ Nokogiri::ClassResolver::VALID_NAMESPACES = T.let(T.unsafe(nil), Set)
465
+
466
+ module Nokogiri::Decorators; end
467
+
468
+ # The Slop decorator implements method missing such that a methods may be
469
+ # used instead of XPath or CSS. See Nokogiri.Slop
470
+ module Nokogiri::Decorators::Slop
471
+ # look for node with +name+. See Nokogiri.Slop
472
+ def method_missing(name, *args, &block); end
473
+
474
+ private
475
+
476
+ # @return [Boolean]
477
+ def respond_to_missing?(name, include_private = T.unsafe(nil)); end
478
+ end
479
+
480
+ # The default XPath search context for Slop
481
+ Nokogiri::Decorators::Slop::XPATH_PREFIX = T.let(T.unsafe(nil), String)
482
+
483
+ class Nokogiri::EncodingHandler
484
+ def name; end
485
+
486
+ class << self
487
+ def [](_arg0); end
488
+ def alias(_arg0, _arg1); end
489
+ def clear_aliases!; end
490
+ def delete(_arg0); end
491
+ end
492
+ end
493
+
494
+ module Nokogiri::Gumbo
495
+ class << self
496
+ def fragment(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
497
+ def parse(_arg0, _arg1, _arg2, _arg3, _arg4); end
498
+ end
499
+ end
500
+
501
+ # The default maximum number of attributes per element.
502
+ Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = T.let(T.unsafe(nil), Integer)
503
+
504
+ # The default maximum number of errors for parsing a document or a fragment.
505
+ Nokogiri::Gumbo::DEFAULT_MAX_ERRORS = T.let(T.unsafe(nil), Integer)
506
+
507
+ # The default maximum depth of the DOM tree produced by parsing a document
508
+ # or fragment.
509
+ Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = T.let(T.unsafe(nil), Integer)
510
+
511
+ # 💡 This module/namespace is an alias for Nokogiri::HTML4 as of v1.12.0. Before v1.12.0,
512
+ # Nokogiri::HTML4 did not exist, and this was the module/namespace for all HTML-related
513
+ # classes.
514
+ Nokogiri::HTML = Nokogiri::HTML4
515
+
516
+ # Since v1.12.0
517
+ #
518
+ # 💡 Before v1.12.0, Nokogiri::HTML4 did not exist, and Nokogiri::HTML was the module/namespace
519
+ # for parsing HTML.
520
+ module Nokogiri::HTML4
521
+ class << self
522
+ # Parse a fragment from +string+ in to a NodeSet.
523
+ def fragment(string, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
524
+
525
+ # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse
526
+ def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
527
+ end
528
+ end
529
+
530
+ # Nokogiri HTML builder is used for building HTML documents. It is very
531
+ # similar to the Nokogiri::XML::Builder. In fact, you should go read the
532
+ # documentation for Nokogiri::XML::Builder before reading this
533
+ # documentation.
534
+ #
535
+ # == Synopsis:
536
+ #
537
+ # Create an HTML document with a body that has an onload attribute, and a
538
+ # span tag with a class of "bold" that has content of "Hello world".
539
+ #
540
+ # builder = Nokogiri::HTML4::Builder.new do |doc|
541
+ # doc.html {
542
+ # doc.body(:onload => 'some_func();') {
543
+ # doc.span.bold {
544
+ # doc.text "Hello world"
545
+ # }
546
+ # }
547
+ # }
548
+ # end
549
+ # puts builder.to_html
550
+ #
551
+ # The HTML builder inherits from the XML builder, so make sure to read the
552
+ # Nokogiri::XML::Builder documentation.
553
+ class Nokogiri::HTML4::Builder < ::Nokogiri::XML::Builder
554
+ # Convert the builder to HTML
555
+ def to_html; end
556
+ end
557
+
558
+ class Nokogiri::HTML4::Document < ::Nokogiri::XML::Document
559
+ # Create a Nokogiri::XML::DocumentFragment from +tags+
560
+ def fragment(tags = T.unsafe(nil)); end
561
+
562
+ # Get the meta tag encoding for this document. If there is no meta tag,
563
+ # then nil is returned.
564
+ def meta_encoding; end
565
+
566
+ # Set the meta tag encoding for this document.
567
+ #
568
+ # If an meta encoding tag is already present, its content is
569
+ # replaced with the given text.
570
+ #
571
+ # Otherwise, this method tries to create one at an appropriate
572
+ # place supplying head and/or html elements as necessary, which
573
+ # is inside a head element if any, and before any text node or
574
+ # content element (typically <body>) if any.
575
+ #
576
+ # The result when trying to set an encoding that is different
577
+ # from the document encoding is undefined.
578
+ #
579
+ # Beware in CRuby, that libxml2 automatically inserts a meta tag
580
+ # into a head element.
581
+ def meta_encoding=(encoding); end
582
+
583
+ # Serialize Node using +options+. Save options can also be set using a block.
584
+ #
585
+ # See also Nokogiri::XML::Node::SaveOptions and Node@Serialization+and+Generating+Output.
586
+ #
587
+ # These two statements are equivalent:
588
+ #
589
+ # node.serialize(:encoding => 'UTF-8', :save_with => FORMAT | AS_XML)
590
+ #
591
+ # or
592
+ #
593
+ # node.serialize(:encoding => 'UTF-8') do |config|
594
+ # config.format.as_xml
595
+ # end
596
+ def serialize(options = T.unsafe(nil)); end
597
+
598
+ # Get the title string of this document. Return nil if there is
599
+ # no title tag.
600
+ def title; end
601
+
602
+ # Set the title string of this document.
603
+ #
604
+ # If a title element is already present, its content is replaced
605
+ # with the given text.
606
+ #
607
+ # Otherwise, this method tries to create one at an appropriate
608
+ # place supplying head and/or html elements as necessary, which
609
+ # is inside a head element if any, right after a meta
610
+ # encoding/charset tag if any, and before any text node or
611
+ # content element (typically <body>) if any.
612
+ def title=(text); end
613
+
614
+ def type; end
615
+
616
+ # :call-seq:
617
+ # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig
618
+ #
619
+ # [Returns] The document type which determines CSS-to-XPath translation.
620
+ #
621
+ # See XPathVisitor for more information.
622
+ def xpath_doctype; end
623
+
624
+ private
625
+
626
+ def meta_content_type; end
627
+ def set_metadata_element(element); end
628
+
629
+ class << self
630
+ def new(*_arg0); end
631
+
632
+ # Parse HTML. +string_or_io+ may be a String, or any object that
633
+ # responds to _read_ and _close_ such as an IO, or StringIO.
634
+ # +url+ is resource where this document is located. +encoding+ is the
635
+ # encoding that should be used when processing the document. +options+
636
+ # is a number that sets options in the parser, such as
637
+ # Nokogiri::XML::ParseOptions::RECOVER. See the constants in
638
+ # Nokogiri::XML::ParseOptions.
639
+ #
640
+ # @yield [options]
641
+ def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
642
+
643
+ def read_io(_arg0, _arg1, _arg2, _arg3); end
644
+ def read_memory(_arg0, _arg1, _arg2, _arg3); end
645
+ end
646
+ end
647
+
648
+ class Nokogiri::HTML4::Document::EncodingFound < ::StandardError
649
+ # @return [EncodingFound] a new instance of EncodingFound
650
+ def initialize(encoding); end
651
+
652
+ # Returns the value of attribute found_encoding.
653
+ def found_encoding; end
654
+ end
655
+
656
+ class Nokogiri::HTML4::Document::EncodingReader
657
+ # @return [EncodingReader] a new instance of EncodingReader
658
+ def initialize(io); end
659
+
660
+ # This method is used by the C extension so that
661
+ # Nokogiri::HTML4::Document#read_io() does not leak memory when
662
+ # EncodingFound is raised.
663
+ def encoding_found; end
664
+
665
+ def read(len); end
666
+
667
+ class << self
668
+ def detect_encoding(chunk); end
669
+ end
670
+ end
671
+
672
+ class Nokogiri::HTML4::Document::EncodingReader::JumpSAXHandler < ::Nokogiri::HTML4::Document::EncodingReader::SAXHandler
673
+ # @return [JumpSAXHandler] a new instance of JumpSAXHandler
674
+ def initialize(jumptag); end
675
+
676
+ def start_element(name, attrs = T.unsafe(nil)); end
677
+ end
678
+
679
+ class Nokogiri::HTML4::Document::EncodingReader::SAXHandler < ::Nokogiri::XML::SAX::Document
680
+ # @return [SAXHandler] a new instance of SAXHandler
681
+ def initialize; end
682
+
683
+ # Returns the value of attribute encoding.
684
+ def encoding; end
685
+
686
+ def start_element(name, attrs = T.unsafe(nil)); end
687
+ end
688
+
689
+ class Nokogiri::HTML4::DocumentFragment < ::Nokogiri::XML::DocumentFragment
690
+ # @return [DocumentFragment] a new instance of DocumentFragment
691
+ # @yield [options]
692
+ def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
693
+
694
+ class << self
695
+ # Create a Nokogiri::XML::DocumentFragment from +tags+, using +encoding+
696
+ def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
697
+ end
698
+ end
699
+
700
+ class Nokogiri::HTML4::ElementDescription
701
+ # Is this element a block element?
702
+ #
703
+ # @return [Boolean]
704
+ def block?; end
705
+
706
+ def default_sub_element; end
707
+
708
+ # @return [Boolean]
709
+ def deprecated?; end
710
+
711
+ def deprecated_attributes; end
712
+ def description; end
713
+ def empty?; end
714
+
715
+ # @return [Boolean]
716
+ def implied_end_tag?; end
717
+
718
+ # @return [Boolean]
719
+ def implied_start_tag?; end
720
+
721
+ def inline?; end
722
+
723
+ # Inspection information
724
+ def inspect; end
725
+
726
+ def name; end
727
+ def optional_attributes; end
728
+ def required_attributes; end
729
+
730
+ # @return [Boolean]
731
+ def save_end_tag?; end
732
+
733
+ def sub_elements; end
734
+
735
+ # Convert this description to a string
736
+ def to_s; end
737
+
738
+ private
739
+
740
+ def default_desc; end
741
+
742
+ class << self
743
+ def [](_arg0); end
744
+ end
745
+ end
746
+
747
+ Nokogiri::HTML4::ElementDescription::ACTION_ATTR = T.let(T.unsafe(nil), Array)
748
+ Nokogiri::HTML4::ElementDescription::ALIGN_ATTR = T.let(T.unsafe(nil), Array)
749
+ Nokogiri::HTML4::ElementDescription::ALT_ATTR = T.let(T.unsafe(nil), Array)
750
+ Nokogiri::HTML4::ElementDescription::APPLET_ATTRS = T.let(T.unsafe(nil), Array)
751
+ Nokogiri::HTML4::ElementDescription::AREA_ATTRS = T.let(T.unsafe(nil), Array)
752
+ Nokogiri::HTML4::ElementDescription::ATTRS = T.let(T.unsafe(nil), Array)
753
+ Nokogiri::HTML4::ElementDescription::A_ATTRS = T.let(T.unsafe(nil), Array)
754
+ Nokogiri::HTML4::ElementDescription::BASEFONT_ATTRS = T.let(T.unsafe(nil), Array)
755
+ Nokogiri::HTML4::ElementDescription::BGCOLOR_ATTR = T.let(T.unsafe(nil), Array)
756
+ Nokogiri::HTML4::ElementDescription::BLOCK = T.let(T.unsafe(nil), Array)
757
+ Nokogiri::HTML4::ElementDescription::BLOCKLI_ELT = T.let(T.unsafe(nil), Array)
758
+ Nokogiri::HTML4::ElementDescription::BODY_ATTRS = T.let(T.unsafe(nil), Array)
759
+ Nokogiri::HTML4::ElementDescription::BODY_CONTENTS = T.let(T.unsafe(nil), Array)
760
+ Nokogiri::HTML4::ElementDescription::BODY_DEPR = T.let(T.unsafe(nil), Array)
761
+ Nokogiri::HTML4::ElementDescription::BUTTON_ATTRS = T.let(T.unsafe(nil), Array)
762
+ Nokogiri::HTML4::ElementDescription::CELLHALIGN = T.let(T.unsafe(nil), Array)
763
+ Nokogiri::HTML4::ElementDescription::CELLVALIGN = T.let(T.unsafe(nil), Array)
764
+ Nokogiri::HTML4::ElementDescription::CLEAR_ATTRS = T.let(T.unsafe(nil), Array)
765
+ Nokogiri::HTML4::ElementDescription::COL_ATTRS = T.let(T.unsafe(nil), Array)
766
+ Nokogiri::HTML4::ElementDescription::COL_ELT = T.let(T.unsafe(nil), Array)
767
+ Nokogiri::HTML4::ElementDescription::COMPACT_ATTR = T.let(T.unsafe(nil), Array)
768
+ Nokogiri::HTML4::ElementDescription::COMPACT_ATTRS = T.let(T.unsafe(nil), Array)
769
+ Nokogiri::HTML4::ElementDescription::CONTENT_ATTR = T.let(T.unsafe(nil), Array)
770
+ Nokogiri::HTML4::ElementDescription::COREATTRS = T.let(T.unsafe(nil), Array)
771
+ Nokogiri::HTML4::ElementDescription::CORE_ATTRS = T.let(T.unsafe(nil), Array)
772
+ Nokogiri::HTML4::ElementDescription::CORE_I18N_ATTRS = T.let(T.unsafe(nil), Array)
773
+ Nokogiri::HTML4::ElementDescription::DIR_ATTR = T.let(T.unsafe(nil), Array)
774
+ Nokogiri::HTML4::ElementDescription::DL_CONTENTS = T.let(T.unsafe(nil), Array)
775
+
776
+ # This is filled in down below.
777
+ Nokogiri::HTML4::ElementDescription::DefaultDescriptions = T.let(T.unsafe(nil), Hash)
778
+
779
+ # Methods are defined protected by method_defined? because at
780
+ # this point the C-library or Java library is already loaded,
781
+ # and we don't want to clobber any methods that have been
782
+ # defined there.
783
+ Nokogiri::HTML4::ElementDescription::Desc = Struct
784
+
785
+ Nokogiri::HTML4::ElementDescription::EDIT_ATTRS = T.let(T.unsafe(nil), Array)
786
+ Nokogiri::HTML4::ElementDescription::EMBED_ATTRS = T.let(T.unsafe(nil), Array)
787
+ Nokogiri::HTML4::ElementDescription::EMPTY = T.let(T.unsafe(nil), Array)
788
+ Nokogiri::HTML4::ElementDescription::EVENTS = T.let(T.unsafe(nil), Array)
789
+ Nokogiri::HTML4::ElementDescription::FIELDSET_CONTENTS = T.let(T.unsafe(nil), Array)
790
+ Nokogiri::HTML4::ElementDescription::FLOW = T.let(T.unsafe(nil), Array)
791
+ Nokogiri::HTML4::ElementDescription::FLOW_PARAM = T.let(T.unsafe(nil), Array)
792
+
793
+ # Attributes defined and categorized
794
+ Nokogiri::HTML4::ElementDescription::FONTSTYLE = T.let(T.unsafe(nil), Array)
795
+
796
+ Nokogiri::HTML4::ElementDescription::FONT_ATTRS = T.let(T.unsafe(nil), Array)
797
+ Nokogiri::HTML4::ElementDescription::FORMCTRL = T.let(T.unsafe(nil), Array)
798
+ Nokogiri::HTML4::ElementDescription::FORM_ATTRS = T.let(T.unsafe(nil), Array)
799
+ Nokogiri::HTML4::ElementDescription::FORM_CONTENTS = T.let(T.unsafe(nil), Array)
800
+ Nokogiri::HTML4::ElementDescription::FRAMESET_ATTRS = T.let(T.unsafe(nil), Array)
801
+ Nokogiri::HTML4::ElementDescription::FRAMESET_CONTENTS = T.let(T.unsafe(nil), Array)
802
+ Nokogiri::HTML4::ElementDescription::FRAME_ATTRS = T.let(T.unsafe(nil), Array)
803
+ Nokogiri::HTML4::ElementDescription::HEADING = T.let(T.unsafe(nil), Array)
804
+ Nokogiri::HTML4::ElementDescription::HEAD_ATTRS = T.let(T.unsafe(nil), Array)
805
+ Nokogiri::HTML4::ElementDescription::HEAD_CONTENTS = T.let(T.unsafe(nil), Array)
806
+ Nokogiri::HTML4::ElementDescription::HREF_ATTRS = T.let(T.unsafe(nil), Array)
807
+ Nokogiri::HTML4::ElementDescription::HR_DEPR = T.let(T.unsafe(nil), Array)
808
+ Nokogiri::HTML4::ElementDescription::HTML_ATTRS = T.let(T.unsafe(nil), Array)
809
+ Nokogiri::HTML4::ElementDescription::HTML_CDATA = T.let(T.unsafe(nil), Array)
810
+ Nokogiri::HTML4::ElementDescription::HTML_CONTENT = T.let(T.unsafe(nil), Array)
811
+ Nokogiri::HTML4::ElementDescription::HTML_FLOW = T.let(T.unsafe(nil), Array)
812
+ Nokogiri::HTML4::ElementDescription::HTML_INLINE = T.let(T.unsafe(nil), Array)
813
+ Nokogiri::HTML4::ElementDescription::HTML_PCDATA = T.let(T.unsafe(nil), Array)
814
+ Nokogiri::HTML4::ElementDescription::I18N = T.let(T.unsafe(nil), Array)
815
+ Nokogiri::HTML4::ElementDescription::I18N_ATTRS = T.let(T.unsafe(nil), Array)
816
+ Nokogiri::HTML4::ElementDescription::IFRAME_ATTRS = T.let(T.unsafe(nil), Array)
817
+ Nokogiri::HTML4::ElementDescription::IMG_ATTRS = T.let(T.unsafe(nil), Array)
818
+ Nokogiri::HTML4::ElementDescription::INLINE = T.let(T.unsafe(nil), Array)
819
+ Nokogiri::HTML4::ElementDescription::INLINE_P = T.let(T.unsafe(nil), Array)
820
+ Nokogiri::HTML4::ElementDescription::INPUT_ATTRS = T.let(T.unsafe(nil), Array)
821
+ Nokogiri::HTML4::ElementDescription::LABEL_ATTR = T.let(T.unsafe(nil), Array)
822
+ Nokogiri::HTML4::ElementDescription::LABEL_ATTRS = T.let(T.unsafe(nil), Array)
823
+ Nokogiri::HTML4::ElementDescription::LANGUAGE_ATTR = T.let(T.unsafe(nil), Array)
824
+ Nokogiri::HTML4::ElementDescription::LEGEND_ATTRS = T.let(T.unsafe(nil), Array)
825
+ Nokogiri::HTML4::ElementDescription::LINK_ATTRS = T.let(T.unsafe(nil), Array)
826
+ Nokogiri::HTML4::ElementDescription::LIST = T.let(T.unsafe(nil), Array)
827
+ Nokogiri::HTML4::ElementDescription::LI_ELT = T.let(T.unsafe(nil), Array)
828
+ Nokogiri::HTML4::ElementDescription::MAP_CONTENTS = T.let(T.unsafe(nil), Array)
829
+ Nokogiri::HTML4::ElementDescription::META_ATTRS = T.let(T.unsafe(nil), Array)
830
+ Nokogiri::HTML4::ElementDescription::MODIFIER = T.let(T.unsafe(nil), Array)
831
+ Nokogiri::HTML4::ElementDescription::NAME_ATTR = T.let(T.unsafe(nil), Array)
832
+ Nokogiri::HTML4::ElementDescription::NOFRAMES_CONTENT = T.let(T.unsafe(nil), Array)
833
+ Nokogiri::HTML4::ElementDescription::OBJECT_ATTRS = T.let(T.unsafe(nil), Array)
834
+ Nokogiri::HTML4::ElementDescription::OBJECT_CONTENTS = T.let(T.unsafe(nil), Array)
835
+ Nokogiri::HTML4::ElementDescription::OBJECT_DEPR = T.let(T.unsafe(nil), Array)
836
+ Nokogiri::HTML4::ElementDescription::OL_ATTRS = T.let(T.unsafe(nil), Array)
837
+ Nokogiri::HTML4::ElementDescription::OPTGROUP_ATTRS = T.let(T.unsafe(nil), Array)
838
+ Nokogiri::HTML4::ElementDescription::OPTION_ATTRS = T.let(T.unsafe(nil), Array)
839
+ Nokogiri::HTML4::ElementDescription::OPTION_ELT = T.let(T.unsafe(nil), Array)
840
+ Nokogiri::HTML4::ElementDescription::PARAM_ATTRS = T.let(T.unsafe(nil), Array)
841
+ Nokogiri::HTML4::ElementDescription::PCDATA = T.let(T.unsafe(nil), Array)
842
+ Nokogiri::HTML4::ElementDescription::PHRASE = T.let(T.unsafe(nil), Array)
843
+ Nokogiri::HTML4::ElementDescription::PRE_CONTENT = T.let(T.unsafe(nil), Array)
844
+ Nokogiri::HTML4::ElementDescription::PROMPT_ATTRS = T.let(T.unsafe(nil), Array)
845
+ Nokogiri::HTML4::ElementDescription::QUOTE_ATTRS = T.let(T.unsafe(nil), Array)
846
+ Nokogiri::HTML4::ElementDescription::ROWS_COLS_ATTR = T.let(T.unsafe(nil), Array)
847
+ Nokogiri::HTML4::ElementDescription::SCRIPT_ATTRS = T.let(T.unsafe(nil), Array)
848
+ Nokogiri::HTML4::ElementDescription::SELECT_ATTRS = T.let(T.unsafe(nil), Array)
849
+ Nokogiri::HTML4::ElementDescription::SELECT_CONTENT = T.let(T.unsafe(nil), Array)
850
+ Nokogiri::HTML4::ElementDescription::SPECIAL = T.let(T.unsafe(nil), Array)
851
+ Nokogiri::HTML4::ElementDescription::SRC_ALT_ATTRS = T.let(T.unsafe(nil), Array)
852
+ Nokogiri::HTML4::ElementDescription::STYLE_ATTRS = T.let(T.unsafe(nil), Array)
853
+ Nokogiri::HTML4::ElementDescription::TABLE_ATTRS = T.let(T.unsafe(nil), Array)
854
+ Nokogiri::HTML4::ElementDescription::TABLE_CONTENTS = T.let(T.unsafe(nil), Array)
855
+ Nokogiri::HTML4::ElementDescription::TABLE_DEPR = T.let(T.unsafe(nil), Array)
856
+ Nokogiri::HTML4::ElementDescription::TALIGN_ATTRS = T.let(T.unsafe(nil), Array)
857
+ Nokogiri::HTML4::ElementDescription::TARGET_ATTR = T.let(T.unsafe(nil), Array)
858
+ Nokogiri::HTML4::ElementDescription::TEXTAREA_ATTRS = T.let(T.unsafe(nil), Array)
859
+ Nokogiri::HTML4::ElementDescription::TH_TD_ATTR = T.let(T.unsafe(nil), Array)
860
+ Nokogiri::HTML4::ElementDescription::TH_TD_DEPR = T.let(T.unsafe(nil), Array)
861
+ Nokogiri::HTML4::ElementDescription::TR_CONTENTS = T.let(T.unsafe(nil), Array)
862
+ Nokogiri::HTML4::ElementDescription::TR_ELT = T.let(T.unsafe(nil), Array)
863
+ Nokogiri::HTML4::ElementDescription::TYPE_ATTR = T.let(T.unsafe(nil), Array)
864
+ Nokogiri::HTML4::ElementDescription::UL_DEPR = T.let(T.unsafe(nil), Array)
865
+ Nokogiri::HTML4::ElementDescription::VERSION_ATTR = T.let(T.unsafe(nil), Array)
866
+ Nokogiri::HTML4::ElementDescription::WIDTH_ATTR = T.let(T.unsafe(nil), Array)
867
+ class Nokogiri::HTML4::EntityDescription < ::Struct; end
868
+
869
+ class Nokogiri::HTML4::EntityLookup
870
+ # Look up entity with +name+
871
+ def [](name); end
872
+
873
+ def get(_arg0); end
874
+ end
875
+
876
+ # Instance of Nokogiri::HTML4::EntityLookup
877
+ Nokogiri::HTML4::NamedCharacters = T.let(T.unsafe(nil), Nokogiri::HTML4::EntityLookup)
878
+
879
+ # Nokogiri lets you write a SAX parser to process HTML but get HTML correction features.
880
+ #
881
+ # See Nokogiri::HTML4::SAX::Parser for a basic example of using a SAX parser with HTML.
882
+ #
883
+ # For more information on SAX parsers, see Nokogiri::XML::SAX
884
+ module Nokogiri::HTML4::SAX; end
885
+
886
+ # This class lets you perform SAX style parsing on HTML with HTML error correction.
887
+ #
888
+ # Here is a basic usage example:
889
+ #
890
+ # class MyDoc < Nokogiri::XML::SAX::Document
891
+ # def start_element name, attributes = []
892
+ # puts "found a #{name}"
893
+ # end
894
+ # end
895
+ #
896
+ # parser = Nokogiri::HTML4::SAX::Parser.new(MyDoc.new)
897
+ # parser.parse(File.read(ARGV[0], mode: 'rb'))
898
+ #
899
+ # For more information on SAX parsers, see Nokogiri::XML::SAX
900
+ class Nokogiri::HTML4::SAX::Parser < ::Nokogiri::XML::SAX::Parser
901
+ # Parse a file with +filename+
902
+ #
903
+ # @raise [ArgumentError]
904
+ # @yield [ctx]
905
+ def parse_file(filename, encoding = T.unsafe(nil)); end
906
+
907
+ # Parse given +io+
908
+ #
909
+ # @yield [ctx]
910
+ def parse_io(io, encoding = T.unsafe(nil)); end
911
+
912
+ # Parse html stored in +data+ using +encoding+
913
+ #
914
+ # @raise [TypeError]
915
+ # @yield [ctx]
916
+ def parse_memory(data, encoding = T.unsafe(nil)); end
917
+ end
918
+
919
+ # Context for HTML SAX parsers. This class is usually not instantiated by the user. Instead,
920
+ # you should be looking at Nokogiri::HTML4::SAX::Parser
921
+ class Nokogiri::HTML4::SAX::ParserContext < ::Nokogiri::XML::SAX::ParserContext
922
+ def parse_with(_arg0); end
923
+
924
+ class << self
925
+ def file(_arg0, _arg1); end
926
+ def memory(_arg0, _arg1); end
927
+ def new(thing, encoding = T.unsafe(nil)); end
928
+ end
929
+ end
930
+
931
+ class Nokogiri::HTML4::SAX::PushParser < ::Nokogiri::XML::SAX::PushParser
932
+ # @return [PushParser] a new instance of PushParser
933
+ def initialize(doc = T.unsafe(nil), file_name = T.unsafe(nil), encoding = T.unsafe(nil)); end
934
+
935
+ # Write a +chunk+ of HTML to the PushParser. Any callback methods
936
+ # that can be called will be called immediately.
937
+ def <<(chunk, last_chunk = T.unsafe(nil)); end
938
+
939
+ # The Nokogiri::HTML4::SAX::Document on which the PushParser will be
940
+ # operating
941
+ def document; end
942
+
943
+ # The Nokogiri::HTML4::SAX::Document on which the PushParser will be
944
+ # operating
945
+ def document=(_arg0); end
946
+
947
+ # Finish the parsing. This method is only necessary for
948
+ # Nokogiri::HTML4::SAX::Document#end_document to be called.
949
+ def finish; end
950
+
951
+ # Write a +chunk+ of HTML to the PushParser. Any callback methods
952
+ # that can be called will be called immediately.
953
+ def write(chunk, last_chunk = T.unsafe(nil)); end
954
+
955
+ private
956
+
957
+ def initialize_native(_arg0, _arg1, _arg2); end
958
+ def native_write(_arg0, _arg1); end
959
+ end
960
+
961
+ # == Usage
962
+ #
963
+ # ⚠ HTML5 functionality is not available when running JRuby.
964
+ #
965
+ # Parse an HTML5 document:
966
+ #
967
+ # doc = Nokogiri.HTML5(string)
968
+ #
969
+ # Parse an HTML5 fragment:
970
+ #
971
+ # fragment = Nokogiri::HTML5.fragment(string)
972
+ #
973
+ # == Parsing options
974
+ #
975
+ # The document and fragment parsing methods support options that are different from Nokogiri's.
976
+ #
977
+ # - <tt>Nokogiri.HTML5(html, url = nil, encoding = nil, options = {})</tt>
978
+ # - <tt>Nokogiri::HTML5.parse(html, url = nil, encoding = nil, options = {})</tt>
979
+ # - <tt>Nokogiri::HTML5::Document.parse(html, url = nil, encoding = nil, options = {})</tt>
980
+ # - <tt>Nokogiri::HTML5.fragment(html, encoding = nil, options = {})</tt>
981
+ # - <tt>Nokogiri::HTML5::DocumentFragment.parse(html, encoding = nil, options = {})</tt>
982
+ #
983
+ # The three currently supported options are +:max_errors+, +:max_tree_depth+ and
984
+ # +:max_attributes+, described below.
985
+ #
986
+ # === Error reporting
987
+ #
988
+ # Nokogiri contains an experimental HTML5 parse error reporting facility. By default, no parse
989
+ # errors are reported but this can be configured by passing the +:max_errors+ option to
990
+ # {HTML5.parse} or {HTML5.fragment}.
991
+ #
992
+ # For example, this script:
993
+ #
994
+ # doc = Nokogiri::HTML5.parse('<span/>Hi there!</span foo=bar />', max_errors: 10)
995
+ # doc.errors.each do |err|
996
+ # puts(err)
997
+ # end
998
+ #
999
+ # Emits:
1000
+ #
1001
+ # 1:1: ERROR: Expected a doctype token
1002
+ # <span/>Hi there!</span foo=bar />
1003
+ # ^
1004
+ # 1:1: ERROR: Start tag of nonvoid HTML element ends with '/>', use '>'.
1005
+ # <span/>Hi there!</span foo=bar />
1006
+ # ^
1007
+ # 1:17: ERROR: End tag ends with '/>', use '>'.
1008
+ # <span/>Hi there!</span foo=bar />
1009
+ # ^
1010
+ # 1:17: ERROR: End tag contains attributes.
1011
+ # <span/>Hi there!</span foo=bar />
1012
+ # ^
1013
+ #
1014
+ # Using <tt>max_errors: -1</tt> results in an unlimited number of errors being returned.
1015
+ #
1016
+ # The errors returned by {HTML5::Document#errors} are instances of {Nokogiri::XML::SyntaxError}.
1017
+ #
1018
+ # The {https://html.spec.whatwg.org/multipage/parsing.html#parse-errors HTML standard} defines a
1019
+ # number of standard parse error codes. These error codes only cover the "tokenization" stage of
1020
+ # parsing HTML. The parse errors in the "tree construction" stage do not have standardized error
1021
+ # codes (yet).
1022
+ #
1023
+ # As a convenience to Nokogiri users, the defined error codes are available via
1024
+ # {Nokogiri::XML::SyntaxError#str1} method.
1025
+ #
1026
+ # doc = Nokogiri::HTML5.parse('<span/>Hi there!</span foo=bar />', max_errors: 10)
1027
+ # doc.errors.each do |err|
1028
+ # puts("#{err.line}:#{err.column}: #{err.str1}")
1029
+ # end
1030
+ # # => 1:1: generic-parser
1031
+ # # 1:1: non-void-html-element-start-tag-with-trailing-solidus
1032
+ # # 1:17: end-tag-with-trailing-solidus
1033
+ # # 1:17: end-tag-with-attributes
1034
+ #
1035
+ # Note that the first error is +generic-parser+ because it's an error from the tree construction
1036
+ # stage and doesn't have a standardized error code.
1037
+ #
1038
+ # For the purposes of semantic versioning, the error messages, error locations, and error codes
1039
+ # are not part of Nokogiri's public API. That is, these are subject to change without Nokogiri's
1040
+ # major version number changing. These may be stabilized in the future.
1041
+ #
1042
+ # === Maximum tree depth
1043
+ #
1044
+ # The maximum depth of the DOM tree parsed by the various parsing methods is configurable by the
1045
+ # +:max_tree_depth+ option. If the depth of the tree would exceed this limit, then an
1046
+ # {::ArgumentError} is thrown.
1047
+ #
1048
+ # This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = 400</tt>) can be
1049
+ # removed by giving the option <tt>max_tree_depth: -1</tt>.
1050
+ #
1051
+ # html = '<!DOCTYPE html>' + '<div>' * 1000
1052
+ # doc = Nokogiri.HTML5(html)
1053
+ # # raises ArgumentError: Document tree depth limit exceeded
1054
+ # doc = Nokogiri.HTML5(html, max_tree_depth: -1)
1055
+ #
1056
+ # === Attribute limit per element
1057
+ #
1058
+ # The maximum number of attributes per DOM element is configurable by the +:max_attributes+
1059
+ # option. If a given element would exceed this limit, then an {::ArgumentError} is thrown.
1060
+ #
1061
+ # This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = 400</tt>) can be
1062
+ # removed by giving the option <tt>max_attributes: -1</tt>.
1063
+ #
1064
+ # html = '<!DOCTYPE html><div ' + (1..1000).map { |x| "attr-#{x}" }.join(' ') + '>'
1065
+ # # "<!DOCTYPE html><div attr-1 attr-2 attr-3 ... attr-1000>"
1066
+ # doc = Nokogiri.HTML5(html)
1067
+ # # raises ArgumentError: Attributes per element limit exceeded
1068
+ # doc = Nokogiri.HTML5(html, max_attributes: -1)
1069
+ #
1070
+ # == HTML Serialization
1071
+ #
1072
+ # After parsing HTML, it may be serialized using any of the {Nokogiri::XML::Node} serialization
1073
+ # methods. In particular, {XML::Node#serialize}, {XML::Node#to_html}, and {XML::Node#to_s} will
1074
+ # serialize a given node and its children. (This is the equivalent of JavaScript's
1075
+ # +Element.outerHTML+.) Similarly, {XML::Node#inner_html} will serialize the children of a given
1076
+ # node. (This is the equivalent of JavaScript's +Element.innerHTML+.)
1077
+ #
1078
+ # doc = Nokogiri::HTML5("<!DOCTYPE html><span>Hello world!</span>")
1079
+ # puts doc.serialize
1080
+ # # => <!DOCTYPE html><html><head></head><body><span>Hello world!</span></body></html>
1081
+ #
1082
+ # Due to quirks in how HTML is parsed and serialized, it's possible for a DOM tree to be
1083
+ # serialized and then re-parsed, resulting in a different DOM. Mostly, this happens with DOMs
1084
+ # produced from invalid HTML. Unfortunately, even valid HTML may not survive serialization and
1085
+ # re-parsing.
1086
+ #
1087
+ # In particular, a newline at the start of +pre+, +listing+, and +textarea+ elements is ignored by
1088
+ # the parser.
1089
+ #
1090
+ # doc = Nokogiri::HTML5(<<-EOF)
1091
+ # <!DOCTYPE html>
1092
+ # <pre>
1093
+ # Content</pre>
1094
+ # EOF
1095
+ # puts doc.at('/html/body/pre').serialize
1096
+ # # => <pre>Content</pre>
1097
+ #
1098
+ # In this case, the original HTML is semantically equivalent to the serialized version. If the
1099
+ # +pre+, +listing+, or +textarea+ content starts with two newlines, the first newline will be
1100
+ # stripped on the first parse and the second newline will be stripped on the second, leading to
1101
+ # semantically different DOMs. Passing the parameter <tt>preserve_newline: true</tt> will cause
1102
+ # two or more newlines to be preserved. (A single leading newline will still be removed.)
1103
+ #
1104
+ # doc = Nokogiri::HTML5(<<-EOF)
1105
+ # <!DOCTYPE html>
1106
+ # <listing>
1107
+ #
1108
+ # Content</listing>
1109
+ # EOF
1110
+ # puts doc.at('/html/body/listing').serialize(preserve_newline: true)
1111
+ # # => <listing>
1112
+ # #
1113
+ # # Content</listing>
1114
+ #
1115
+ # == Encodings
1116
+ #
1117
+ # Nokogiri always parses HTML5 using {https://en.wikipedia.org/wiki/UTF-8 UTF-8}; however, the
1118
+ # encoding of the input can be explicitly selected via the optional +encoding+ parameter. This is
1119
+ # most useful when the input comes not from a string but from an IO object.
1120
+ #
1121
+ # When serializing a document or node, the encoding of the output string can be specified via the
1122
+ # +:encoding+ options. Characters that cannot be encoded in the selected encoding will be encoded
1123
+ # as {https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references HTML numeric
1124
+ # entities}.
1125
+ #
1126
+ # frag = Nokogiri::HTML5.fragment('<span>아는 길도 물어가라</span>')
1127
+ # puts html
1128
+ # # => <span>&#xc544;&#xb294; &#xae38;&#xb3c4; &#xbb3c;&#xc5b4;&#xac00;&#xb77c;</span>
1129
+ # frag = Nokogiri::HTML5.fragment(html)
1130
+ # puts frag.serialize
1131
+ # # => <span>아는 길도 물어가라</span>
1132
+ #
1133
+ # (There's a {https://bugs.ruby-lang.org/issues/15033 bug} in all current versions of Ruby that
1134
+ # can cause the entity encoding to fail. Of the mandated supported encodings for HTML, the only
1135
+ # encoding I'm aware of that has this bug is <tt>'ISO-2022-JP'</tt>. We recommend avoiding this
1136
+ # encoding.)
1137
+ #
1138
+ # == Notes
1139
+ #
1140
+ # * The {Nokogiri::HTML5.fragment} function takes a string and parses it
1141
+ # as a HTML5 document. The +<html>+, +<head>+, and +<body>+ elements are
1142
+ # removed from this document, and any children of these elements that remain
1143
+ # are returned as a {Nokogiri::HTML5::DocumentFragment}.
1144
+ #
1145
+ # * The {Nokogiri::HTML5.parse} function takes a string and passes it to the
1146
+ # <code>gumbo_parse_with_options</code> method, using the default options.
1147
+ # The resulting Gumbo parse tree is then walked.
1148
+ #
1149
+ # * Instead of uppercase element names, lowercase element names are produced.
1150
+ #
1151
+ # * Instead of returning +unknown+ as the element name for unknown tags, the
1152
+ # original tag name is returned verbatim.
1153
+ #
1154
+ # Since v1.12.0
1155
+ module Nokogiri::HTML5
1156
+ class << self
1157
+ def escape_text(text, encoding, attribute_mode); end
1158
+
1159
+ # Parse a fragment from +string+. Convenience method for
1160
+ # {Nokogiri::HTML5::DocumentFragment.parse}.
1161
+ def fragment(string, encoding = T.unsafe(nil), **options); end
1162
+
1163
+ # Fetch and parse a HTML document from the web, following redirects,
1164
+ # handling https, and determining the character encoding using HTML5
1165
+ # rules. +uri+ may be a +String+ or a +URI+. +options+ contains
1166
+ # http headers and special options. Everything which is not a
1167
+ # special option is considered a header. Special options include:
1168
+ # * :follow_limit => number of redirects which are followed
1169
+ # * :basic_auth => [username, password]
1170
+ def get(uri, options = T.unsafe(nil)); end
1171
+
1172
+ def get_impl(uri, options = T.unsafe(nil)); end
1173
+
1174
+ # Parse an HTML 5 document. Convenience method for {Nokogiri::HTML5::Document.parse}
1175
+ def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
1176
+
1177
+ # @return [Boolean]
1178
+ def prepend_newline?(node); end
1179
+
1180
+ def read_and_encode(string, encoding); end
1181
+
1182
+ # Charset sniffing is a complex and controversial topic that understandably isn't done _by
1183
+ # default_ by the Ruby Net::HTTP library. This being said, it is a very real problem for
1184
+ # consumers of HTML as the default for HTML is iso-8859-1, most "good" producers use utf-8, and
1185
+ # the Gumbo parser *only* supports utf-8.
1186
+ #
1187
+ # Accordingly, Nokogiri::HTML4::Document.parse provides limited encoding detection. Following
1188
+ # this lead, Nokogiri::HTML5 attempts to do likewise, while attempting to more closely follow
1189
+ # the HTML5 standard.
1190
+ #
1191
+ # http://bugs.ruby-lang.org/issues/2567
1192
+ # http://www.w3.org/TR/html5/syntax.html#determining-the-character-encoding
1193
+ def reencode(body, content_type = T.unsafe(nil)); end
1194
+
1195
+ def serialize_node_internal(current_node, io, encoding, options); end
1196
+ end
1197
+ end
1198
+
1199
+ # Since v1.12.0
1200
+ #
1201
+ # 💡 HTML5 functionality is not available when running JRuby.
1202
+ class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1203
+ def fragment(tags = T.unsafe(nil)); end
1204
+ def to_xml(options = T.unsafe(nil), &block); end
1205
+
1206
+ # :call-seq:
1207
+ # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig
1208
+ #
1209
+ # [Returns] The document type which determines CSS-to-XPath translation.
1210
+ #
1211
+ # See XPathVisitor for more information.
1212
+ def xpath_doctype; end
1213
+
1214
+ class << self
1215
+ def do_parse(string_or_io, url, encoding, options); end
1216
+
1217
+ # @yield [options]
1218
+ def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
1219
+
1220
+ # @raise [ArgumentError]
1221
+ def read_io(io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end
1222
+
1223
+ # @raise [ArgumentError]
1224
+ def read_memory(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end
1225
+ end
1226
+ end
1227
+
1228
+ # Since v1.12.0
1229
+ #
1230
+ # 💡 HTML5 functionality is not available when running JRuby.
1231
+ class Nokogiri::HTML5::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
1232
+ # Create a document fragment.
1233
+ #
1234
+ # @return [DocumentFragment] a new instance of DocumentFragment
1235
+ def initialize(doc, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
1236
+
1237
+ # Returns the value of attribute document.
1238
+ def document; end
1239
+
1240
+ # Sets the attribute document
1241
+ #
1242
+ # @param value the value to set the attribute document to.
1243
+ def document=(_arg0); end
1244
+
1245
+ # Returns the value of attribute errors.
1246
+ def errors; end
1247
+
1248
+ # Sets the attribute errors
1249
+ #
1250
+ # @param value the value to set the attribute errors to.
1251
+ def errors=(_arg0); end
1252
+
1253
+ def extract_params(params); end
1254
+ def serialize(options = T.unsafe(nil), &block); end
1255
+
1256
+ class << self
1257
+ # Parse a document fragment from +tags+, returning a Nodeset.
1258
+ def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil)); end
1259
+ end
1260
+ end
1261
+
1262
+ # HTML uses the XHTML namespace.
1263
+ Nokogiri::HTML5::HTML_NAMESPACE = T.let(T.unsafe(nil), String)
1264
+
1265
+ Nokogiri::HTML5::MATHML_NAMESPACE = T.let(T.unsafe(nil), String)
1266
+
1267
+ # Since v1.12.0
1268
+ #
1269
+ # 💡 HTML5 functionality is not available when running JRuby.
1270
+ module Nokogiri::HTML5::Node
1271
+ def fragment(tags); end
1272
+ def inner_html(options = T.unsafe(nil)); end
1273
+
1274
+ # @yield [config]
1275
+ def write_to(io, *options); end
1276
+
1277
+ private
1278
+
1279
+ # HTML elements can have attributes that contain colons.
1280
+ # Nokogiri::XML::Node#[]= treats names with colons as a prefixed QName
1281
+ # and tries to create an attribute in a namespace. This is especially
1282
+ # annoying with attribute names like xml:lang since libxml2 will
1283
+ # actually create the xml namespace if it doesn't exist already.
1284
+ def add_child_node_and_reparent_attrs(node); end
1285
+ end
1286
+
1287
+ Nokogiri::HTML5::SVG_NAMESPACE = T.let(T.unsafe(nil), String)
1288
+ Nokogiri::HTML5::XLINK_NAMESPACE = T.let(T.unsafe(nil), String)
1289
+ Nokogiri::HTML5::XMLNS_NAMESPACE = T.let(T.unsafe(nil), String)
1290
+ Nokogiri::HTML5::XML_NAMESPACE = T.let(T.unsafe(nil), String)
1291
+ Nokogiri::LIBXML2_PATCHES = T.let(T.unsafe(nil), Array)
1292
+ Nokogiri::LIBXML_COMPILED_VERSION = T.let(T.unsafe(nil), String)
1293
+ Nokogiri::LIBXML_ICONV_ENABLED = T.let(T.unsafe(nil), TrueClass)
1294
+ Nokogiri::LIBXML_LOADED_VERSION = T.let(T.unsafe(nil), String)
1295
+ Nokogiri::LIBXML_MEMORY_MANAGEMENT = T.let(T.unsafe(nil), String)
1296
+ Nokogiri::LIBXSLT_COMPILED_VERSION = T.let(T.unsafe(nil), String)
1297
+ Nokogiri::LIBXSLT_DATETIME_ENABLED = T.let(T.unsafe(nil), TrueClass)
1298
+ Nokogiri::LIBXSLT_LOADED_VERSION = T.let(T.unsafe(nil), String)
1299
+ Nokogiri::LIBXSLT_PATCHES = T.let(T.unsafe(nil), Array)
1300
+ Nokogiri::OTHER_LIBRARY_VERSIONS = T.let(T.unsafe(nil), String)
1301
+ Nokogiri::PACKAGED_LIBRARIES = T.let(T.unsafe(nil), TrueClass)
1302
+ Nokogiri::PRECOMPILED_LIBRARIES = T.let(T.unsafe(nil), TrueClass)
1303
+ class Nokogiri::SyntaxError < ::StandardError; end
1304
+
1305
+ module Nokogiri::Test
1306
+ class << self
1307
+ def __foreign_error_handler; end
1308
+ end
1309
+ end
1310
+
1311
+ # The version of Nokogiri you are using
1312
+ Nokogiri::VERSION = T.let(T.unsafe(nil), String)
1313
+
1314
+ # Detailed version info about Nokogiri and the installed extension dependencies.
1315
+ Nokogiri::VERSION_INFO = T.let(T.unsafe(nil), Hash)
1316
+
1317
+ class Nokogiri::VersionInfo
1318
+ include ::Singleton
1319
+ extend ::Singleton::SingletonClassMethods
1320
+
1321
+ def compiled_libxml_version; end
1322
+ def compiled_libxslt_version; end
1323
+ def engine; end
1324
+
1325
+ # @return [Boolean]
1326
+ def jruby?; end
1327
+
1328
+ # @return [Boolean]
1329
+ def libxml2?; end
1330
+
1331
+ # @return [Boolean]
1332
+ def libxml2_has_iconv?; end
1333
+
1334
+ # @return [Boolean]
1335
+ def libxml2_precompiled?; end
1336
+
1337
+ # @return [Boolean]
1338
+ def libxml2_using_packaged?; end
1339
+
1340
+ # @return [Boolean]
1341
+ def libxml2_using_system?; end
1342
+
1343
+ # @return [Boolean]
1344
+ def libxslt_has_datetime?; end
1345
+
1346
+ def loaded_libxml_version; end
1347
+ def loaded_libxslt_version; end
1348
+ def ruby_minor; end
1349
+ def to_hash; end
1350
+ def to_markdown; end
1351
+ def warnings; end
1352
+
1353
+ # @return [Boolean]
1354
+ def windows?; end
1355
+ end
1356
+
1357
+ module Nokogiri::XML
1358
+ class << self
1359
+ # Parse an XML document using the Nokogiri::XML::Reader API. See
1360
+ # Nokogiri::XML::Reader for mor information
1361
+ #
1362
+ # @yield [options]
1363
+ def Reader(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
1364
+
1365
+ # Create a new Nokogiri::XML::RelaxNG document from +string_or_io+.
1366
+ # See Nokogiri::XML::RelaxNG for an example.
1367
+ def RelaxNG(string_or_io, options = T.unsafe(nil)); end
1368
+
1369
+ # Create a new Nokogiri::XML::Schema object using a +string_or_io+
1370
+ # object.
1371
+ def Schema(string_or_io, options = T.unsafe(nil)); end
1372
+
1373
+ # Parse a fragment from +string+ in to a NodeSet.
1374
+ def fragment(string, options = T.unsafe(nil), &block); end
1375
+
1376
+ # Parse XML. Convenience method for Nokogiri::XML::Document.parse
1377
+ def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
1378
+ end
1379
+ end
1380
+
1381
+ class Nokogiri::XML::Attr < ::Nokogiri::XML::Node
1382
+ def content=(_arg0); end
1383
+ def to_s; end
1384
+ def value; end
1385
+ def value=(_arg0); end
1386
+
1387
+ private
1388
+
1389
+ def inspect_attributes; end
1390
+
1391
+ class << self
1392
+ def new(*_arg0); end
1393
+ end
1394
+ end
1395
+
1396
+ # Represents an attribute declaration in a DTD
1397
+ class Nokogiri::XML::AttributeDecl < ::Nokogiri::XML::Node
1398
+ def attribute_type; end
1399
+ def default; end
1400
+ def enumeration; end
1401
+ def inspect; end
1402
+ end
1403
+
1404
+ # Nokogiri builder can be used for building XML and HTML documents.
1405
+ #
1406
+ # == Synopsis:
1407
+ #
1408
+ # builder = Nokogiri::XML::Builder.new do |xml|
1409
+ # xml.root {
1410
+ # xml.products {
1411
+ # xml.widget {
1412
+ # xml.id_ "10"
1413
+ # xml.name "Awesome widget"
1414
+ # }
1415
+ # }
1416
+ # }
1417
+ # end
1418
+ # puts builder.to_xml
1419
+ #
1420
+ # Will output:
1421
+ #
1422
+ # <?xml version="1.0"?>
1423
+ # <root>
1424
+ # <products>
1425
+ # <widget>
1426
+ # <id>10</id>
1427
+ # <name>Awesome widget</name>
1428
+ # </widget>
1429
+ # </products>
1430
+ # </root>
1431
+ #
1432
+ #
1433
+ # === Builder scope
1434
+ #
1435
+ # The builder allows two forms. When the builder is supplied with a block
1436
+ # that has a parameter, the outside scope is maintained. This means you
1437
+ # can access variables that are outside your builder. If you don't need
1438
+ # outside scope, you can use the builder without the "xml" prefix like
1439
+ # this:
1440
+ #
1441
+ # builder = Nokogiri::XML::Builder.new do
1442
+ # root {
1443
+ # products {
1444
+ # widget {
1445
+ # id_ "10"
1446
+ # name "Awesome widget"
1447
+ # }
1448
+ # }
1449
+ # }
1450
+ # end
1451
+ #
1452
+ # == Special Tags
1453
+ #
1454
+ # The builder works by taking advantage of method_missing. Unfortunately
1455
+ # some methods are defined in ruby that are difficult or dangerous to
1456
+ # remove. You may want to create tags with the name "type", "class", and
1457
+ # "id" for example. In that case, you can use an underscore to
1458
+ # disambiguate your tag name from the method call.
1459
+ #
1460
+ # Here is an example of using the underscore to disambiguate tag names from
1461
+ # ruby methods:
1462
+ #
1463
+ # @objects = [Object.new, Object.new, Object.new]
1464
+ #
1465
+ # builder = Nokogiri::XML::Builder.new do |xml|
1466
+ # xml.root {
1467
+ # xml.objects {
1468
+ # @objects.each do |o|
1469
+ # xml.object {
1470
+ # xml.type_ o.type
1471
+ # xml.class_ o.class.name
1472
+ # xml.id_ o.id
1473
+ # }
1474
+ # end
1475
+ # }
1476
+ # }
1477
+ # end
1478
+ # puts builder.to_xml
1479
+ #
1480
+ # The underscore may be used with any tag name, and the last underscore
1481
+ # will just be removed. This code will output the following XML:
1482
+ #
1483
+ # <?xml version="1.0"?>
1484
+ # <root>
1485
+ # <objects>
1486
+ # <object>
1487
+ # <type>Object</type>
1488
+ # <class>Object</class>
1489
+ # <id>48390</id>
1490
+ # </object>
1491
+ # <object>
1492
+ # <type>Object</type>
1493
+ # <class>Object</class>
1494
+ # <id>48380</id>
1495
+ # </object>
1496
+ # <object>
1497
+ # <type>Object</type>
1498
+ # <class>Object</class>
1499
+ # <id>48370</id>
1500
+ # </object>
1501
+ # </objects>
1502
+ # </root>
1503
+ #
1504
+ # == Tag Attributes
1505
+ #
1506
+ # Tag attributes may be supplied as method arguments. Here is our
1507
+ # previous example, but using attributes rather than tags:
1508
+ #
1509
+ # @objects = [Object.new, Object.new, Object.new]
1510
+ #
1511
+ # builder = Nokogiri::XML::Builder.new do |xml|
1512
+ # xml.root {
1513
+ # xml.objects {
1514
+ # @objects.each do |o|
1515
+ # xml.object(:type => o.type, :class => o.class, :id => o.id)
1516
+ # end
1517
+ # }
1518
+ # }
1519
+ # end
1520
+ # puts builder.to_xml
1521
+ #
1522
+ # === Tag Attribute Short Cuts
1523
+ #
1524
+ # A couple attribute short cuts are available when building tags. The
1525
+ # short cuts are available by special method calls when building a tag.
1526
+ #
1527
+ # This example builds an "object" tag with the class attribute "classy"
1528
+ # and the id of "thing":
1529
+ #
1530
+ # builder = Nokogiri::XML::Builder.new do |xml|
1531
+ # xml.root {
1532
+ # xml.objects {
1533
+ # xml.object.classy.thing!
1534
+ # }
1535
+ # }
1536
+ # end
1537
+ # puts builder.to_xml
1538
+ #
1539
+ # Which will output:
1540
+ #
1541
+ # <?xml version="1.0"?>
1542
+ # <root>
1543
+ # <objects>
1544
+ # <object class="classy" id="thing"/>
1545
+ # </objects>
1546
+ # </root>
1547
+ #
1548
+ # All other options are still supported with this syntax, including
1549
+ # blocks and extra tag attributes.
1550
+ #
1551
+ # == Namespaces
1552
+ #
1553
+ # Namespaces are added similarly to attributes. Nokogiri::XML::Builder
1554
+ # assumes that when an attribute starts with "xmlns", it is meant to be
1555
+ # a namespace:
1556
+ #
1557
+ # builder = Nokogiri::XML::Builder.new { |xml|
1558
+ # xml.root('xmlns' => 'default', 'xmlns:foo' => 'bar') do
1559
+ # xml.tenderlove
1560
+ # end
1561
+ # }
1562
+ # puts builder.to_xml
1563
+ #
1564
+ # Will output XML like this:
1565
+ #
1566
+ # <?xml version="1.0"?>
1567
+ # <root xmlns:foo="bar" xmlns="default">
1568
+ # <tenderlove/>
1569
+ # </root>
1570
+ #
1571
+ # === Referencing declared namespaces
1572
+ #
1573
+ # Tags that reference non-default namespaces (i.e. a tag "foo:bar") can be
1574
+ # built by using the Nokogiri::XML::Builder#[] method.
1575
+ #
1576
+ # For example:
1577
+ #
1578
+ # builder = Nokogiri::XML::Builder.new do |xml|
1579
+ # xml.root('xmlns:foo' => 'bar') {
1580
+ # xml.objects {
1581
+ # xml['foo'].object.classy.thing!
1582
+ # }
1583
+ # }
1584
+ # end
1585
+ # puts builder.to_xml
1586
+ #
1587
+ # Will output this XML:
1588
+ #
1589
+ # <?xml version="1.0"?>
1590
+ # <root xmlns:foo="bar">
1591
+ # <objects>
1592
+ # <foo:object class="classy" id="thing"/>
1593
+ # </objects>
1594
+ # </root>
1595
+ #
1596
+ # Note the "foo:object" tag.
1597
+ #
1598
+ # === Namespace inheritance
1599
+ #
1600
+ # In the Builder context, children will inherit their parent's namespace. This is the same
1601
+ # behavior as if the underlying {XML::Document} set +namespace_inheritance+ to +true+:
1602
+ #
1603
+ # result = Nokogiri::XML::Builder.new do |xml|
1604
+ # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do
1605
+ # xml.Header
1606
+ # end
1607
+ # end
1608
+ # result.doc.to_xml
1609
+ # # => <?xml version="1.0" encoding="utf-8"?>
1610
+ # # <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
1611
+ # # <soapenv:Header/>
1612
+ # # </soapenv:Envelope>
1613
+ #
1614
+ # Users may turn this behavior off by passing a keyword argument +namespace_inheritance:false+
1615
+ # to the initializer:
1616
+ #
1617
+ # result = Nokogiri::XML::Builder.new(namespace_inheritance: false) do |xml|
1618
+ # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do
1619
+ # xml.Header
1620
+ # xml["soapenv"].Body # users may explicitly opt into the namespace
1621
+ # end
1622
+ # end
1623
+ # result.doc.to_xml
1624
+ # # => <?xml version="1.0" encoding="utf-8"?>
1625
+ # # <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
1626
+ # # <Header/>
1627
+ # # <soapenv:Body/>
1628
+ # # </soapenv:Envelope>
1629
+ #
1630
+ # For more information on namespace inheritance, please see {XML::Document#namespace_inheritance}
1631
+ #
1632
+ #
1633
+ # == Document Types
1634
+ #
1635
+ # To create a document type (DTD), access use the Builder#doc method to get
1636
+ # the current context document. Then call Node#create_internal_subset to
1637
+ # create the DTD node.
1638
+ #
1639
+ # For example, this Ruby:
1640
+ #
1641
+ # builder = Nokogiri::XML::Builder.new do |xml|
1642
+ # xml.doc.create_internal_subset(
1643
+ # 'html',
1644
+ # "-//W3C//DTD HTML 4.01 Transitional//EN",
1645
+ # "http://www.w3.org/TR/html4/loose.dtd"
1646
+ # )
1647
+ # xml.root do
1648
+ # xml.foo
1649
+ # end
1650
+ # end
1651
+ #
1652
+ # puts builder.to_xml
1653
+ #
1654
+ # Will output this xml:
1655
+ #
1656
+ # <?xml version="1.0"?>
1657
+ # <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1658
+ # <root>
1659
+ # <foo/>
1660
+ # </root>
1661
+ class Nokogiri::XML::Builder
1662
+ include ::Nokogiri::ClassResolver
1663
+
1664
+ # Create a new Builder object. +options+ are sent to the top level
1665
+ # Document that is being built.
1666
+ #
1667
+ # Building a document with a particular encoding for example:
1668
+ #
1669
+ # Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
1670
+ # ...
1671
+ # end
1672
+ #
1673
+ # @return [Builder] a new instance of Builder
1674
+ def initialize(options = T.unsafe(nil), root = T.unsafe(nil), &block); end
1675
+
1676
+ # Append the given raw XML +string+ to the document
1677
+ def <<(string); end
1678
+
1679
+ # Build a tag that is associated with namespace +ns+. Raises an
1680
+ # ArgumentError if +ns+ has not been defined higher in the tree.
1681
+ def [](ns); end
1682
+
1683
+ def arity; end
1684
+ def arity=(_arg0); end
1685
+
1686
+ # Create a CDATA Node with content of +string+
1687
+ def cdata(string); end
1688
+
1689
+ # Create a Comment Node with content of +string+
1690
+ def comment(string); end
1691
+
1692
+ # A context object for use when the block has no arguments
1693
+ def context; end
1694
+
1695
+ # A context object for use when the block has no arguments
1696
+ def context=(_arg0); end
1697
+
1698
+ # The current Document object being built
1699
+ def doc; end
1700
+
1701
+ # The current Document object being built
1702
+ def doc=(_arg0); end
1703
+
1704
+ def method_missing(method, *args, &block); end
1705
+
1706
+ # The parent of the current node being built
1707
+ def parent; end
1708
+
1709
+ # The parent of the current node being built
1710
+ def parent=(_arg0); end
1711
+
1712
+ # Create a Text Node with content of +string+
1713
+ def text(string); end
1714
+
1715
+ # Convert this Builder object to XML
1716
+ def to_xml(*args); end
1717
+
1718
+ private
1719
+
1720
+ # Insert +node+ as a child of the current Node
1721
+ def insert(node, &block); end
1722
+
1723
+ class << self
1724
+ # Create a builder with an existing root object. This is for use when
1725
+ # you have an existing document that you would like to augment with
1726
+ # builder methods. The builder context created will start with the
1727
+ # given +root+ node.
1728
+ #
1729
+ # For example:
1730
+ #
1731
+ # doc = Nokogiri::XML(File.read('somedoc.xml'))
1732
+ # Nokogiri::XML::Builder.with(doc.at_css('some_tag')) do |xml|
1733
+ # # ... Use normal builder methods here ...
1734
+ # xml.awesome # add the "awesome" tag below "some_tag"
1735
+ # end
1736
+ def with(root, &block); end
1737
+ end
1738
+ end
1739
+
1740
+ Nokogiri::XML::Builder::DEFAULT_DOCUMENT_OPTIONS = T.let(T.unsafe(nil), Hash)
1741
+
1742
+ class Nokogiri::XML::Builder::NodeBuilder
1743
+ # @return [NodeBuilder] a new instance of NodeBuilder
1744
+ def initialize(node, doc_builder); end
1745
+
1746
+ def [](k); end
1747
+ def []=(k, v); end
1748
+ def method_missing(method, *args, &block); end
1749
+ end
1750
+
1751
+ class Nokogiri::XML::CDATA < ::Nokogiri::XML::Text
1752
+ # Get the name of this CDATA node
1753
+ def name; end
1754
+
1755
+ class << self
1756
+ def new(*_arg0); end
1757
+ end
1758
+ end
1759
+
1760
+ class Nokogiri::XML::CharacterData < ::Nokogiri::XML::Node
1761
+ include ::Nokogiri::XML::PP::CharacterData
1762
+ end
1763
+
1764
+ class Nokogiri::XML::Comment < ::Nokogiri::XML::CharacterData
1765
+ class << self
1766
+ def new(*_arg0); end
1767
+ end
1768
+ end
1769
+
1770
+ class Nokogiri::XML::DTD < ::Nokogiri::XML::Node
1771
+ def attributes; end
1772
+ def each; end
1773
+ def elements; end
1774
+ def entities; end
1775
+ def external_id; end
1776
+
1777
+ # @return [Boolean]
1778
+ def html5_dtd?; end
1779
+
1780
+ # @return [Boolean]
1781
+ def html_dtd?; end
1782
+
1783
+ def keys; end
1784
+ def notations; end
1785
+ def system_id; end
1786
+ def validate(_arg0); end
1787
+ end
1788
+
1789
+ # Nokogiri::XML::Document is the main entry point for dealing with XML documents. The Document
1790
+ # is created by parsing an XML document. See Nokogiri::XML::Document.parse for more information
1791
+ # on parsing.
1792
+ #
1793
+ # For searching a Document, see Nokogiri::XML::Searchable#css and
1794
+ # Nokogiri::XML::Searchable#xpath
1795
+ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
1796
+ # @return [Document] a new instance of Document
1797
+ def initialize(*args); end
1798
+
1799
+ def <<(node_or_tags); end
1800
+ def add_child(node_or_tags); end
1801
+ def canonicalize(*_arg0); end
1802
+ def clone(*_arg0); end
1803
+
1804
+ # :call-seq:
1805
+ # collect_namespaces() → Hash<String(Namespace#prefix) ⇒ String(Namespace#href)>
1806
+ #
1807
+ # Recursively get all namespaces from this node and its subtree and return them as a
1808
+ # hash.
1809
+ #
1810
+ # ⚠ This method will not handle duplicate namespace prefixes, since the return value is a hash.
1811
+ #
1812
+ # Note that this method does an xpath lookup for nodes with namespaces, and as a result the
1813
+ # order (and which duplicate prefix "wins") may be dependent on the implementation of the
1814
+ # underlying XML library.
1815
+ #
1816
+ # *Example:* Basic usage
1817
+ #
1818
+ # Given this document:
1819
+ #
1820
+ # <root xmlns="default" xmlns:foo="bar">
1821
+ # <bar xmlns:hello="world" />
1822
+ # </root>
1823
+ #
1824
+ # This method will return:
1825
+ #
1826
+ # {"xmlns:foo"=>"bar", "xmlns"=>"default", "xmlns:hello"=>"world"}
1827
+ #
1828
+ # *Example:* Duplicate prefixes
1829
+ #
1830
+ # Given this document:
1831
+ #
1832
+ # <root xmlns:foo="bar">
1833
+ # <bar xmlns:foo="baz" />
1834
+ # </root>
1835
+ #
1836
+ # The hash returned will be something like:
1837
+ #
1838
+ # {"xmlns:foo" => "baz"}
1839
+ def collect_namespaces; end
1840
+
1841
+ # Create a CDATA Node containing +string+
1842
+ def create_cdata(string, &block); end
1843
+
1844
+ # Create a Comment Node containing +string+
1845
+ def create_comment(string, &block); end
1846
+
1847
+ # :call-seq:
1848
+ # create_element(name, *contents_or_attrs, &block) → Nokogiri::XML::Element
1849
+ #
1850
+ # Create a new Element with `name` belonging to this document, optionally setting contents or
1851
+ # attributes.
1852
+ #
1853
+ # This method is _not_ the most user-friendly option if your intention is to add a node to the
1854
+ # document tree. Prefer one of the Nokogiri::XML::Node methods like Node#add_child,
1855
+ # Node#add_next_sibling, Node#replace, etc. which will both create an element (or subtree) and
1856
+ # place it in the document tree.
1857
+ #
1858
+ # Arguments may be passed to initialize the element:
1859
+ #
1860
+ # - a Hash argument will be used to set attributes
1861
+ # - a non-Hash object that responds to \#to_s will be used to set the new node's contents
1862
+ #
1863
+ # A block may be passed to mutate the node.
1864
+ #
1865
+ # [Parameters]
1866
+ # - `name` (String)
1867
+ # - `contents_or_attrs` (\#to_s, Hash)
1868
+ # [Yields] `node` (Nokogiri::XML::Element)
1869
+ # [Returns] Nokogiri::XML::Element
1870
+ #
1871
+ # *Example:* An empty element without attributes
1872
+ #
1873
+ # doc.create_element("div")
1874
+ # # => <div></div>
1875
+ #
1876
+ # *Example:* An element with contents
1877
+ #
1878
+ # doc.create_element("div", "contents")
1879
+ # # => <div>contents</div>
1880
+ #
1881
+ # *Example:* An element with attributes
1882
+ #
1883
+ # doc.create_element("div", {"class" => "container"})
1884
+ # # => <div class='container'></div>
1885
+ #
1886
+ # *Example:* An element with contents and attributes
1887
+ #
1888
+ # doc.create_element("div", "contents", {"class" => "container"})
1889
+ # # => <div class='container'>contents</div>
1890
+ #
1891
+ # *Example:* Passing a block to mutate the element
1892
+ #
1893
+ # doc.create_element("div") { |node| node["class"] = "blue" if before_noon? }
1894
+ def create_element(name, *contents_or_attrs, &block); end
1895
+
1896
+ def create_entity(*_arg0); end
1897
+
1898
+ # Create a Text Node with +string+
1899
+ def create_text_node(string, &block); end
1900
+
1901
+ # Apply any decorators to +node+
1902
+ def decorate(node); end
1903
+
1904
+ # Get the list of decorators given +key+
1905
+ def decorators(key); end
1906
+
1907
+ # A reference to +self+
1908
+ def document; end
1909
+
1910
+ def dup(*_arg0); end
1911
+ def encoding; end
1912
+ def encoding=(_arg0); end
1913
+
1914
+ # The errors found while parsing a document.
1915
+ #
1916
+ # [Returns] Array<Nokogiri::XML::SyntaxError>
1917
+ def errors; end
1918
+
1919
+ # The errors found while parsing a document.
1920
+ #
1921
+ # [Returns] Array<Nokogiri::XML::SyntaxError>
1922
+ def errors=(_arg0); end
1923
+
1924
+ # Create a Nokogiri::XML::DocumentFragment from +tags+
1925
+ # Returns an empty fragment if +tags+ is nil.
1926
+ def fragment(tags = T.unsafe(nil)); end
1927
+
1928
+ # The name of this document. Always returns "document"
1929
+ def name; end
1930
+
1931
+ # When `true`, reparented elements without a namespace will inherit their new parent's
1932
+ # namespace (if one exists). Defaults to `false`.
1933
+ #
1934
+ # [Returns] Boolean
1935
+ #
1936
+ # *Example:* Default behavior of namespace inheritance
1937
+ #
1938
+ # xml = <<~EOF
1939
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1940
+ # <foo:parent>
1941
+ # </foo:parent>
1942
+ # </root>
1943
+ # EOF
1944
+ # doc = Nokogiri::XML(xml)
1945
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
1946
+ # parent.add_child("<child></child>")
1947
+ # doc.to_xml
1948
+ # # => <?xml version="1.0"?>
1949
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1950
+ # # <foo:parent>
1951
+ # # <child/>
1952
+ # # </foo:parent>
1953
+ # # </root>
1954
+ #
1955
+ # *Example:* Setting namespace inheritance to `true`
1956
+ #
1957
+ # xml = <<~EOF
1958
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1959
+ # <foo:parent>
1960
+ # </foo:parent>
1961
+ # </root>
1962
+ # EOF
1963
+ # doc = Nokogiri::XML(xml)
1964
+ # doc.namespace_inheritance = true
1965
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
1966
+ # parent.add_child("<child></child>")
1967
+ # doc.to_xml
1968
+ # # => <?xml version="1.0"?>
1969
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1970
+ # # <foo:parent>
1971
+ # # <foo:child/>
1972
+ # # </foo:parent>
1973
+ # # </root>
1974
+ #
1975
+ # Since v1.12.4
1976
+ def namespace_inheritance; end
1977
+
1978
+ # When `true`, reparented elements without a namespace will inherit their new parent's
1979
+ # namespace (if one exists). Defaults to `false`.
1980
+ #
1981
+ # [Returns] Boolean
1982
+ #
1983
+ # *Example:* Default behavior of namespace inheritance
1984
+ #
1985
+ # xml = <<~EOF
1986
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1987
+ # <foo:parent>
1988
+ # </foo:parent>
1989
+ # </root>
1990
+ # EOF
1991
+ # doc = Nokogiri::XML(xml)
1992
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
1993
+ # parent.add_child("<child></child>")
1994
+ # doc.to_xml
1995
+ # # => <?xml version="1.0"?>
1996
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
1997
+ # # <foo:parent>
1998
+ # # <child/>
1999
+ # # </foo:parent>
2000
+ # # </root>
2001
+ #
2002
+ # *Example:* Setting namespace inheritance to `true`
2003
+ #
2004
+ # xml = <<~EOF
2005
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
2006
+ # <foo:parent>
2007
+ # </foo:parent>
2008
+ # </root>
2009
+ # EOF
2010
+ # doc = Nokogiri::XML(xml)
2011
+ # doc.namespace_inheritance = true
2012
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
2013
+ # parent.add_child("<child></child>")
2014
+ # doc.to_xml
2015
+ # # => <?xml version="1.0"?>
2016
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
2017
+ # # <foo:parent>
2018
+ # # <foo:child/>
2019
+ # # </foo:parent>
2020
+ # # </root>
2021
+ #
2022
+ # Since v1.12.4
2023
+ def namespace_inheritance=(_arg0); end
2024
+
2025
+ # Get the hash of namespaces on the root Nokogiri::XML::Node
2026
+ def namespaces; end
2027
+
2028
+ def remove_namespaces!; end
2029
+ def root; end
2030
+ def root=(_arg0); end
2031
+
2032
+ # Explore a document with shortcut methods. See Nokogiri::Slop for details.
2033
+ #
2034
+ # Note that any nodes that have been instantiated before #slop!
2035
+ # is called will not be decorated with sloppy behavior. So, if you're in
2036
+ # irb, the preferred idiom is:
2037
+ #
2038
+ # irb> doc = Nokogiri::Slop my_markup
2039
+ #
2040
+ # and not
2041
+ #
2042
+ # irb> doc = Nokogiri::HTML my_markup
2043
+ # ... followed by irb's implicit inspect (and therefore instantiation of every node) ...
2044
+ # irb> doc.slop!
2045
+ # ... which does absolutely nothing.
2046
+ def slop!; end
2047
+
2048
+ def to_xml(*args, &block); end
2049
+ def url; end
2050
+
2051
+ # Validate this Document against it's DTD. Returns a list of errors on
2052
+ # the document or +nil+ when there is no DTD.
2053
+ def validate; end
2054
+
2055
+ def version; end
2056
+
2057
+ # :call-seq:
2058
+ # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig
2059
+ #
2060
+ # [Returns] The document type which determines CSS-to-XPath translation.
2061
+ #
2062
+ # See XPathVisitor for more information.
2063
+ def xpath_doctype; end
2064
+
2065
+ private
2066
+
2067
+ def inspect_attributes; end
2068
+
2069
+ class << self
2070
+ # @return [Boolean]
2071
+ def empty_doc?(string_or_io); end
2072
+
2073
+ def new(*_arg0); end
2074
+
2075
+ # Parse an XML file.
2076
+ #
2077
+ # +string_or_io+ may be a String, or any object that responds to
2078
+ # _read_ and _close_ such as an IO, or StringIO.
2079
+ #
2080
+ # +url+ (optional) is the URI where this document is located.
2081
+ #
2082
+ # +encoding+ (optional) is the encoding that should be used when processing
2083
+ # the document.
2084
+ #
2085
+ # +options+ (optional) is a configuration object that sets options during
2086
+ # parsing, such as Nokogiri::XML::ParseOptions::RECOVER. See the
2087
+ # Nokogiri::XML::ParseOptions for more information.
2088
+ #
2089
+ # +block+ (optional) is passed a configuration object on which
2090
+ # parse options may be set.
2091
+ #
2092
+ # By default, Nokogiri treats documents as untrusted, and so
2093
+ # does not attempt to load DTDs or access the network. See
2094
+ # Nokogiri::XML::ParseOptions for a complete list of options;
2095
+ # and that module's DEFAULT_XML constant for what's set (and not
2096
+ # set) by default.
2097
+ #
2098
+ # Nokogiri.XML() is a convenience method which will call this method.
2099
+ #
2100
+ # @yield [options]
2101
+ def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
2102
+
2103
+ def read_io(_arg0, _arg1, _arg2, _arg3); end
2104
+ def read_memory(_arg0, _arg1, _arg2, _arg3); end
2105
+ end
2106
+ end
2107
+
2108
+ Nokogiri::XML::Document::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
2109
+ Nokogiri::XML::Document::NCNAME_CHAR = T.let(T.unsafe(nil), String)
2110
+ Nokogiri::XML::Document::NCNAME_RE = T.let(T.unsafe(nil), Regexp)
2111
+
2112
+ # See http://www.w3.org/TR/REC-xml-names/#ns-decl for more details. Note that we're not
2113
+ # attempting to handle unicode characters partly because libxml2 doesn't handle unicode
2114
+ # characters in NCNAMEs.
2115
+ Nokogiri::XML::Document::NCNAME_START_CHAR = T.let(T.unsafe(nil), String)
2116
+
2117
+ class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node
2118
+ # Create a new DocumentFragment from +tags+.
2119
+ #
2120
+ # If +ctx+ is present, it is used as a context node for the
2121
+ # subtree created, e.g., namespaces will be resolved relative
2122
+ # to +ctx+.
2123
+ #
2124
+ # @return [DocumentFragment] a new instance of DocumentFragment
2125
+ # @yield [options]
2126
+ def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
2127
+
2128
+ # call-seq: css *rules, [namespace-bindings, custom-pseudo-class]
2129
+ #
2130
+ # Search this fragment for CSS +rules+. +rules+ must be one or more CSS
2131
+ # selectors. For example:
2132
+ #
2133
+ # For more information see Nokogiri::XML::Searchable#css
2134
+ def css(*args); end
2135
+
2136
+ def dup; end
2137
+
2138
+ # A list of Nokogiri::XML::SyntaxError found when parsing a document
2139
+ def errors; end
2140
+
2141
+ def errors=(things); end
2142
+ def fragment(data); end
2143
+
2144
+ # return the name for DocumentFragment
2145
+ def name; end
2146
+
2147
+ # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
2148
+ #
2149
+ # Search this fragment for +paths+. +paths+ must be one or more XPath or CSS queries.
2150
+ #
2151
+ # For more information see Nokogiri::XML::Searchable#search
2152
+ def search(*rules); end
2153
+
2154
+ # Convert this DocumentFragment to a string
2155
+ def serialize; end
2156
+
2157
+ # Convert this DocumentFragment to html
2158
+ # See Nokogiri::XML::NodeSet#to_html
2159
+ def to_html(*args); end
2160
+
2161
+ # Convert this DocumentFragment to a string
2162
+ def to_s; end
2163
+
2164
+ # Convert this DocumentFragment to xhtml
2165
+ # See Nokogiri::XML::NodeSet#to_xhtml
2166
+ def to_xhtml(*args); end
2167
+
2168
+ # Convert this DocumentFragment to xml
2169
+ # See Nokogiri::XML::NodeSet#to_xml
2170
+ def to_xml(*args); end
2171
+
2172
+ private
2173
+
2174
+ # fix for issue 770
2175
+ def namespace_declarations(ctx); end
2176
+
2177
+ class << self
2178
+ def new(*_arg0); end
2179
+
2180
+ # Create a Nokogiri::XML::DocumentFragment from +tags+
2181
+ def parse(tags, options = T.unsafe(nil), &block); end
2182
+ end
2183
+ end
2184
+
2185
+ class Nokogiri::XML::Element < ::Nokogiri::XML::Node; end
2186
+
2187
+ # Represents the allowed content in an Element Declaration inside a DTD:
2188
+ #
2189
+ # <?xml version="1.0"?><?TEST-STYLE PIDATA?>
2190
+ # <!DOCTYPE staff SYSTEM "staff.dtd" [
2191
+ # <!ELEMENT div1 (head, (p | list | note)*, div2*)>
2192
+ # ]>
2193
+ # </root>
2194
+ #
2195
+ # ElementContent represents the tree inside the <!ELEMENT> tag shown above
2196
+ # that lists the possible content for the div1 tag.
2197
+ class Nokogiri::XML::ElementContent
2198
+ # Get the children of this ElementContent node
2199
+ def children; end
2200
+
2201
+ # Returns the value of attribute document.
2202
+ def document; end
2203
+
2204
+ def name; end
2205
+ def occur; end
2206
+ def prefix; end
2207
+ def type; end
2208
+
2209
+ private
2210
+
2211
+ def c1; end
2212
+ def c2; end
2213
+ end
2214
+
2215
+ Nokogiri::XML::ElementContent::ELEMENT = T.let(T.unsafe(nil), Integer)
2216
+ Nokogiri::XML::ElementContent::MULT = T.let(T.unsafe(nil), Integer)
2217
+
2218
+ # Possible content occurrences
2219
+ Nokogiri::XML::ElementContent::ONCE = T.let(T.unsafe(nil), Integer)
2220
+
2221
+ Nokogiri::XML::ElementContent::OPT = T.let(T.unsafe(nil), Integer)
2222
+ Nokogiri::XML::ElementContent::OR = T.let(T.unsafe(nil), Integer)
2223
+
2224
+ # Possible definitions of type
2225
+ Nokogiri::XML::ElementContent::PCDATA = T.let(T.unsafe(nil), Integer)
2226
+
2227
+ Nokogiri::XML::ElementContent::PLUS = T.let(T.unsafe(nil), Integer)
2228
+ Nokogiri::XML::ElementContent::SEQ = T.let(T.unsafe(nil), Integer)
2229
+
2230
+ class Nokogiri::XML::ElementDecl < ::Nokogiri::XML::Node
2231
+ def content; end
2232
+ def element_type; end
2233
+ def inspect; end
2234
+ def prefix; end
2235
+ end
2236
+
2237
+ class Nokogiri::XML::EntityDecl < ::Nokogiri::XML::Node
2238
+ def content; end
2239
+ def entity_type; end
2240
+ def external_id; end
2241
+ def inspect; end
2242
+ def original_content; end
2243
+ def system_id; end
2244
+
2245
+ class << self
2246
+ def new(name, doc, *args); end
2247
+ end
2248
+ end
2249
+
2250
+ Nokogiri::XML::EntityDecl::EXTERNAL_GENERAL_PARSED = T.let(T.unsafe(nil), Integer)
2251
+ Nokogiri::XML::EntityDecl::EXTERNAL_GENERAL_UNPARSED = T.let(T.unsafe(nil), Integer)
2252
+ Nokogiri::XML::EntityDecl::EXTERNAL_PARAMETER = T.let(T.unsafe(nil), Integer)
2253
+ Nokogiri::XML::EntityDecl::INTERNAL_GENERAL = T.let(T.unsafe(nil), Integer)
2254
+ Nokogiri::XML::EntityDecl::INTERNAL_PARAMETER = T.let(T.unsafe(nil), Integer)
2255
+ Nokogiri::XML::EntityDecl::INTERNAL_PREDEFINED = T.let(T.unsafe(nil), Integer)
2256
+
2257
+ class Nokogiri::XML::EntityReference < ::Nokogiri::XML::Node
2258
+ def children; end
2259
+ def inspect_attributes; end
2260
+
2261
+ class << self
2262
+ def new(*_arg0); end
2263
+ end
2264
+ end
2265
+
2266
+ class Nokogiri::XML::Namespace
2267
+ include ::Nokogiri::XML::PP::Node
2268
+
2269
+ # Returns the value of attribute document.
2270
+ def document; end
2271
+
2272
+ def href; end
2273
+ def prefix; end
2274
+
2275
+ private
2276
+
2277
+ def inspect_attributes; end
2278
+ end
2279
+
2280
+ # Nokogiri::XML::Node is the primary API you'll use to interact with your Document.
2281
+ #
2282
+ # == Attributes
2283
+ #
2284
+ # A Nokogiri::XML::Node may be treated similarly to a hash with regard to attributes. For
2285
+ # example:
2286
+ #
2287
+ # node = Nokogiri::XML::DocumentFragment.parse("<a href='#foo' id='link'>link</a>").at_css("a")
2288
+ # node.to_html # => "<a href=\"#foo\" id=\"link\">link</a>"
2289
+ # node['href'] # => "#foo"
2290
+ # node.keys # => ["href", "id"]
2291
+ # node.values # => ["#foo", "link"]
2292
+ # node['class'] = 'green' # => "green"
2293
+ # node.to_html # => "<a href=\"#foo\" id=\"link\" class=\"green\">link</a>"
2294
+ #
2295
+ # See the method group entitled Node@Working+With+Node+Attributes for the full set of methods.
2296
+ #
2297
+ # == Navigation
2298
+ #
2299
+ # Nokogiri::XML::Node also has methods that let you move around your tree:
2300
+ #
2301
+ # [#parent, #children, #next, #previous]
2302
+ # Navigate up, down, or through siblings.
2303
+ #
2304
+ # See the method group entitled Node@Traversing+Document+Structure for the full set of methods.
2305
+ #
2306
+ # == Serialization
2307
+ #
2308
+ # When printing or otherwise emitting a document or a node (and its subtree), there are a few
2309
+ # methods you might want to use:
2310
+ #
2311
+ # [#content, #text, #inner_text, #to_str]
2312
+ # These methods will all **emit plaintext**,
2313
+ # meaning that entities will be replaced (e.g., +&lt;+ will be replaced with +<+), meaning
2314
+ # that any sanitizing will likely be un-done in the output.
2315
+ #
2316
+ # [#to_s, #to_xml, #to_html, #inner_html]
2317
+ # These methods will all **emit properly-escaped markup**, meaning that it's suitable for
2318
+ # consumption by browsers, parsers, etc.
2319
+ #
2320
+ # See the method group entitled Node@Serialization+and+Generating+Output for the full set of methods.
2321
+ #
2322
+ # == Searching
2323
+ #
2324
+ # You may search this node's subtree using methods like #xpath and #css.
2325
+ #
2326
+ # See the method group entitled Node@Searching+via+XPath+or+CSS+Queries for the full set of methods.
2327
+ class Nokogiri::XML::Node
2328
+ include ::Nokogiri::HTML5::Node
2329
+ include ::Nokogiri::XML::PP::Node
2330
+ include ::Nokogiri::XML::Searchable
2331
+ include ::Nokogiri::ClassResolver
2332
+ include ::Enumerable
2333
+
2334
+ # :call-seq:
2335
+ # new(name, document) -> Nokogiri::XML::Node
2336
+ # new(name, document) { |node| ... } -> Nokogiri::XML::Node
2337
+ #
2338
+ # Create a new node with +name+ that belongs to +document+.
2339
+ #
2340
+ # If you intend to add a node to a document tree, it's likely that you will prefer one of the
2341
+ # Nokogiri::XML::Node methods like #add_child, #add_next_sibling, #replace, etc. which will
2342
+ # both create an element (or subtree) and place it in the document tree.
2343
+ #
2344
+ # Another alternative, if you are concerned about performance, is
2345
+ # Nokogiri::XML::Document#create_element which accepts additional arguments for contents or
2346
+ # attributes but (like this method) avoids parsing markup.
2347
+ #
2348
+ # [Parameters]
2349
+ # - +name+ (String)
2350
+ # - +document+ (Nokogiri::XML::Document) The document to which the the returned node will belong.
2351
+ # [Yields] Nokogiri::XML::Node
2352
+ # [Returns] Nokogiri::XML::Node
2353
+ #
2354
+ # @return [Node] a new instance of Node
2355
+ def initialize(name, document); end
2356
+
2357
+ # Add +node_or_tags+ as a child of this Node.
2358
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
2359
+ #
2360
+ # Returns self, to support chaining of calls (e.g., root << child1 << child2)
2361
+ #
2362
+ # Also see related method +add_child+.
2363
+ def <<(node_or_tags); end
2364
+
2365
+ # Compare two Node objects with respect to their Document. Nodes from
2366
+ # different documents cannot be compared.
2367
+ def <=>(other); end
2368
+
2369
+ # Test to see if this Node is equal to +other+
2370
+ def ==(other); end
2371
+
2372
+ # :call-seq: [](name) → (String, nil)
2373
+ #
2374
+ # Fetch an attribute from this node.
2375
+ #
2376
+ # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access
2377
+ # namespaced attributes, use #attribute_with_ns.
2378
+ #
2379
+ # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists
2380
+ #
2381
+ # *Example*
2382
+ #
2383
+ # doc = Nokogiri::XML("<root><child size='large' class='big wide tall'/></root>")
2384
+ # child = doc.at_css("child")
2385
+ # child["size"] # => "large"
2386
+ # child["class"] # => "big wide tall"
2387
+ #
2388
+ # *Example:* Namespaced attributes will not be returned.
2389
+ #
2390
+ # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns
2391
+ #
2392
+ # doc = Nokogiri::XML(<<~EOF)
2393
+ # <root xmlns:width='http://example.com/widths'>
2394
+ # <child width:size='broad'/>
2395
+ # </root>
2396
+ # EOF
2397
+ # doc.at_css("child")["size"] # => nil
2398
+ # doc.at_css("child").attribute("size").value # => "broad"
2399
+ # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
2400
+ # # => "broad"
2401
+ def [](name); end
2402
+
2403
+ # :call-seq: []=(name, value) → value
2404
+ #
2405
+ # Update the attribute +name+ to +value+, or create the attribute if it does not exist.
2406
+ #
2407
+ # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access
2408
+ # namespaced attributes for update, use #attribute_with_ns. To add a namespaced attribute,
2409
+ # see the example below.
2410
+ #
2411
+ # [Returns] +value+
2412
+ #
2413
+ # *Example*
2414
+ #
2415
+ # doc = Nokogiri::XML("<root><child/></root>")
2416
+ # child = doc.at_css("child")
2417
+ # child["size"] = "broad"
2418
+ # child.to_html
2419
+ # # => "<child size=\"broad\"></child>"
2420
+ #
2421
+ # *Example:* Add a namespaced attribute.
2422
+ #
2423
+ # doc = Nokogiri::XML(<<~EOF)
2424
+ # <root xmlns:width='http://example.com/widths'>
2425
+ # <child/>
2426
+ # </root>
2427
+ # EOF
2428
+ # child = doc.at_css("child")
2429
+ # child["size"] = "broad"
2430
+ # ns = doc.root.namespace_definitions.find { |ns| ns.prefix == "width" }
2431
+ # child.attribute("size").namespace = ns
2432
+ # doc.to_html
2433
+ # # => "<root xmlns:width=\"http://example.com/widths\">\n" +
2434
+ # # " <child width:size=\"broad\"></child>\n" +
2435
+ # # "</root>\n"
2436
+ def []=(name, value); end
2437
+
2438
+ # Accept a visitor. This method calls "visit" on +visitor+ with self.
2439
+ def accept(visitor); end
2440
+
2441
+ # Add +node_or_tags+ as a child of this Node.
2442
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
2443
+ #
2444
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
2445
+ #
2446
+ # Also see related method +<<+.
2447
+ def add_child(node_or_tags); end
2448
+
2449
+ # :call-seq: add_class(names) → self
2450
+ #
2451
+ # Ensure HTML CSS classes are present on +self+. Any CSS classes in +names+ that already exist
2452
+ # in the "class" attribute are _not_ added. Note that any existing duplicates in the
2453
+ # "class" attribute are not removed. Compare with #append_class.
2454
+ #
2455
+ # This is a convenience function and is equivalent to:
2456
+ #
2457
+ # node.kwattr_add("class", names)
2458
+ #
2459
+ # See related: #kwattr_add, #classes, #append_class, #remove_class
2460
+ #
2461
+ # [Parameters]
2462
+ # - +names+ (String, Array<String>)
2463
+ #
2464
+ # CSS class names to be added to the Node's "class" attribute. May be a string containing
2465
+ # whitespace-delimited names, or an Array of String names. Any class names already present
2466
+ # will not be added. Any class names not present will be added. If no "class" attribute
2467
+ # exists, one is created.
2468
+ #
2469
+ # [Returns] +self+ (Node) for ease of chaining method calls.
2470
+ #
2471
+ # *Example:* Ensure that the node has CSS class "section"
2472
+ #
2473
+ # node # => <div></div>
2474
+ # node.add_class("section") # => <div class="section"></div>
2475
+ # node.add_class("section") # => <div class="section"></div> # duplicate not added
2476
+ #
2477
+ # *Example:* Ensure that the node has CSS classes "section" and "header", via a String argument
2478
+ #
2479
+ # Note that the CSS class "section" is not added because it is already present.
2480
+ # Note also that the pre-existing duplicate CSS class "section" is not removed.
2481
+ #
2482
+ # node # => <div class="section section"></div>
2483
+ # node.add_class("section header") # => <div class="section section header"></div>
2484
+ #
2485
+ # *Example:* Ensure that the node has CSS classes "section" and "header", via an Array argument
2486
+ #
2487
+ # node # => <div></div>
2488
+ # node.add_class(["section", "header"]) # => <div class="section header"></div>
2489
+ def add_class(names); end
2490
+
2491
+ def add_namespace(_arg0, _arg1); end
2492
+ def add_namespace_definition(_arg0, _arg1); end
2493
+
2494
+ # Insert +node_or_tags+ after this Node (as a sibling).
2495
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
2496
+ #
2497
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
2498
+ #
2499
+ # Also see related method +after+.
2500
+ #
2501
+ # @raise [ArgumentError]
2502
+ def add_next_sibling(node_or_tags); end
2503
+
2504
+ # Insert +node_or_tags+ before this Node (as a sibling).
2505
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
2506
+ #
2507
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
2508
+ #
2509
+ # Also see related method +before+.
2510
+ #
2511
+ # @raise [ArgumentError]
2512
+ def add_previous_sibling(node_or_tags); end
2513
+
2514
+ # Insert +node_or_tags+ after this node (as a sibling).
2515
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup.
2516
+ #
2517
+ # Returns self, to support chaining of calls.
2518
+ #
2519
+ # Also see related method +add_next_sibling+.
2520
+ def after(node_or_tags); end
2521
+
2522
+ # Get a list of ancestor Node for this Node. If +selector+ is given,
2523
+ # the ancestors must match +selector+
2524
+ def ancestors(selector = T.unsafe(nil)); end
2525
+
2526
+ # :call-seq: append_class(names) → self
2527
+ #
2528
+ # Add HTML CSS classes to +self+, regardless of duplication. Compare with #add_class.
2529
+ #
2530
+ # This is a convenience function and is equivalent to:
2531
+ #
2532
+ # node.kwattr_append("class", names)
2533
+ #
2534
+ # See related: #kwattr_append, #classes, #add_class, #remove_class
2535
+ #
2536
+ # [Parameters]
2537
+ # - +names+ (String, Array<String>)
2538
+ #
2539
+ # CSS class names to be appended to the Node's "class" attribute. May be a string containing
2540
+ # whitespace-delimited names, or an Array of String names. All class names passed in will be
2541
+ # appended to the "class" attribute even if they are already present in the attribute
2542
+ # value. If no "class" attribute exists, one is created.
2543
+ #
2544
+ # [Returns] +self+ (Node) for ease of chaining method calls.
2545
+ #
2546
+ # *Example:* Append "section" to the node's CSS "class" attribute
2547
+ #
2548
+ # node # => <div></div>
2549
+ # node.append_class("section") # => <div class="section"></div>
2550
+ # node.append_class("section") # => <div class="section section"></div> # duplicate added!
2551
+ #
2552
+ # *Example:* Append "section" and "header" to the noded's CSS "class" attribute, via a String argument
2553
+ #
2554
+ # Note that the CSS class "section" is appended even though it is already present
2555
+ #
2556
+ # node # => <div class="section section"></div>
2557
+ # node.append_class("section header") # => <div class="section section section header"></div>
2558
+ #
2559
+ # *Example:* Append "section" and "header" to the node's CSS "class" attribute, via an Array argument
2560
+ #
2561
+ # node # => <div></div>
2562
+ # node.append_class(["section", "header"]) # => <div class="section header"></div>
2563
+ # node.append_class(["section", "header"]) # => <div class="section header section header"></div>
2564
+ def append_class(names); end
2565
+
2566
+ # :call-seq: [](name) → (String, nil)
2567
+ #
2568
+ # Fetch an attribute from this node.
2569
+ #
2570
+ # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access
2571
+ # namespaced attributes, use #attribute_with_ns.
2572
+ #
2573
+ # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists
2574
+ #
2575
+ # *Example*
2576
+ #
2577
+ # doc = Nokogiri::XML("<root><child size='large' class='big wide tall'/></root>")
2578
+ # child = doc.at_css("child")
2579
+ # child["size"] # => "large"
2580
+ # child["class"] # => "big wide tall"
2581
+ #
2582
+ # *Example:* Namespaced attributes will not be returned.
2583
+ #
2584
+ # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns
2585
+ #
2586
+ # doc = Nokogiri::XML(<<~EOF)
2587
+ # <root xmlns:width='http://example.com/widths'>
2588
+ # <child width:size='broad'/>
2589
+ # </root>
2590
+ # EOF
2591
+ # doc.at_css("child")["size"] # => nil
2592
+ # doc.at_css("child").attribute("size").value # => "broad"
2593
+ # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
2594
+ # # => "broad"
2595
+ def attr(name); end
2596
+
2597
+ def attribute(_arg0); end
2598
+ def attribute_nodes; end
2599
+ def attribute_with_ns(_arg0, _arg1); end
2600
+
2601
+ # :call-seq: attributes() → Hash<String ⇒ Nokogiri::XML::Attr>
2602
+ #
2603
+ # Fetch this node's attributes.
2604
+ #
2605
+ # ⚠ Because the keys do not include any namespace information for the attribute, in case of a
2606
+ # simple name collision, not all attributes will be returned. In this case, you will need to
2607
+ # use #attribute_nodes.
2608
+ #
2609
+ # [Returns]
2610
+ # Hash containing attributes belonging to +self+. The hash keys are String attribute
2611
+ # names (without the namespace), and the hash values are Nokogiri::XML::Attr.
2612
+ #
2613
+ # *Example* with no namespaces:
2614
+ #
2615
+ # doc = Nokogiri::XML("<root><child size='large' class='big wide tall'/></root>")
2616
+ # doc.at_css("child").attributes
2617
+ # # => {"size"=>#(Attr:0x550 { name = "size", value = "large" }),
2618
+ # # "class"=>#(Attr:0x564 { name = "class", value = "big wide tall" })}
2619
+ #
2620
+ # *Example* with a namespace:
2621
+ #
2622
+ # doc = Nokogiri::XML("<root xmlns:desc='http://example.com/sizes'><child desc:size='large'/></root>")
2623
+ # doc.at_css("child").attributes
2624
+ # # => {"size"=>
2625
+ # # #(Attr:0x550 {
2626
+ # # name = "size",
2627
+ # # namespace = #(Namespace:0x564 {
2628
+ # # prefix = "desc",
2629
+ # # href = "http://example.com/sizes"
2630
+ # # }),
2631
+ # # value = "large"
2632
+ # # })}
2633
+ #
2634
+ # *Example* with an attribute name collision:
2635
+ #
2636
+ # ⚠ Note that only one of the attributes is returned in the Hash.
2637
+ #
2638
+ # doc = Nokogiri::XML(<<~EOF)
2639
+ # <root xmlns:width='http://example.com/widths'
2640
+ # xmlns:height='http://example.com/heights'>
2641
+ # <child width:size='broad' height:size='tall'/>
2642
+ # </root>
2643
+ # EOF
2644
+ # doc.at_css("child").attributes
2645
+ # # => {"size"=>
2646
+ # # #(Attr:0x550 {
2647
+ # # name = "size",
2648
+ # # namespace = #(Namespace:0x564 {
2649
+ # # prefix = "height",
2650
+ # # href = "http://example.com/heights"
2651
+ # # }),
2652
+ # # value = "tall"
2653
+ # # })}
2654
+ def attributes; end
2655
+
2656
+ # Insert +node_or_tags+ before this node (as a sibling).
2657
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
2658
+ #
2659
+ # Returns self, to support chaining of calls.
2660
+ #
2661
+ # Also see related method +add_previous_sibling+.
2662
+ def before(node_or_tags); end
2663
+
2664
+ def blank?; end
2665
+ def canonicalize(mode = T.unsafe(nil), inclusive_namespaces = T.unsafe(nil), with_comments = T.unsafe(nil)); end
2666
+
2667
+ # Returns true if this is a CDATA
2668
+ #
2669
+ # @return [Boolean]
2670
+ def cdata?; end
2671
+
2672
+ def child; end
2673
+ def children; end
2674
+
2675
+ # Set the inner html for this Node +node_or_tags+
2676
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup.
2677
+ #
2678
+ # Also see related method +inner_html=+
2679
+ def children=(node_or_tags); end
2680
+
2681
+ # :call-seq: classes() → Array<String>
2682
+ #
2683
+ # Fetch CSS class names of a Node.
2684
+ #
2685
+ # This is a convenience function and is equivalent to:
2686
+ #
2687
+ # node.kwattr_values("class")
2688
+ #
2689
+ # See related: #kwattr_values, #add_class, #append_class, #remove_class
2690
+ #
2691
+ # [Returns]
2692
+ # The CSS classes (Array of String) present in the Node's "class" attribute. If the
2693
+ # attribute is empty or non-existent, the return value is an empty array.
2694
+ #
2695
+ # *Example*
2696
+ #
2697
+ # node # => <div class="section title header"></div>
2698
+ # node.classes # => ["section", "title", "header"]
2699
+ def classes; end
2700
+
2701
+ def clone(*_arg0); end
2702
+
2703
+ # Returns true if this is a Comment
2704
+ #
2705
+ # @return [Boolean]
2706
+ def comment?; end
2707
+
2708
+ def content; end
2709
+
2710
+ # Set the Node's content to a Text node containing +string+. The string gets XML escaped, not interpreted as markup.
2711
+ def content=(string); end
2712
+
2713
+ def create_external_subset(_arg0, _arg1, _arg2); end
2714
+ def create_internal_subset(_arg0, _arg1, _arg2); end
2715
+
2716
+ # Get the path to this node as a CSS expression
2717
+ def css_path; end
2718
+
2719
+ # Decorate this node with the decorators set up in this node's Document
2720
+ def decorate!; end
2721
+
2722
+ # Adds a default namespace supplied as a string +url+ href, to self.
2723
+ # The consequence is as an xmlns attribute with supplied argument were
2724
+ # present in parsed XML. A default namespace set with this method will
2725
+ # now show up in #attributes, but when this node is serialized to XML an
2726
+ # "xmlns" attribute will appear. See also #namespace and #namespace=
2727
+ def default_namespace=(url); end
2728
+
2729
+ # Remove the attribute named +name+
2730
+ def delete(name); end
2731
+
2732
+ # Fetch the Nokogiri::HTML4::ElementDescription for this node. Returns
2733
+ # nil on XML documents and on unknown tags.
2734
+ def description; end
2735
+
2736
+ # Do xinclude substitution on the subtree below node. If given a block, a
2737
+ # Nokogiri::XML::ParseOptions object initialized from +options+, will be
2738
+ # passed to it, allowing more convenient modification of the parser options.
2739
+ #
2740
+ # @yield [options]
2741
+ def do_xinclude(options = T.unsafe(nil)); end
2742
+
2743
+ def document; end
2744
+
2745
+ # Returns true if this is a Document
2746
+ #
2747
+ # @return [Boolean]
2748
+ def document?; end
2749
+
2750
+ def dup(*_arg0); end
2751
+
2752
+ # Iterate over each attribute name and value pair for this Node.
2753
+ def each; end
2754
+
2755
+ # Returns true if this is an Element node
2756
+ #
2757
+ # @return [Boolean]
2758
+ def elem?; end
2759
+
2760
+ # Returns true if this is an Element node
2761
+ #
2762
+ # @return [Boolean]
2763
+ def element?; end
2764
+
2765
+ def element_children; end
2766
+ def elements; end
2767
+ def encode_special_chars(_arg0); end
2768
+ def external_subset; end
2769
+ def first_element_child; end
2770
+
2771
+ # Create a DocumentFragment containing +tags+ that is relative to _this_
2772
+ # context node.
2773
+ def fragment(tags); end
2774
+
2775
+ # Returns true if this is a DocumentFragment
2776
+ #
2777
+ # @return [Boolean]
2778
+ def fragment?; end
2779
+
2780
+ # :call-seq: [](name) → (String, nil)
2781
+ #
2782
+ # Fetch an attribute from this node.
2783
+ #
2784
+ # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access
2785
+ # namespaced attributes, use #attribute_with_ns.
2786
+ #
2787
+ # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists
2788
+ #
2789
+ # *Example*
2790
+ #
2791
+ # doc = Nokogiri::XML("<root><child size='large' class='big wide tall'/></root>")
2792
+ # child = doc.at_css("child")
2793
+ # child["size"] # => "large"
2794
+ # child["class"] # => "big wide tall"
2795
+ #
2796
+ # *Example:* Namespaced attributes will not be returned.
2797
+ #
2798
+ # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns
2799
+ #
2800
+ # doc = Nokogiri::XML(<<~EOF)
2801
+ # <root xmlns:width='http://example.com/widths'>
2802
+ # <child width:size='broad'/>
2803
+ # </root>
2804
+ # EOF
2805
+ # doc.at_css("child")["size"] # => nil
2806
+ # doc.at_css("child").attribute("size").value # => "broad"
2807
+ # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
2808
+ # # => "broad"
2809
+ def get_attribute(name); end
2810
+
2811
+ def has_attribute?(_arg0); end
2812
+
2813
+ # Returns true if this is an HTML4::Document or HTML5::Document node
2814
+ #
2815
+ # @return [Boolean]
2816
+ def html?; end
2817
+
2818
+ # Get the inner_html for this node's Node#children
2819
+ def inner_html(options = T.unsafe(nil)); end
2820
+
2821
+ # Set the inner html for this Node to +node_or_tags+
2822
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup.
2823
+ #
2824
+ # Also see related method +children=+
2825
+ def inner_html=(node_or_tags); end
2826
+
2827
+ # :section:
2828
+ def inner_text; end
2829
+
2830
+ def internal_subset; end
2831
+ def key?(_arg0); end
2832
+
2833
+ # Get the attribute names for this Node.
2834
+ def keys; end
2835
+
2836
+ # :call-seq:
2837
+ # kwattr_add(attribute_name, keywords) → self
2838
+ #
2839
+ # Ensure that values are present in a keyword attribute.
2840
+ #
2841
+ # Any values in +keywords+ that already exist in the Node's attribute values are _not_
2842
+ # added. Note that any existing duplicates in the attribute values are not removed. Compare
2843
+ # with #kwattr_append.
2844
+ #
2845
+ # A "keyword attribute" is a node attribute that contains a set of space-delimited
2846
+ # values. Perhaps the most familiar example of this is the HTML "class" attribute used to
2847
+ # contain CSS classes. But other keyword attributes exist, for instance
2848
+ # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel].
2849
+ #
2850
+ # See also #add_class, #kwattr_values, #kwattr_append, #kwattr_remove
2851
+ #
2852
+ # [Parameters]
2853
+ # - +attribute_name+ (String) The name of the keyword attribute to be modified.
2854
+ # - +keywords+ (String, Array<String>)
2855
+ # Keywords to be added to the attribute named +attribute_name+. May be a string containing
2856
+ # whitespace-delimited values, or an Array of String values. Any values already present will
2857
+ # not be added. Any values not present will be added. If the named attribute does not exist,
2858
+ # it is created.
2859
+ #
2860
+ # [Returns] +self+ (Nokogiri::XML::Node) for ease of chaining method calls.
2861
+ #
2862
+ # *Example:* Ensure that a +Node+ has "nofollow" in its +rel+ attribute.
2863
+ #
2864
+ # Note that duplicates are not added.
2865
+ #
2866
+ # node # => <a></a>
2867
+ # node.kwattr_add("rel", "nofollow") # => <a rel="nofollow"></a>
2868
+ # node.kwattr_add("rel", "nofollow") # => <a rel="nofollow"></a>
2869
+ #
2870
+ # *Example:* Ensure that a +Node+ has "nofollow" and "noreferrer" in its +rel+ attribute, via a
2871
+ # String argument.
2872
+ #
2873
+ # Note that "nofollow" is not added because it is already present. Note also that the
2874
+ # pre-existing duplicate "nofollow" is not removed.
2875
+ #
2876
+ # node # => <a rel="nofollow nofollow"></a>
2877
+ # node.kwattr_add("rel", "nofollow noreferrer") # => <a rel="nofollow nofollow noreferrer"></a>
2878
+ #
2879
+ # *Example:* Ensure that a +Node+ has "nofollow" and "noreferrer" in its +rel+ attribute, via
2880
+ # an Array argument.
2881
+ #
2882
+ # node # => <a></a>
2883
+ # node.kwattr_add("rel", ["nofollow", "noreferrer"]) # => <a rel="nofollow noreferrer"></a>
2884
+ #
2885
+ # Since v1.11.0
2886
+ def kwattr_add(attribute_name, keywords); end
2887
+
2888
+ # :call-seq:
2889
+ # kwattr_append(attribute_name, keywords) → self
2890
+ #
2891
+ # Add keywords to a Node's keyword attribute, regardless of duplication. Compare with
2892
+ # #kwattr_add.
2893
+ #
2894
+ # A "keyword attribute" is a node attribute that contains a set of space-delimited
2895
+ # values. Perhaps the most familiar example of this is the HTML "class" attribute used to
2896
+ # contain CSS classes. But other keyword attributes exist, for instance
2897
+ # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel].
2898
+ #
2899
+ # See also #append_class, #kwattr_values, #kwattr_add, #kwattr_remove
2900
+ #
2901
+ # [Parameters]
2902
+ # - +attribute_name+ (String) The name of the keyword attribute to be modified.
2903
+ # - +keywords+ (String, Array<String>)
2904
+ # Keywords to be added to the attribute named +attribute_name+. May be a string containing
2905
+ # whitespace-delimited values, or an Array of String values. All values passed in will be
2906
+ # appended to the named attribute even if they are already present in the attribute. If the
2907
+ # named attribute does not exist, it is created.
2908
+ #
2909
+ # [Returns] +self+ (Node) for ease of chaining method calls.
2910
+ #
2911
+ # *Example:* Append "nofollow" to the +rel+ attribute.
2912
+ #
2913
+ # Note that duplicates are added.
2914
+ #
2915
+ # node # => <a></a>
2916
+ # node.kwattr_append("rel", "nofollow") # => <a rel="nofollow"></a>
2917
+ # node.kwattr_append("rel", "nofollow") # => <a rel="nofollow nofollow"></a>
2918
+ #
2919
+ # *Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via a String argument.
2920
+ #
2921
+ # Note that "nofollow" is appended even though it is already present.
2922
+ #
2923
+ # node # => <a rel="nofollow"></a>
2924
+ # node.kwattr_append("rel", "nofollow noreferrer") # => <a rel="nofollow nofollow noreferrer"></a>
2925
+ #
2926
+ #
2927
+ # *Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via an Array argument.
2928
+ #
2929
+ # node # => <a></a>
2930
+ # node.kwattr_append("rel", ["nofollow", "noreferrer"]) # => <a rel="nofollow noreferrer"></a>
2931
+ #
2932
+ # Since v1.11.0
2933
+ def kwattr_append(attribute_name, keywords); end
2934
+
2935
+ # :call-seq:
2936
+ # kwattr_remove(attribute_name, keywords) → self
2937
+ #
2938
+ # Remove keywords from a keyword attribute. Any matching keywords that exist in the named
2939
+ # attribute are removed, including any multiple entries.
2940
+ #
2941
+ # If no keywords remain after this operation, or if +keywords+ is +nil+, the attribute is
2942
+ # deleted from the node.
2943
+ #
2944
+ # A "keyword attribute" is a node attribute that contains a set of space-delimited
2945
+ # values. Perhaps the most familiar example of this is the HTML "class" attribute used to
2946
+ # contain CSS classes. But other keyword attributes exist, for instance
2947
+ # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel].
2948
+ #
2949
+ # See also #remove_class, #kwattr_values, #kwattr_add, #kwattr_append
2950
+ #
2951
+ # [Parameters]
2952
+ # - +attribute_name+ (String) The name of the keyword attribute to be modified.
2953
+ # - +keywords+ (String, Array<String>)
2954
+ # Keywords to be removed from the attribute named +attribute_name+. May be a string
2955
+ # containing whitespace-delimited values, or an Array of String values. Any keywords present
2956
+ # in the named attribute will be removed. If no keywords remain, or if +keywords+ is nil,
2957
+ # the attribute is deleted.
2958
+ #
2959
+ # [Returns] +self+ (Node) for ease of chaining method calls.
2960
+ #
2961
+ # *Example:*
2962
+ #
2963
+ # Note that the +rel+ attribute is deleted when empty.
2964
+ #
2965
+ # node # => <a rel="nofollow noreferrer">link</a>
2966
+ # node.kwattr_remove("rel", "nofollow") # => <a rel="noreferrer">link</a>
2967
+ # node.kwattr_remove("rel", "noreferrer") # => <a>link</a>
2968
+ #
2969
+ # Since v1.11.0
2970
+ def kwattr_remove(attribute_name, keywords); end
2971
+
2972
+ # :call-seq:
2973
+ # kwattr_values(attribute_name) → Array<String>
2974
+ #
2975
+ # Fetch values from a keyword attribute of a Node.
2976
+ #
2977
+ # A "keyword attribute" is a node attribute that contains a set of space-delimited
2978
+ # values. Perhaps the most familiar example of this is the HTML "class" attribute used to
2979
+ # contain CSS classes. But other keyword attributes exist, for instance
2980
+ # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel].
2981
+ #
2982
+ # See also #classes, #kwattr_add, #kwattr_append, #kwattr_remove
2983
+ #
2984
+ # [Parameters]
2985
+ # - +attribute_name+ (String) The name of the keyword attribute to be inspected.
2986
+ #
2987
+ # [Returns]
2988
+ # (Array<String>) The values present in the Node's +attribute_name+ attribute. If the
2989
+ # attribute is empty or non-existent, the return value is an empty array.
2990
+ #
2991
+ # *Example:*
2992
+ #
2993
+ # node # => <a rel="nofollow noopener external">link</a>
2994
+ # node.kwattr_values("rel") # => ["nofollow", "noopener", "external"]
2995
+ #
2996
+ # Since v1.11.0
2997
+ def kwattr_values(attribute_name); end
2998
+
2999
+ def lang; end
3000
+ def lang=(_arg0); end
3001
+ def last_element_child; end
3002
+ def line; end
3003
+ def line=(_arg0); end
3004
+
3005
+ # Returns true if this Node matches +selector+
3006
+ #
3007
+ # @return [Boolean]
3008
+ def matches?(selector); end
3009
+
3010
+ def name; end
3011
+ def name=(_arg0); end
3012
+ def namespace; end
3013
+
3014
+ # Set the default namespace on this node (as would be defined with an
3015
+ # "xmlns=" attribute in XML source), as a Namespace object +ns+. Note that
3016
+ # a Namespace added this way will NOT be serialized as an xmlns attribute
3017
+ # for this node. You probably want #default_namespace= instead, or perhaps
3018
+ # #add_namespace_definition with a nil prefix argument.
3019
+ def namespace=(ns); end
3020
+
3021
+ def namespace_definitions; end
3022
+ def namespace_scopes; end
3023
+ def namespaced_key?(_arg0, _arg1); end
3024
+
3025
+ # :call-seq:
3026
+ # namespaces() → Hash<String(Namespace#prefix) ⇒ String(Namespace#href)>
3027
+ #
3028
+ # Fetch all the namespaces on this node and its ancestors.
3029
+ #
3030
+ # Note that the keys in this hash XML attributes that would be used to define this namespace,
3031
+ # such as "xmlns:prefix", not just the prefix.
3032
+ #
3033
+ # The default namespace for this node will be included with key "xmlns".
3034
+ #
3035
+ # See also #namespace_scopes
3036
+ #
3037
+ # [Returns]
3038
+ # Hash containing all the namespaces on this node and its ancestors. The hash keys are the
3039
+ # namespace prefix, and the hash value for each key is the namespace URI.
3040
+ #
3041
+ # *Example:*
3042
+ #
3043
+ # doc = Nokogiri::XML(<<~EOF)
3044
+ # <root xmlns="http://example.com/root" xmlns:in_scope="http://example.com/in_scope">
3045
+ # <first/>
3046
+ # <second xmlns="http://example.com/child"/>
3047
+ # <third xmlns:foo="http://example.com/foo"/>
3048
+ # </root>
3049
+ # EOF
3050
+ # doc.at_xpath("//root:first", "root" => "http://example.com/root").namespaces
3051
+ # # => {"xmlns"=>"http://example.com/root",
3052
+ # # "xmlns:in_scope"=>"http://example.com/in_scope"}
3053
+ # doc.at_xpath("//child:second", "child" => "http://example.com/child").namespaces
3054
+ # # => {"xmlns"=>"http://example.com/child",
3055
+ # # "xmlns:in_scope"=>"http://example.com/in_scope"}
3056
+ # doc.at_xpath("//root:third", "root" => "http://example.com/root").namespaces
3057
+ # # => {"xmlns:foo"=>"http://example.com/foo",
3058
+ # # "xmlns"=>"http://example.com/root",
3059
+ # # "xmlns:in_scope"=>"http://example.com/in_scope"}
3060
+ def namespaces; end
3061
+
3062
+ def native_content=(_arg0); end
3063
+ def next; end
3064
+
3065
+ # Insert +node_or_tags+ after this Node (as a sibling).
3066
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
3067
+ #
3068
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
3069
+ #
3070
+ # Also see related method +after+.
3071
+ #
3072
+ # @raise [ArgumentError]
3073
+ def next=(node_or_tags); end
3074
+
3075
+ def next_element; end
3076
+ def next_sibling; end
3077
+ def node_name; end
3078
+ def node_name=(_arg0); end
3079
+ def node_type; end
3080
+ def parent; end
3081
+
3082
+ # Set the parent Node for this Node
3083
+ def parent=(parent_node); end
3084
+
3085
+ # Parse +string_or_io+ as a document fragment within the context of
3086
+ # *this* node. Returns a XML::NodeSet containing the nodes parsed from
3087
+ # +string_or_io+.
3088
+ #
3089
+ # @yield [options]
3090
+ def parse(string_or_io, options = T.unsafe(nil)); end
3091
+
3092
+ def path; end
3093
+ def pointer_id; end
3094
+
3095
+ # Add +node_or_tags+ as the first child of this Node.
3096
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
3097
+ #
3098
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
3099
+ #
3100
+ # Also see related method +add_child+.
3101
+ def prepend_child(node_or_tags); end
3102
+
3103
+ def previous; end
3104
+
3105
+ # Insert +node_or_tags+ before this Node (as a sibling).
3106
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
3107
+ #
3108
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
3109
+ #
3110
+ # Also see related method +before+.
3111
+ #
3112
+ # @raise [ArgumentError]
3113
+ def previous=(node_or_tags); end
3114
+
3115
+ def previous_element; end
3116
+ def previous_sibling; end
3117
+
3118
+ # Returns true if this is a ProcessingInstruction node
3119
+ #
3120
+ # @return [Boolean]
3121
+ def processing_instruction?; end
3122
+
3123
+ # Is this a read only node?
3124
+ #
3125
+ # @return [Boolean]
3126
+ def read_only?; end
3127
+
3128
+ def remove; end
3129
+
3130
+ # Remove the attribute named +name+
3131
+ def remove_attribute(name); end
3132
+
3133
+ # :call-seq:
3134
+ # remove_class(css_classes) → self
3135
+ #
3136
+ # Remove HTML CSS classes from this node. Any CSS class names in +css_classes+ that exist in
3137
+ # this node's "class" attribute are removed, including any multiple entries.
3138
+ #
3139
+ # If no CSS classes remain after this operation, or if +css_classes+ is +nil+, the "class"
3140
+ # attribute is deleted from the node.
3141
+ #
3142
+ # This is a convenience function and is equivalent to:
3143
+ #
3144
+ # node.kwattr_remove("class", css_classes)
3145
+ #
3146
+ # Also see #kwattr_remove, #classes, #add_class, #append_class
3147
+ #
3148
+ # [Parameters]
3149
+ # - +css_classes+ (String, Array<String>)
3150
+ #
3151
+ # CSS class names to be removed from the Node's
3152
+ # "class" attribute. May be a string containing whitespace-delimited names, or an Array of
3153
+ # String names. Any class names already present will be removed. If no CSS classes remain,
3154
+ # the "class" attribute is deleted.
3155
+ #
3156
+ # [Returns] +self+ (Nokogiri::XML::Node) for ease of chaining method calls.
3157
+ #
3158
+ # *Example*: Deleting a CSS class
3159
+ #
3160
+ # Note that all instances of the class "section" are removed from the "class" attribute.
3161
+ #
3162
+ # node # => <div class="section header section"></div>
3163
+ # node.remove_class("section") # => <div class="header"></div>
3164
+ #
3165
+ # *Example*: Deleting the only remaining CSS class
3166
+ #
3167
+ # Note that the attribute is removed once there are no remaining classes.
3168
+ #
3169
+ # node # => <div class="section"></div>
3170
+ # node.remove_class("section") # => <div></div>
3171
+ #
3172
+ # *Example*: Deleting multiple CSS classes
3173
+ #
3174
+ # Note that the "class" attribute is deleted once it's empty.
3175
+ #
3176
+ # node # => <div class="section header float"></div>
3177
+ # node.remove_class(["section", "float"]) # => <div class="header"></div>
3178
+ def remove_class(names = T.unsafe(nil)); end
3179
+
3180
+ # Replace this Node with +node_or_tags+.
3181
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
3182
+ #
3183
+ # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string).
3184
+ #
3185
+ # Also see related method +swap+.
3186
+ def replace(node_or_tags); end
3187
+
3188
+ # Serialize Node using +options+. Save options can also be set using a block.
3189
+ #
3190
+ # See also Nokogiri::XML::Node::SaveOptions and Node@Serialization+and+Generating+Output.
3191
+ #
3192
+ # These two statements are equivalent:
3193
+ #
3194
+ # node.serialize(:encoding => 'UTF-8', :save_with => FORMAT | AS_XML)
3195
+ #
3196
+ # or
3197
+ #
3198
+ # node.serialize(:encoding => 'UTF-8') do |config|
3199
+ # config.format.as_xml
3200
+ # end
3201
+ def serialize(*args, &block); end
3202
+
3203
+ # :call-seq: []=(name, value) → value
3204
+ #
3205
+ # Update the attribute +name+ to +value+, or create the attribute if it does not exist.
3206
+ #
3207
+ # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access
3208
+ # namespaced attributes for update, use #attribute_with_ns. To add a namespaced attribute,
3209
+ # see the example below.
3210
+ #
3211
+ # [Returns] +value+
3212
+ #
3213
+ # *Example*
3214
+ #
3215
+ # doc = Nokogiri::XML("<root><child/></root>")
3216
+ # child = doc.at_css("child")
3217
+ # child["size"] = "broad"
3218
+ # child.to_html
3219
+ # # => "<child size=\"broad\"></child>"
3220
+ #
3221
+ # *Example:* Add a namespaced attribute.
3222
+ #
3223
+ # doc = Nokogiri::XML(<<~EOF)
3224
+ # <root xmlns:width='http://example.com/widths'>
3225
+ # <child/>
3226
+ # </root>
3227
+ # EOF
3228
+ # child = doc.at_css("child")
3229
+ # child["size"] = "broad"
3230
+ # ns = doc.root.namespace_definitions.find { |ns| ns.prefix == "width" }
3231
+ # child.attribute("size").namespace = ns
3232
+ # doc.to_html
3233
+ # # => "<root xmlns:width=\"http://example.com/widths\">\n" +
3234
+ # # " <child width:size=\"broad\"></child>\n" +
3235
+ # # "</root>\n"
3236
+ def set_attribute(name, value); end
3237
+
3238
+ # Swap this Node for +node_or_tags+
3239
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
3240
+ #
3241
+ # Returns self, to support chaining of calls.
3242
+ #
3243
+ # Also see related method +replace+.
3244
+ def swap(node_or_tags); end
3245
+
3246
+ def text; end
3247
+
3248
+ # Returns true if this is a Text node
3249
+ #
3250
+ # @return [Boolean]
3251
+ def text?; end
3252
+
3253
+ # Serialize this Node to HTML
3254
+ #
3255
+ # doc.to_html
3256
+ #
3257
+ # See Node#write_to for a list of +options+. For formatted output,
3258
+ # use Node#to_xhtml instead.
3259
+ def to_html(options = T.unsafe(nil)); end
3260
+
3261
+ # Turn this node in to a string. If the document is HTML, this method
3262
+ # returns html. If the document is XML, this method returns XML.
3263
+ def to_s; end
3264
+
3265
+ def to_str; end
3266
+
3267
+ # Serialize this Node to XHTML using +options+
3268
+ #
3269
+ # doc.to_xhtml(:indent => 5, :encoding => 'UTF-8')
3270
+ #
3271
+ # See Node#write_to for a list of +options+
3272
+ def to_xhtml(options = T.unsafe(nil)); end
3273
+
3274
+ # Serialize this Node to XML using +options+
3275
+ #
3276
+ # doc.to_xml(:indent => 5, :encoding => 'UTF-8')
3277
+ #
3278
+ # See Node#write_to for a list of +options+
3279
+ def to_xml(options = T.unsafe(nil)); end
3280
+
3281
+ # Yields self and all children to +block+ recursively.
3282
+ #
3283
+ # @yield [_self]
3284
+ # @yieldparam _self [Nokogiri::XML::Node] the object that the method was called on
3285
+ def traverse(&block); end
3286
+
3287
+ def type; end
3288
+ def unlink; end
3289
+
3290
+ # Does this Node's attributes include <value>
3291
+ #
3292
+ # @return [Boolean]
3293
+ def value?(value); end
3294
+
3295
+ # Get the attribute values for this Node.
3296
+ def values; end
3297
+
3298
+ # Add html around this node
3299
+ #
3300
+ # Returns self
3301
+ def wrap(html); end
3302
+
3303
+ # Write Node as HTML to +io+ with +options+
3304
+ #
3305
+ # See Node#write_to for a list of +options+
3306
+ def write_html_to(io, options = T.unsafe(nil)); end
3307
+
3308
+ # Write Node to +io+ with +options+. +options+ modify the output of
3309
+ # this method. Valid options are:
3310
+ #
3311
+ # * +:encoding+ for changing the encoding
3312
+ # * +:indent_text+ the indentation text, defaults to one space
3313
+ # * +:indent+ the number of +:indent_text+ to use, defaults to 2
3314
+ # * +:save_with+ a combination of SaveOptions constants.
3315
+ #
3316
+ # To save with UTF-8 indented twice:
3317
+ #
3318
+ # node.write_to(io, :encoding => 'UTF-8', :indent => 2)
3319
+ #
3320
+ # To save indented with two dashes:
3321
+ #
3322
+ # node.write_to(io, :indent_text => '-', :indent => 2)
3323
+ #
3324
+ # @yield [config]
3325
+ def write_to(io, *options); end
3326
+
3327
+ # Write Node as XHTML to +io+ with +options+
3328
+ #
3329
+ # See Node#write_to for a list of +options+
3330
+ def write_xhtml_to(io, options = T.unsafe(nil)); end
3331
+
3332
+ # Write Node as XML to +io+ with +options+
3333
+ #
3334
+ # doc.write_xml_to io, :encoding => 'UTF-8'
3335
+ #
3336
+ # See Node#write_to for a list of options
3337
+ def write_xml_to(io, options = T.unsafe(nil)); end
3338
+
3339
+ # Returns true if this is an XML::Document node
3340
+ #
3341
+ # @return [Boolean]
3342
+ def xml?; end
3343
+
3344
+ protected
3345
+
3346
+ # @raise [ArgumentError]
3347
+ def coerce(data); end
3348
+
3349
+ private
3350
+
3351
+ def add_child_node(_arg0); end
3352
+ def add_child_node_and_reparent_attrs(node); end
3353
+ def add_next_sibling_node(_arg0); end
3354
+ def add_previous_sibling_node(_arg0); end
3355
+ def add_sibling(next_or_previous, node_or_tags); end
3356
+ def compare(_arg0); end
3357
+ def dump_html; end
3358
+ def get(_arg0); end
3359
+ def in_context(_arg0, _arg1); end
3360
+ def inspect_attributes; end
3361
+ def keywordify(keywords); end
3362
+ def native_write_to(_arg0, _arg1, _arg2, _arg3); end
3363
+ def process_xincludes(_arg0); end
3364
+ def replace_node(_arg0); end
3365
+ def set(_arg0, _arg1); end
3366
+ def set_namespace(_arg0); end
3367
+ def to_format(save_option, options); end
3368
+ def write_format_to(save_option, io, options); end
3369
+
3370
+ class << self
3371
+ def new(*_arg0); end
3372
+ end
3373
+ end
3374
+
3375
+ # Attribute declaration type
3376
+ Nokogiri::XML::Node::ATTRIBUTE_DECL = T.let(T.unsafe(nil), Integer)
3377
+
3378
+ # Attribute node type
3379
+ Nokogiri::XML::Node::ATTRIBUTE_NODE = T.let(T.unsafe(nil), Integer)
3380
+
3381
+ # CDATA node type, see Nokogiri::XML::Node#cdata?
3382
+ Nokogiri::XML::Node::CDATA_SECTION_NODE = T.let(T.unsafe(nil), Integer)
3383
+
3384
+ # Comment node type, see Nokogiri::XML::Node#comment?
3385
+ Nokogiri::XML::Node::COMMENT_NODE = T.let(T.unsafe(nil), Integer)
3386
+
3387
+ # DOCB document node type
3388
+ Nokogiri::XML::Node::DOCB_DOCUMENT_NODE = T.let(T.unsafe(nil), Integer)
3389
+
3390
+ # Document fragment node type
3391
+ Nokogiri::XML::Node::DOCUMENT_FRAG_NODE = T.let(T.unsafe(nil), Integer)
3392
+
3393
+ # Document node type, see Nokogiri::XML::Node#xml?
3394
+ Nokogiri::XML::Node::DOCUMENT_NODE = T.let(T.unsafe(nil), Integer)
3395
+
3396
+ # Document type node type
3397
+ Nokogiri::XML::Node::DOCUMENT_TYPE_NODE = T.let(T.unsafe(nil), Integer)
3398
+
3399
+ # DTD node type
3400
+ Nokogiri::XML::Node::DTD_NODE = T.let(T.unsafe(nil), Integer)
3401
+
3402
+ # Element declaration type
3403
+ Nokogiri::XML::Node::ELEMENT_DECL = T.let(T.unsafe(nil), Integer)
3404
+
3405
+ # Element node type, see Nokogiri::XML::Node#element?
3406
+ Nokogiri::XML::Node::ELEMENT_NODE = T.let(T.unsafe(nil), Integer)
3407
+
3408
+ # Entity declaration type
3409
+ Nokogiri::XML::Node::ENTITY_DECL = T.let(T.unsafe(nil), Integer)
3410
+
3411
+ # Entity node type
3412
+ Nokogiri::XML::Node::ENTITY_NODE = T.let(T.unsafe(nil), Integer)
3413
+
3414
+ # Entity reference node type
3415
+ Nokogiri::XML::Node::ENTITY_REF_NODE = T.let(T.unsafe(nil), Integer)
3416
+
3417
+ # HTML document node type, see Nokogiri::XML::Node#html?
3418
+ Nokogiri::XML::Node::HTML_DOCUMENT_NODE = T.let(T.unsafe(nil), Integer)
3419
+
3420
+ Nokogiri::XML::Node::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
3421
+
3422
+ # Namespace declaration type
3423
+ Nokogiri::XML::Node::NAMESPACE_DECL = T.let(T.unsafe(nil), Integer)
3424
+
3425
+ # Notation node type
3426
+ Nokogiri::XML::Node::NOTATION_NODE = T.let(T.unsafe(nil), Integer)
3427
+
3428
+ # PI node type
3429
+ Nokogiri::XML::Node::PI_NODE = T.let(T.unsafe(nil), Integer)
3430
+
3431
+ # Save options for serializing nodes.
3432
+ # See the method group entitled Node@Serialization+and+Generating+Output for usage.
3433
+ class Nokogiri::XML::Node::SaveOptions
3434
+ # Create a new SaveOptions object with +options+
3435
+ #
3436
+ # @return [SaveOptions] a new instance of SaveOptions
3437
+ def initialize(options = T.unsafe(nil)); end
3438
+
3439
+ def as_html; end
3440
+ def as_html?; end
3441
+ def as_xhtml; end
3442
+ def as_xhtml?; end
3443
+ def as_xml; end
3444
+ def as_xml?; end
3445
+ def default_html; end
3446
+ def default_html?; end
3447
+ def default_xhtml; end
3448
+ def default_xhtml?; end
3449
+ def default_xml; end
3450
+ def default_xml?; end
3451
+ def format; end
3452
+ def format?; end
3453
+ def no_declaration; end
3454
+ def no_declaration?; end
3455
+ def no_empty_tags; end
3456
+ def no_empty_tags?; end
3457
+ def no_xhtml; end
3458
+ def no_xhtml?; end
3459
+
3460
+ # Integer representation of the SaveOptions
3461
+ def options; end
3462
+
3463
+ # Integer representation of the SaveOptions
3464
+ def to_i; end
3465
+ end
3466
+
3467
+ # Save as HTML
3468
+ Nokogiri::XML::Node::SaveOptions::AS_HTML = T.let(T.unsafe(nil), Integer)
3469
+
3470
+ # Save as XHTML
3471
+ Nokogiri::XML::Node::SaveOptions::AS_XHTML = T.let(T.unsafe(nil), Integer)
3472
+
3473
+ # Save as XML
3474
+ Nokogiri::XML::Node::SaveOptions::AS_XML = T.let(T.unsafe(nil), Integer)
3475
+
3476
+ # the default for HTML document
3477
+ Nokogiri::XML::Node::SaveOptions::DEFAULT_HTML = T.let(T.unsafe(nil), Integer)
3478
+
3479
+ # the default for XHTML document
3480
+ Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML = T.let(T.unsafe(nil), Integer)
3481
+
3482
+ # the default for XML documents
3483
+ Nokogiri::XML::Node::SaveOptions::DEFAULT_XML = T.let(T.unsafe(nil), Integer)
3484
+
3485
+ # Format serialized xml
3486
+ Nokogiri::XML::Node::SaveOptions::FORMAT = T.let(T.unsafe(nil), Integer)
3487
+
3488
+ # Do not include declarations
3489
+ Nokogiri::XML::Node::SaveOptions::NO_DECLARATION = T.let(T.unsafe(nil), Integer)
3490
+
3491
+ # Do not include empty tags
3492
+ Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS = T.let(T.unsafe(nil), Integer)
3493
+
3494
+ # Do not save XHTML
3495
+ Nokogiri::XML::Node::SaveOptions::NO_XHTML = T.let(T.unsafe(nil), Integer)
3496
+
3497
+ # Text node type, see Nokogiri::XML::Node#text?
3498
+ Nokogiri::XML::Node::TEXT_NODE = T.let(T.unsafe(nil), Integer)
3499
+
3500
+ # XInclude end type
3501
+ Nokogiri::XML::Node::XINCLUDE_END = T.let(T.unsafe(nil), Integer)
3502
+
3503
+ # XInclude start type
3504
+ Nokogiri::XML::Node::XINCLUDE_START = T.let(T.unsafe(nil), Integer)
3505
+
3506
+ # A NodeSet contains a list of Nokogiri::XML::Node objects. Typically
3507
+ # a NodeSet is return as a result of searching a Document via
3508
+ # Nokogiri::XML::Searchable#css or Nokogiri::XML::Searchable#xpath
3509
+ class Nokogiri::XML::NodeSet
3510
+ include ::Nokogiri::XML::Searchable
3511
+ include ::Enumerable
3512
+
3513
+ # Create a NodeSet with +document+ defaulting to +list+
3514
+ #
3515
+ # @return [NodeSet] a new instance of NodeSet
3516
+ # @yield [_self]
3517
+ # @yieldparam _self [Nokogiri::XML::NodeSet] the object that the method was called on
3518
+ def initialize(document, list = T.unsafe(nil)); end
3519
+
3520
+ # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
3521
+ #
3522
+ # Search this object for +paths+, and return only the first
3523
+ # result. +paths+ must be one or more XPath or CSS queries.
3524
+ #
3525
+ # See Searchable#search for more information.
3526
+ #
3527
+ # Or, if passed an integer, index into the NodeSet:
3528
+ #
3529
+ # node_set.at(3) # same as node_set[3]
3530
+ def %(*args); end
3531
+
3532
+ def &(_arg0); end
3533
+ def +(_arg0); end
3534
+ def -(_arg0); end
3535
+ def <<(_arg0); end
3536
+
3537
+ # Equality -- Two NodeSets are equal if the contain the same number
3538
+ # of elements and if each element is equal to the corresponding
3539
+ # element in the other NodeSet
3540
+ def ==(other); end
3541
+
3542
+ def [](*_arg0); end
3543
+
3544
+ # Add the class attribute +name+ to all Node objects in the
3545
+ # NodeSet.
3546
+ #
3547
+ # See Nokogiri::XML::Node#add_class for more information.
3548
+ def add_class(name); end
3549
+
3550
+ # Insert +datum+ after the last Node in this NodeSet
3551
+ def after(datum); end
3552
+
3553
+ # Append the class attribute +name+ to all Node objects in the
3554
+ # NodeSet.
3555
+ #
3556
+ # See Nokogiri::XML::Node#append_class for more information.
3557
+ def append_class(name); end
3558
+
3559
+ # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
3560
+ #
3561
+ # Search this object for +paths+, and return only the first
3562
+ # result. +paths+ must be one or more XPath or CSS queries.
3563
+ #
3564
+ # See Searchable#search for more information.
3565
+ #
3566
+ # Or, if passed an integer, index into the NodeSet:
3567
+ #
3568
+ # node_set.at(3) # same as node_set[3]
3569
+ def at(*args); end
3570
+
3571
+ # Set attributes on each Node in the NodeSet, or get an
3572
+ # attribute from the first Node in the NodeSet.
3573
+ #
3574
+ # To get an attribute from the first Node in a NodeSet:
3575
+ #
3576
+ # node_set.attr("href") # => "https://www.nokogiri.org"
3577
+ #
3578
+ # Note that an empty NodeSet will return nil when +#attr+ is called as a getter.
3579
+ #
3580
+ # To set an attribute on each node, +key+ can either be an
3581
+ # attribute name, or a Hash of attribute names and values. When
3582
+ # called as a setter, +#attr+ returns the NodeSet.
3583
+ #
3584
+ # If +key+ is an attribute name, then either +value+ or +block+
3585
+ # must be passed.
3586
+ #
3587
+ # If +key+ is a Hash then attributes will be set for each
3588
+ # key/value pair:
3589
+ #
3590
+ # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member")
3591
+ #
3592
+ # If +value+ is passed, it will be used as the attribute value
3593
+ # for all nodes:
3594
+ #
3595
+ # node_set.attr("href", "https://www.nokogiri.org")
3596
+ #
3597
+ # If +block+ is passed, it will be called on each Node object in
3598
+ # the NodeSet and the return value used as the attribute value
3599
+ # for that node:
3600
+ #
3601
+ # node_set.attr("class") { |node| node.name }
3602
+ def attr(key, value = T.unsafe(nil), &block); end
3603
+
3604
+ # Set attributes on each Node in the NodeSet, or get an
3605
+ # attribute from the first Node in the NodeSet.
3606
+ #
3607
+ # To get an attribute from the first Node in a NodeSet:
3608
+ #
3609
+ # node_set.attr("href") # => "https://www.nokogiri.org"
3610
+ #
3611
+ # Note that an empty NodeSet will return nil when +#attr+ is called as a getter.
3612
+ #
3613
+ # To set an attribute on each node, +key+ can either be an
3614
+ # attribute name, or a Hash of attribute names and values. When
3615
+ # called as a setter, +#attr+ returns the NodeSet.
3616
+ #
3617
+ # If +key+ is an attribute name, then either +value+ or +block+
3618
+ # must be passed.
3619
+ #
3620
+ # If +key+ is a Hash then attributes will be set for each
3621
+ # key/value pair:
3622
+ #
3623
+ # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member")
3624
+ #
3625
+ # If +value+ is passed, it will be used as the attribute value
3626
+ # for all nodes:
3627
+ #
3628
+ # node_set.attr("href", "https://www.nokogiri.org")
3629
+ #
3630
+ # If +block+ is passed, it will be called on each Node object in
3631
+ # the NodeSet and the return value used as the attribute value
3632
+ # for that node:
3633
+ #
3634
+ # node_set.attr("class") { |node| node.name }
3635
+ def attribute(key, value = T.unsafe(nil), &block); end
3636
+
3637
+ # Insert +datum+ before the first Node in this NodeSet
3638
+ def before(datum); end
3639
+
3640
+ # Returns a new NodeSet containing all the children of all the nodes in
3641
+ # the NodeSet
3642
+ def children; end
3643
+
3644
+ def clone; end
3645
+
3646
+ # call-seq: css *rules, [namespace-bindings, custom-pseudo-class]
3647
+ #
3648
+ # Search this node set for CSS +rules+. +rules+ must be one or more CSS
3649
+ # selectors. For example:
3650
+ #
3651
+ # For more information see Nokogiri::XML::Searchable#css
3652
+ def css(*args); end
3653
+
3654
+ def delete(_arg0); end
3655
+
3656
+ # The Document this NodeSet is associated with
3657
+ def document; end
3658
+
3659
+ # The Document this NodeSet is associated with
3660
+ def document=(_arg0); end
3661
+
3662
+ def dup; end
3663
+
3664
+ # Iterate over each node, yielding to +block+
3665
+ def each; end
3666
+
3667
+ # Is this NodeSet empty?
3668
+ #
3669
+ # @return [Boolean]
3670
+ def empty?; end
3671
+
3672
+ # Filter this list for nodes that match +expr+
3673
+ def filter(expr); end
3674
+
3675
+ # Get the first element of the NodeSet.
3676
+ def first(n = T.unsafe(nil)); end
3677
+
3678
+ def include?(_arg0); end
3679
+
3680
+ # Returns the index of the first node in self that is == to +node+ or meets the given block. Returns nil if no match is found.
3681
+ def index(node = T.unsafe(nil)); end
3682
+
3683
+ # Get the inner html of all contained Node objects
3684
+ def inner_html(*args); end
3685
+
3686
+ # Get the inner text of all contained Node objects
3687
+ #
3688
+ # Note: This joins the text of all Node objects in the NodeSet:
3689
+ #
3690
+ # doc = Nokogiri::XML('<xml><a><d>foo</d><d>bar</d></a></xml>')
3691
+ # doc.css('d').text # => "foobar"
3692
+ #
3693
+ # Instead, if you want to return the text of all nodes in the NodeSet:
3694
+ #
3695
+ # doc.css('d').map(&:text) # => ["foo", "bar"]
3696
+ #
3697
+ # See Nokogiri::XML::Node#content for more information.
3698
+ def inner_text; end
3699
+
3700
+ # Return a nicely formated string representation
3701
+ def inspect; end
3702
+
3703
+ # Get the last element of the NodeSet.
3704
+ def last; end
3705
+
3706
+ def length; end
3707
+
3708
+ # Removes the last element from set and returns it, or +nil+ if
3709
+ # the set is empty
3710
+ def pop; end
3711
+
3712
+ def push(_arg0); end
3713
+ def remove; end
3714
+
3715
+ # Remove the attributed named +name+ from all Node objects in the NodeSet
3716
+ def remove_attr(name); end
3717
+
3718
+ # Remove the attributed named +name+ from all Node objects in the NodeSet
3719
+ def remove_attribute(name); end
3720
+
3721
+ # Remove the class attribute +name+ from all Node objects in the
3722
+ # NodeSet.
3723
+ #
3724
+ # See Nokogiri::XML::Node#remove_class for more information.
3725
+ def remove_class(name = T.unsafe(nil)); end
3726
+
3727
+ # Returns a new NodeSet containing all the nodes in the NodeSet
3728
+ # in reverse order
3729
+ def reverse; end
3730
+
3731
+ # Set attributes on each Node in the NodeSet, or get an
3732
+ # attribute from the first Node in the NodeSet.
3733
+ #
3734
+ # To get an attribute from the first Node in a NodeSet:
3735
+ #
3736
+ # node_set.attr("href") # => "https://www.nokogiri.org"
3737
+ #
3738
+ # Note that an empty NodeSet will return nil when +#attr+ is called as a getter.
3739
+ #
3740
+ # To set an attribute on each node, +key+ can either be an
3741
+ # attribute name, or a Hash of attribute names and values. When
3742
+ # called as a setter, +#attr+ returns the NodeSet.
3743
+ #
3744
+ # If +key+ is an attribute name, then either +value+ or +block+
3745
+ # must be passed.
3746
+ #
3747
+ # If +key+ is a Hash then attributes will be set for each
3748
+ # key/value pair:
3749
+ #
3750
+ # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member")
3751
+ #
3752
+ # If +value+ is passed, it will be used as the attribute value
3753
+ # for all nodes:
3754
+ #
3755
+ # node_set.attr("href", "https://www.nokogiri.org")
3756
+ #
3757
+ # If +block+ is passed, it will be called on each Node object in
3758
+ # the NodeSet and the return value used as the attribute value
3759
+ # for that node:
3760
+ #
3761
+ # node_set.attr("class") { |node| node.name }
3762
+ def set(key, value = T.unsafe(nil), &block); end
3763
+
3764
+ # Returns the first element of the NodeSet and removes it. Returns
3765
+ # +nil+ if the set is empty.
3766
+ def shift; end
3767
+
3768
+ def size; end
3769
+ def slice(*_arg0); end
3770
+
3771
+ # Get the inner text of all contained Node objects
3772
+ #
3773
+ # Note: This joins the text of all Node objects in the NodeSet:
3774
+ #
3775
+ # doc = Nokogiri::XML('<xml><a><d>foo</d><d>bar</d></a></xml>')
3776
+ # doc.css('d').text # => "foobar"
3777
+ #
3778
+ # Instead, if you want to return the text of all nodes in the NodeSet:
3779
+ #
3780
+ # doc.css('d').map(&:text) # => ["foo", "bar"]
3781
+ #
3782
+ # See Nokogiri::XML::Node#content for more information.
3783
+ def text; end
3784
+
3785
+ def to_a; end
3786
+ def to_ary; end
3787
+
3788
+ # Convert this NodeSet to HTML
3789
+ def to_html(*args); end
3790
+
3791
+ # Convert this NodeSet to a string.
3792
+ def to_s; end
3793
+
3794
+ # Convert this NodeSet to XHTML
3795
+ def to_xhtml(*args); end
3796
+
3797
+ # Convert this NodeSet to XML
3798
+ def to_xml(*args); end
3799
+
3800
+ def unlink; end
3801
+
3802
+ # Wrap this NodeSet with +html+
3803
+ def wrap(html); end
3804
+
3805
+ # call-seq: xpath *paths, [namespace-bindings, variable-bindings, custom-handler-class]
3806
+ #
3807
+ # Search this node set for XPath +paths+. +paths+ must be one or more XPath
3808
+ # queries.
3809
+ #
3810
+ # For more information see Nokogiri::XML::Searchable#xpath
3811
+ def xpath(*args); end
3812
+
3813
+ def |(_arg0); end
3814
+ end
3815
+
3816
+ Nokogiri::XML::NodeSet::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
3817
+
3818
+ # Struct representing an {XML Schema Notation}[https://www.w3.org/TR/xml/#Notations]
3819
+ class Nokogiri::XML::Notation < ::Struct; end
3820
+
3821
+ module Nokogiri::XML::PP; end
3822
+
3823
+ module Nokogiri::XML::PP::CharacterData
3824
+ def inspect; end
3825
+ def pretty_print(pp); end
3826
+ end
3827
+
3828
+ module Nokogiri::XML::PP::Node
3829
+ def inspect; end
3830
+ def pretty_print(pp); end
3831
+ end
3832
+
3833
+ # Parse options for passing to Nokogiri.XML or Nokogiri.HTML
3834
+ #
3835
+ # == Building combinations of parse options
3836
+ # You can build your own combinations of these parse options by using any of the following methods:
3837
+ # *Note*: All examples attempt to set the +RECOVER+ & +NOENT+ options.
3838
+ # [Ruby's bitwise operators] You can use the Ruby bitwise operators to set various combinations.
3839
+ # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
3840
+ # [Method chaining] Every option has an equivalent method in lowercase. You can chain these methods together to set various combinations.
3841
+ # Nokogiri.XML('<content>Chapter 1</content', nil, nil, Nokogiri::XML::ParseOptions.new.recover.noent)
3842
+ # [Using Ruby Blocks] You can also setup parse combinations in the block passed to Nokogiri.XML or Nokogiri.HTML
3843
+ # Nokogiri.XML('<content>Chapter 1</content') {|config| config.recover.noent}
3844
+ #
3845
+ # == Removing particular parse options
3846
+ # You can also remove options from an instance of +ParseOptions+ dynamically.
3847
+ # Every option has an equivalent <code>no{option}</code> method in lowercase. You can call these methods on an instance of +ParseOptions+ to remove the option.
3848
+ # Note that this is not available for +STRICT+.
3849
+ #
3850
+ # # Setting the RECOVER & NOENT options...
3851
+ # options = Nokogiri::XML::ParseOptions.new.recover.noent
3852
+ # # later...
3853
+ # options.norecover # Removes the Nokogiri::XML::ParseOptions::RECOVER option
3854
+ # options.nonoent # Removes the Nokogiri::XML::ParseOptions::NOENT option
3855
+ class Nokogiri::XML::ParseOptions
3856
+ # @return [ParseOptions] a new instance of ParseOptions
3857
+ def initialize(options = T.unsafe(nil)); end
3858
+
3859
+ def ==(other); end
3860
+ def big_lines; end
3861
+ def big_lines?; end
3862
+ def compact; end
3863
+ def compact?; end
3864
+ def default_html; end
3865
+ def default_html?; end
3866
+ def default_schema; end
3867
+ def default_schema?; end
3868
+ def default_xml; end
3869
+ def default_xml?; end
3870
+ def default_xslt; end
3871
+ def default_xslt?; end
3872
+ def dtdattr; end
3873
+ def dtdattr?; end
3874
+ def dtdload; end
3875
+ def dtdload?; end
3876
+ def dtdvalid; end
3877
+ def dtdvalid?; end
3878
+ def huge; end
3879
+ def huge?; end
3880
+ def inspect; end
3881
+ def nobasefix; end
3882
+ def nobasefix?; end
3883
+ def nobig_lines; end
3884
+ def noblanks; end
3885
+ def noblanks?; end
3886
+ def nocdata; end
3887
+ def nocdata?; end
3888
+ def nocompact; end
3889
+ def nodefault_html; end
3890
+ def nodefault_schema; end
3891
+ def nodefault_xml; end
3892
+ def nodefault_xslt; end
3893
+ def nodict; end
3894
+ def nodict?; end
3895
+ def nodtdattr; end
3896
+ def nodtdload; end
3897
+ def nodtdvalid; end
3898
+ def noent; end
3899
+ def noent?; end
3900
+ def noerror; end
3901
+ def noerror?; end
3902
+ def nohuge; end
3903
+ def nonet; end
3904
+ def nonet?; end
3905
+ def nonobasefix; end
3906
+ def nonoblanks; end
3907
+ def nonocdata; end
3908
+ def nonodict; end
3909
+ def nonoent; end
3910
+ def nonoerror; end
3911
+ def nononet; end
3912
+ def nonowarning; end
3913
+ def nonoxincnode; end
3914
+ def nonsclean; end
3915
+ def noold10; end
3916
+ def nopedantic; end
3917
+ def norecover; end
3918
+ def nosax1; end
3919
+ def nowarning; end
3920
+ def nowarning?; end
3921
+ def noxinclude; end
3922
+ def noxincnode; end
3923
+ def noxincnode?; end
3924
+ def nsclean; end
3925
+ def nsclean?; end
3926
+ def old10; end
3927
+ def old10?; end
3928
+
3929
+ # Returns the value of attribute options.
3930
+ def options; end
3931
+
3932
+ # Sets the attribute options
3933
+ #
3934
+ # @param value the value to set the attribute options to.
3935
+ def options=(_arg0); end
3936
+
3937
+ def pedantic; end
3938
+ def pedantic?; end
3939
+ def recover; end
3940
+ def recover?; end
3941
+ def sax1; end
3942
+ def sax1?; end
3943
+ def strict; end
3944
+
3945
+ # @return [Boolean]
3946
+ def strict?; end
3947
+
3948
+ # Returns the value of attribute options.
3949
+ def to_i; end
3950
+
3951
+ def xinclude; end
3952
+ def xinclude?; end
3953
+ end
3954
+
3955
+ # line numbers stored as long int (instead of a short int)
3956
+ Nokogiri::XML::ParseOptions::BIG_LINES = T.let(T.unsafe(nil), Integer)
3957
+
3958
+ # compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
3959
+ Nokogiri::XML::ParseOptions::COMPACT = T.let(T.unsafe(nil), Integer)
3960
+
3961
+ # the default options used for parsing HTML documents
3962
+ Nokogiri::XML::ParseOptions::DEFAULT_HTML = T.let(T.unsafe(nil), Integer)
3963
+
3964
+ # the default options used for parsing XML schemas
3965
+ Nokogiri::XML::ParseOptions::DEFAULT_SCHEMA = T.let(T.unsafe(nil), Integer)
3966
+
3967
+ # the default options used for parsing XML documents
3968
+ Nokogiri::XML::ParseOptions::DEFAULT_XML = T.let(T.unsafe(nil), Integer)
3969
+
3970
+ # the default options used for parsing XSLT stylesheets
3971
+ Nokogiri::XML::ParseOptions::DEFAULT_XSLT = T.let(T.unsafe(nil), Integer)
3972
+
3973
+ # Default DTD attributes
3974
+ Nokogiri::XML::ParseOptions::DTDATTR = T.let(T.unsafe(nil), Integer)
3975
+
3976
+ # Load external subsets
3977
+ Nokogiri::XML::ParseOptions::DTDLOAD = T.let(T.unsafe(nil), Integer)
3978
+
3979
+ # validate with the DTD
3980
+ Nokogiri::XML::ParseOptions::DTDVALID = T.let(T.unsafe(nil), Integer)
3981
+
3982
+ # relax any hardcoded limit from the parser
3983
+ Nokogiri::XML::ParseOptions::HUGE = T.let(T.unsafe(nil), Integer)
3984
+
3985
+ # do not fixup XINCLUDE xml:base uris
3986
+ Nokogiri::XML::ParseOptions::NOBASEFIX = T.let(T.unsafe(nil), Integer)
3987
+
3988
+ # remove blank nodes
3989
+ Nokogiri::XML::ParseOptions::NOBLANKS = T.let(T.unsafe(nil), Integer)
3990
+
3991
+ # merge CDATA as text nodes
3992
+ Nokogiri::XML::ParseOptions::NOCDATA = T.let(T.unsafe(nil), Integer)
3993
+
3994
+ # Do not reuse the context dictionary
3995
+ Nokogiri::XML::ParseOptions::NODICT = T.let(T.unsafe(nil), Integer)
3996
+
3997
+ # Substitute entities
3998
+ Nokogiri::XML::ParseOptions::NOENT = T.let(T.unsafe(nil), Integer)
3999
+
4000
+ # suppress error reports
4001
+ Nokogiri::XML::ParseOptions::NOERROR = T.let(T.unsafe(nil), Integer)
4002
+
4003
+ # Forbid network access. Recommended for dealing with untrusted documents.
4004
+ Nokogiri::XML::ParseOptions::NONET = T.let(T.unsafe(nil), Integer)
4005
+
4006
+ # suppress warning reports
4007
+ Nokogiri::XML::ParseOptions::NOWARNING = T.let(T.unsafe(nil), Integer)
4008
+
4009
+ # do not generate XINCLUDE START/END nodes
4010
+ Nokogiri::XML::ParseOptions::NOXINCNODE = T.let(T.unsafe(nil), Integer)
4011
+
4012
+ # remove redundant namespaces declarations
4013
+ Nokogiri::XML::ParseOptions::NSCLEAN = T.let(T.unsafe(nil), Integer)
4014
+
4015
+ # parse using XML-1.0 before update 5
4016
+ Nokogiri::XML::ParseOptions::OLD10 = T.let(T.unsafe(nil), Integer)
4017
+
4018
+ # pedantic error reporting
4019
+ Nokogiri::XML::ParseOptions::PEDANTIC = T.let(T.unsafe(nil), Integer)
4020
+
4021
+ # Recover from errors
4022
+ Nokogiri::XML::ParseOptions::RECOVER = T.let(T.unsafe(nil), Integer)
4023
+
4024
+ # use the SAX1 interface internally
4025
+ Nokogiri::XML::ParseOptions::SAX1 = T.let(T.unsafe(nil), Integer)
4026
+
4027
+ # Strict parsing
4028
+ Nokogiri::XML::ParseOptions::STRICT = T.let(T.unsafe(nil), Integer)
4029
+
4030
+ # Implement XInclude substitution
4031
+ Nokogiri::XML::ParseOptions::XINCLUDE = T.let(T.unsafe(nil), Integer)
4032
+
4033
+ class Nokogiri::XML::ProcessingInstruction < ::Nokogiri::XML::Node
4034
+ # @return [ProcessingInstruction] a new instance of ProcessingInstruction
4035
+ def initialize(document, name, content); end
4036
+
4037
+ class << self
4038
+ def new(*_arg0); end
4039
+ end
4040
+ end
4041
+
4042
+ # Nokogiri::XML::Reader parses an XML document similar to the way a cursor
4043
+ # would move. The Reader is given an XML document, and yields nodes
4044
+ # to an each block.
4045
+ #
4046
+ # Here is an example of usage:
4047
+ #
4048
+ # reader = Nokogiri::XML::Reader(<<-eoxml)
4049
+ # <x xmlns:tenderlove='http://tenderlovemaking.com/'>
4050
+ # <tenderlove:foo awesome='true'>snuggles!</tenderlove:foo>
4051
+ # </x>
4052
+ # eoxml
4053
+ #
4054
+ # reader.each do |node|
4055
+ #
4056
+ # # node is an instance of Nokogiri::XML::Reader
4057
+ # puts node.name
4058
+ #
4059
+ # end
4060
+ #
4061
+ # Note that Nokogiri::XML::Reader#each can only be called once!! Once
4062
+ # the cursor moves through the entire document, you must parse the
4063
+ # document again. So make sure that you capture any information you
4064
+ # need during the first iteration.
4065
+ #
4066
+ # The Reader parser is good for when you need the speed of a SAX parser,
4067
+ # but do not want to write a Document handler.
4068
+ class Nokogiri::XML::Reader
4069
+ include ::Enumerable
4070
+
4071
+ # @return [Reader] a new instance of Reader
4072
+ def initialize(source, url = T.unsafe(nil), encoding = T.unsafe(nil)); end
4073
+
4074
+ def attribute(_arg0); end
4075
+ def attribute_at(_arg0); end
4076
+ def attribute_count; end
4077
+ def attribute_hash; end
4078
+ def attribute_nodes; end
4079
+
4080
+ # Get the attributes and namespaces of the current node as a Hash.
4081
+ #
4082
+ # This is the union of Reader#attribute_hash and Reader#namespaces
4083
+ #
4084
+ # [Returns]
4085
+ # (Hash<String, String>) Attribute names and values, and namespace prefixes and hrefs.
4086
+ def attributes; end
4087
+
4088
+ def attributes?; end
4089
+ def base_uri; end
4090
+ def default?; end
4091
+ def depth; end
4092
+
4093
+ # Move the cursor through the document yielding the cursor to the block
4094
+ def each; end
4095
+
4096
+ def empty_element?; end
4097
+ def encoding; end
4098
+
4099
+ # A list of errors encountered while parsing
4100
+ def errors; end
4101
+
4102
+ # A list of errors encountered while parsing
4103
+ def errors=(_arg0); end
4104
+
4105
+ def inner_xml; end
4106
+ def lang; end
4107
+ def local_name; end
4108
+ def name; end
4109
+ def namespace_uri; end
4110
+ def namespaces; end
4111
+ def node_type; end
4112
+ def outer_xml; end
4113
+ def prefix; end
4114
+ def read; end
4115
+ def self_closing?; end
4116
+
4117
+ # The XML source
4118
+ def source; end
4119
+
4120
+ def state; end
4121
+ def value; end
4122
+ def value?; end
4123
+ def xml_version; end
4124
+
4125
+ class << self
4126
+ def from_io(*_arg0); end
4127
+ def from_memory(*_arg0); end
4128
+ end
4129
+ end
4130
+
4131
+ # Attribute node type
4132
+ Nokogiri::XML::Reader::TYPE_ATTRIBUTE = T.let(T.unsafe(nil), Integer)
4133
+
4134
+ # CDATA node type
4135
+ Nokogiri::XML::Reader::TYPE_CDATA = T.let(T.unsafe(nil), Integer)
4136
+
4137
+ # Comment node type
4138
+ Nokogiri::XML::Reader::TYPE_COMMENT = T.let(T.unsafe(nil), Integer)
4139
+
4140
+ # Document node type
4141
+ Nokogiri::XML::Reader::TYPE_DOCUMENT = T.let(T.unsafe(nil), Integer)
4142
+
4143
+ # Document Fragment node type
4144
+ Nokogiri::XML::Reader::TYPE_DOCUMENT_FRAGMENT = T.let(T.unsafe(nil), Integer)
4145
+
4146
+ # Document Type node type
4147
+ Nokogiri::XML::Reader::TYPE_DOCUMENT_TYPE = T.let(T.unsafe(nil), Integer)
4148
+
4149
+ # Element node type
4150
+ Nokogiri::XML::Reader::TYPE_ELEMENT = T.let(T.unsafe(nil), Integer)
4151
+
4152
+ # Element end node type
4153
+ Nokogiri::XML::Reader::TYPE_END_ELEMENT = T.let(T.unsafe(nil), Integer)
4154
+
4155
+ # Entity end node type
4156
+ Nokogiri::XML::Reader::TYPE_END_ENTITY = T.let(T.unsafe(nil), Integer)
4157
+
4158
+ # Entity node type
4159
+ Nokogiri::XML::Reader::TYPE_ENTITY = T.let(T.unsafe(nil), Integer)
4160
+
4161
+ # Entity Reference node type
4162
+ Nokogiri::XML::Reader::TYPE_ENTITY_REFERENCE = T.let(T.unsafe(nil), Integer)
4163
+
4164
+ Nokogiri::XML::Reader::TYPE_NONE = T.let(T.unsafe(nil), Integer)
4165
+
4166
+ # Notation node type
4167
+ Nokogiri::XML::Reader::TYPE_NOTATION = T.let(T.unsafe(nil), Integer)
4168
+
4169
+ # PI node type
4170
+ Nokogiri::XML::Reader::TYPE_PROCESSING_INSTRUCTION = T.let(T.unsafe(nil), Integer)
4171
+
4172
+ # Significant Whitespace node type
4173
+ Nokogiri::XML::Reader::TYPE_SIGNIFICANT_WHITESPACE = T.let(T.unsafe(nil), Integer)
4174
+
4175
+ # Text node type
4176
+ Nokogiri::XML::Reader::TYPE_TEXT = T.let(T.unsafe(nil), Integer)
4177
+
4178
+ # Whitespace node type
4179
+ Nokogiri::XML::Reader::TYPE_WHITESPACE = T.let(T.unsafe(nil), Integer)
4180
+
4181
+ # XML Declaration node type
4182
+ Nokogiri::XML::Reader::TYPE_XML_DECLARATION = T.let(T.unsafe(nil), Integer)
4183
+
4184
+ # Nokogiri::XML::RelaxNG is used for validating XML against a
4185
+ # RelaxNG schema.
4186
+ #
4187
+ # == Synopsis
4188
+ #
4189
+ # Validate an XML document against a RelaxNG schema. Loop over the errors
4190
+ # that are returned and print them out:
4191
+ #
4192
+ # schema = Nokogiri::XML::RelaxNG(File.open(ADDRESS_SCHEMA_FILE))
4193
+ # doc = Nokogiri::XML(File.open(ADDRESS_XML_FILE))
4194
+ #
4195
+ # schema.validate(doc).each do |error|
4196
+ # puts error.message
4197
+ # end
4198
+ #
4199
+ # The list of errors are Nokogiri::XML::SyntaxError objects.
4200
+ #
4201
+ # NOTE: RelaxNG input is always treated as TRUSTED documents, meaning that they will cause the
4202
+ # underlying parsing libraries to access network resources. This is counter to Nokogiri's
4203
+ # "untrusted by default" security policy, but is a limitation of the underlying libraries.
4204
+ class Nokogiri::XML::RelaxNG < ::Nokogiri::XML::Schema
4205
+ private
4206
+
4207
+ def validate_document(_arg0); end
4208
+
4209
+ class << self
4210
+ def from_document(*_arg0); end
4211
+ def read_memory(*_arg0); end
4212
+ end
4213
+ end
4214
+
4215
+ # SAX Parsers are event driven parsers. Nokogiri provides two different event based parsers when
4216
+ # dealing with XML. If you want to do SAX style parsing using HTML, check out
4217
+ # Nokogiri::HTML4::SAX.
4218
+ #
4219
+ # The basic way a SAX style parser works is by creating a parser, telling the parser about the
4220
+ # events we're interested in, then giving the parser some XML to process. The parser will notify
4221
+ # you when it encounters events you said you would like to know about.
4222
+ #
4223
+ # To register for events, you simply subclass Nokogiri::XML::SAX::Document, and implement the
4224
+ # methods for which you would like notification.
4225
+ #
4226
+ # For example, if I want to be notified when a document ends, and when an element starts, I
4227
+ # would write a class like this:
4228
+ #
4229
+ # class MyDocument < Nokogiri::XML::SAX::Document
4230
+ # def end_document
4231
+ # puts "the document has ended"
4232
+ # end
4233
+ #
4234
+ # def start_element name, attributes = []
4235
+ # puts "#{name} started"
4236
+ # end
4237
+ # end
4238
+ #
4239
+ # Then I would instantiate a SAX parser with this document, and feed the parser some XML
4240
+ #
4241
+ # # Create a new parser
4242
+ # parser = Nokogiri::XML::SAX::Parser.new(MyDocument.new)
4243
+ #
4244
+ # # Feed the parser some XML
4245
+ # parser.parse(File.open(ARGV[0]))
4246
+ #
4247
+ # Now my document handler will be called when each node starts, and when then document ends. To
4248
+ # see what kinds of events are available, take a look at Nokogiri::XML::SAX::Document.
4249
+ #
4250
+ # Two SAX parsers for XML are available, a parser that reads from a string or IO object as it
4251
+ # feels necessary, and a parser that lets you spoon feed it XML. If you want to let Nokogiri
4252
+ # deal with reading your XML, use the Nokogiri::XML::SAX::Parser. If you want to have fine grain
4253
+ # control over the XML input, use the Nokogiri::XML::SAX::PushParser.
4254
+ module Nokogiri::XML::SAX; end
4255
+
4256
+ # This class is used for registering types of events you are interested in handling. All of
4257
+ # the methods on this class are available as possible events while parsing an XML document. To
4258
+ # register for any particular event, just subclass this class and implement the methods you
4259
+ # are interested in knowing about.
4260
+ #
4261
+ # To only be notified about start and end element events, write a class like this:
4262
+ #
4263
+ # class MyDocument < Nokogiri::XML::SAX::Document
4264
+ # def start_element name, attrs = []
4265
+ # puts "#{name} started!"
4266
+ # end
4267
+ #
4268
+ # def end_element name
4269
+ # puts "#{name} ended"
4270
+ # end
4271
+ # end
4272
+ #
4273
+ # You can use this event handler for any SAX style parser included with Nokogiri. See
4274
+ # Nokogiri::XML::SAX, and Nokogiri::HTML4::SAX.
4275
+ class Nokogiri::XML::SAX::Document
4276
+ # Called when cdata blocks are found
4277
+ # +string+ contains the cdata content
4278
+ def cdata_block(string); end
4279
+
4280
+ # Characters read between a tag. This method might be called multiple
4281
+ # times given one contiguous string of characters.
4282
+ #
4283
+ # +string+ contains the character data
4284
+ def characters(string); end
4285
+
4286
+ # Called when comments are encountered
4287
+ # +string+ contains the comment data
4288
+ def comment(string); end
4289
+
4290
+ # Called when document ends parsing
4291
+ def end_document; end
4292
+
4293
+ # Called at the end of an element
4294
+ # +name+ is the tag name
4295
+ def end_element(name); end
4296
+
4297
+ # Called at the end of an element
4298
+ # +name+ is the element's name
4299
+ # +prefix+ is the namespace prefix associated with the element
4300
+ # +uri+ is the associated namespace URI
4301
+ def end_element_namespace(name, prefix = T.unsafe(nil), uri = T.unsafe(nil)); end
4302
+
4303
+ # Called on document errors
4304
+ # +string+ contains the error
4305
+ def error(string); end
4306
+
4307
+ # Called when processing instructions are found
4308
+ # +name+ is the target of the instruction
4309
+ # +content+ is the value of the instruction
4310
+ def processing_instruction(name, content); end
4311
+
4312
+ # Called when document starts parsing
4313
+ def start_document; end
4314
+
4315
+ # Called at the beginning of an element
4316
+ # * +name+ is the name of the tag
4317
+ # * +attrs+ are an assoc list of namespaces and attributes, e.g.:
4318
+ # [ ["xmlns:foo", "http://sample.net"], ["size", "large"] ]
4319
+ def start_element(name, attrs = T.unsafe(nil)); end
4320
+
4321
+ # Called at the beginning of an element
4322
+ # +name+ is the element name
4323
+ # +attrs+ is a list of attributes
4324
+ # +prefix+ is the namespace prefix for the element
4325
+ # +uri+ is the associated namespace URI
4326
+ # +ns+ is a hash of namespace prefix:urls associated with the element
4327
+ def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end
4328
+
4329
+ # Called on document warnings
4330
+ # +string+ contains the warning
4331
+ def warning(string); end
4332
+
4333
+ # Called when an XML declaration is parsed
4334
+ def xmldecl(version, encoding, standalone); end
4335
+ end
4336
+
4337
+ # This parser is a SAX style parser that reads it's input as it
4338
+ # deems necessary. The parser takes a Nokogiri::XML::SAX::Document,
4339
+ # an optional encoding, then given an XML input, sends messages to
4340
+ # the Nokogiri::XML::SAX::Document.
4341
+ #
4342
+ # Here is an example of using this parser:
4343
+ #
4344
+ # # Create a subclass of Nokogiri::XML::SAX::Document and implement
4345
+ # # the events we care about:
4346
+ # class MyDoc < Nokogiri::XML::SAX::Document
4347
+ # def start_element name, attrs = []
4348
+ # puts "starting: #{name}"
4349
+ # end
4350
+ #
4351
+ # def end_element name
4352
+ # puts "ending: #{name}"
4353
+ # end
4354
+ # end
4355
+ #
4356
+ # # Create our parser
4357
+ # parser = Nokogiri::XML::SAX::Parser.new(MyDoc.new)
4358
+ #
4359
+ # # Send some XML to the parser
4360
+ # parser.parse(File.open(ARGV[0]))
4361
+ #
4362
+ # For more information about SAX parsers, see Nokogiri::XML::SAX. Also
4363
+ # see Nokogiri::XML::SAX::Document for the available events.
4364
+ class Nokogiri::XML::SAX::Parser
4365
+ # Create a new Parser with +doc+ and +encoding+
4366
+ #
4367
+ # @return [Parser] a new instance of Parser
4368
+ def initialize(doc = T.unsafe(nil), encoding = T.unsafe(nil)); end
4369
+
4370
+ # The Nokogiri::XML::SAX::Document where events will be sent.
4371
+ def document; end
4372
+
4373
+ # The Nokogiri::XML::SAX::Document where events will be sent.
4374
+ def document=(_arg0); end
4375
+
4376
+ # The encoding beings used for this document.
4377
+ def encoding; end
4378
+
4379
+ # The encoding beings used for this document.
4380
+ def encoding=(_arg0); end
4381
+
4382
+ # Parse given +thing+ which may be a string containing xml, or an
4383
+ # IO object.
4384
+ def parse(thing, &block); end
4385
+
4386
+ # Parse a file with +filename+
4387
+ #
4388
+ # @raise [ArgumentError]
4389
+ # @yield [ctx]
4390
+ def parse_file(filename); end
4391
+
4392
+ # Parse given +io+
4393
+ #
4394
+ # @yield [ctx]
4395
+ def parse_io(io, encoding = T.unsafe(nil)); end
4396
+
4397
+ # @yield [ctx]
4398
+ def parse_memory(data); end
4399
+
4400
+ private
4401
+
4402
+ def check_encoding(encoding); end
4403
+ end
4404
+
4405
+ class Nokogiri::XML::SAX::Parser::Attribute < ::Struct; end
4406
+
4407
+ # Encodinds this parser supports
4408
+ Nokogiri::XML::SAX::Parser::ENCODINGS = T.let(T.unsafe(nil), Hash)
4409
+
4410
+ # Context for XML SAX parsers. This class is usually not instantiated
4411
+ # by the user. Instead, you should be looking at
4412
+ # Nokogiri::XML::SAX::Parser
4413
+ class Nokogiri::XML::SAX::ParserContext
4414
+ def column; end
4415
+ def line; end
4416
+ def parse_with(_arg0); end
4417
+ def recovery; end
4418
+ def recovery=(_arg0); end
4419
+ def replace_entities; end
4420
+ def replace_entities=(_arg0); end
4421
+
4422
+ class << self
4423
+ def file(_arg0); end
4424
+ def io(_arg0, _arg1); end
4425
+ def memory(_arg0); end
4426
+ def new(thing, encoding = T.unsafe(nil)); end
4427
+ end
4428
+ end
4429
+
4430
+ # PushParser can parse a document that is fed to it manually. It
4431
+ # must be given a SAX::Document object which will be called with
4432
+ # SAX events as the document is being parsed.
4433
+ #
4434
+ # Calling PushParser#<< writes XML to the parser, calling any SAX
4435
+ # callbacks it can.
4436
+ #
4437
+ # PushParser#finish tells the parser that the document is finished
4438
+ # and calls the end_document SAX method.
4439
+ #
4440
+ # Example:
4441
+ #
4442
+ # parser = PushParser.new(Class.new(XML::SAX::Document) {
4443
+ # def start_document
4444
+ # puts "start document called"
4445
+ # end
4446
+ # }.new)
4447
+ # parser << "<div>hello<"
4448
+ # parser << "/div>"
4449
+ # parser.finish
4450
+ class Nokogiri::XML::SAX::PushParser
4451
+ # Create a new PushParser with +doc+ as the SAX Document, providing
4452
+ # an optional +file_name+ and +encoding+
4453
+ #
4454
+ # @return [PushParser] a new instance of PushParser
4455
+ def initialize(doc = T.unsafe(nil), file_name = T.unsafe(nil), encoding = T.unsafe(nil)); end
4456
+
4457
+ # Write a +chunk+ of XML to the PushParser. Any callback methods
4458
+ # that can be called will be called immediately.
4459
+ def <<(chunk, last_chunk = T.unsafe(nil)); end
4460
+
4461
+ # The Nokogiri::XML::SAX::Document on which the PushParser will be
4462
+ # operating
4463
+ def document; end
4464
+
4465
+ # The Nokogiri::XML::SAX::Document on which the PushParser will be
4466
+ # operating
4467
+ def document=(_arg0); end
4468
+
4469
+ # Finish the parsing. This method is only necessary for
4470
+ # Nokogiri::XML::SAX::Document#end_document to be called.
4471
+ def finish; end
4472
+
4473
+ def options; end
4474
+ def options=(_arg0); end
4475
+ def replace_entities; end
4476
+ def replace_entities=(_arg0); end
4477
+
4478
+ # Write a +chunk+ of XML to the PushParser. Any callback methods
4479
+ # that can be called will be called immediately.
4480
+ def write(chunk, last_chunk = T.unsafe(nil)); end
4481
+
4482
+ private
4483
+
4484
+ def initialize_native(_arg0, _arg1); end
4485
+ def native_write(_arg0, _arg1); end
4486
+ end
4487
+
4488
+ # Nokogiri::XML::Schema is used for validating XML against a schema
4489
+ # (usually from an xsd file).
4490
+ #
4491
+ # == Synopsis
4492
+ #
4493
+ # Validate an XML document against a Schema. Loop over the errors that
4494
+ # are returned and print them out:
4495
+ #
4496
+ # xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE))
4497
+ # doc = Nokogiri::XML(File.read(PO_XML_FILE))
4498
+ #
4499
+ # xsd.validate(doc).each do |error|
4500
+ # puts error.message
4501
+ # end
4502
+ #
4503
+ # The list of errors are Nokogiri::XML::SyntaxError objects.
4504
+ #
4505
+ # NOTE: As of v1.11.0, Schema treats inputs as UNTRUSTED by default, and so external entities
4506
+ # are not resolved from the network (`http://` or `ftp://`). Previously, parsing treated
4507
+ # documents as "trusted" by default which was counter to Nokogiri's "untrusted by default"
4508
+ # security policy. If a document is trusted, then the caller may turn off the NONET option via
4509
+ # the ParseOptions to re-enable external entity resolution over a network connection.
4510
+ class Nokogiri::XML::Schema
4511
+ # Errors while parsing the schema file
4512
+ def errors; end
4513
+
4514
+ # Errors while parsing the schema file
4515
+ def errors=(_arg0); end
4516
+
4517
+ # The Nokogiri::XML::ParseOptions used to parse the schema
4518
+ def parse_options; end
4519
+
4520
+ # The Nokogiri::XML::ParseOptions used to parse the schema
4521
+ def parse_options=(_arg0); end
4522
+
4523
+ # Returns true if +thing+ is a valid Nokogiri::XML::Document or
4524
+ # file.
4525
+ #
4526
+ # @return [Boolean]
4527
+ def valid?(thing); end
4528
+
4529
+ # Validate +thing+ against this schema. +thing+ can be a
4530
+ # Nokogiri::XML::Document object, or a filename. An Array of
4531
+ # Nokogiri::XML::SyntaxError objects found while validating the
4532
+ # +thing+ is returned.
4533
+ def validate(thing); end
4534
+
4535
+ private
4536
+
4537
+ def validate_document(_arg0); end
4538
+ def validate_file(_arg0); end
4539
+
4540
+ class << self
4541
+ def from_document(*_arg0); end
4542
+
4543
+ # Create a new Nokogiri::XML::Schema object using a +string_or_io+
4544
+ # object.
4545
+ def new(string_or_io, options = T.unsafe(nil)); end
4546
+
4547
+ def read_memory(*_arg0); end
4548
+ end
4549
+ end
4550
+
4551
+ # The Searchable module declares the interface used for searching your DOM.
4552
+ #
4553
+ # It implements the public methods #search, #css, and #xpath,
4554
+ # as well as allowing specific implementations to specialize some
4555
+ # of the important behaviors.
4556
+ module Nokogiri::XML::Searchable
4557
+ # call-seq:
4558
+ # at(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class])
4559
+ #
4560
+ # Search this object for +paths+, and return only the first
4561
+ # result. +paths+ must be one or more XPath or CSS queries.
4562
+ #
4563
+ # See Searchable#search for more information.
4564
+ def %(*args); end
4565
+
4566
+ # call-seq:
4567
+ # search(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class])
4568
+ #
4569
+ # Search this object for +paths+. +paths+ must be one or more XPath or CSS queries:
4570
+ #
4571
+ # node.search("div.employee", ".//title")
4572
+ #
4573
+ # A hash of namespace bindings may be appended:
4574
+ #
4575
+ # node.search('.//bike:tire', {'bike' => 'http://schwinn.com/'})
4576
+ # node.search('bike|tire', {'bike' => 'http://schwinn.com/'})
4577
+ #
4578
+ # For XPath queries, a hash of variable bindings may also be appended to the namespace
4579
+ # bindings. For example:
4580
+ #
4581
+ # node.search('.//address[@domestic=$value]', nil, {:value => 'Yes'})
4582
+ #
4583
+ # 💡 Custom XPath functions and CSS pseudo-selectors may also be defined. To define custom
4584
+ # functions create a class and implement the function you want to define. The first argument
4585
+ # to the method will be the current matching NodeSet. Any other arguments are ones that you
4586
+ # pass in. Note that this class may appear anywhere in the argument list. For example:
4587
+ #
4588
+ # handler = Class.new {
4589
+ # def regex node_set, regex
4590
+ # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ }
4591
+ # end
4592
+ # }.new
4593
+ # node.search('.//title[regex(., "\w+")]', 'div.employee:regex("[0-9]+")', handler)
4594
+ #
4595
+ # See Searchable#xpath and Searchable#css for further usage help.
4596
+ def /(*args); end
4597
+
4598
+ # :call-seq:
4599
+ # >(selector) → NodeSet
4600
+ #
4601
+ # Search this node's immediate children using CSS selector +selector+
4602
+ def >(selector); end
4603
+
4604
+ # call-seq:
4605
+ # at(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class])
4606
+ #
4607
+ # Search this object for +paths+, and return only the first
4608
+ # result. +paths+ must be one or more XPath or CSS queries.
4609
+ #
4610
+ # See Searchable#search for more information.
4611
+ def at(*args); end
4612
+
4613
+ # call-seq:
4614
+ # at_css(*rules, [namespace-bindings, custom-pseudo-class])
4615
+ #
4616
+ # Search this object for CSS +rules+, and return only the first
4617
+ # match. +rules+ must be one or more CSS selectors.
4618
+ #
4619
+ # See Searchable#css for more information.
4620
+ def at_css(*args); end
4621
+
4622
+ # call-seq:
4623
+ # at_xpath(*paths, [namespace-bindings, variable-bindings, custom-handler-class])
4624
+ #
4625
+ # Search this node for XPath +paths+, and return only the first
4626
+ # match. +paths+ must be one or more XPath queries.
4627
+ #
4628
+ # See Searchable#xpath for more information.
4629
+ def at_xpath(*args); end
4630
+
4631
+ # call-seq:
4632
+ # css(*rules, [namespace-bindings, custom-pseudo-class])
4633
+ #
4634
+ # Search this object for CSS +rules+. +rules+ must be one or more CSS
4635
+ # selectors. For example:
4636
+ #
4637
+ # node.css('title')
4638
+ # node.css('body h1.bold')
4639
+ # node.css('div + p.green', 'div#one')
4640
+ #
4641
+ # A hash of namespace bindings may be appended. For example:
4642
+ #
4643
+ # node.css('bike|tire', {'bike' => 'http://schwinn.com/'})
4644
+ #
4645
+ # 💡 Custom CSS pseudo classes may also be defined which are mapped to a custom XPath
4646
+ # function. To define custom pseudo classes, create a class and implement the custom pseudo
4647
+ # class you want defined. The first argument to the method will be the matching context
4648
+ # NodeSet. Any other arguments are ones that you pass in. For example:
4649
+ #
4650
+ # handler = Class.new {
4651
+ # def regex(node_set, regex)
4652
+ # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ }
4653
+ # end
4654
+ # }.new
4655
+ # node.css('title:regex("\w+")', handler)
4656
+ #
4657
+ # 💡 Some XPath syntax is supported in CSS queries. For example, to query for an attribute:
4658
+ #
4659
+ # node.css('img > @href') # returns all +href+ attributes on an +img+ element
4660
+ # node.css('img / @href') # same
4661
+ #
4662
+ # # ⚠ this returns +class+ attributes from all +div+ elements AND THEIR CHILDREN!
4663
+ # node.css('div @class')
4664
+ #
4665
+ # node.css
4666
+ #
4667
+ # 💡 Array-like syntax is supported in CSS queries as an alternative to using +:nth-child()+.
4668
+ #
4669
+ # ⚠ NOTE that indices are 1-based like +:nth-child+ and not 0-based like Ruby Arrays. For
4670
+ # example:
4671
+ #
4672
+ # # equivalent to 'li:nth-child(2)'
4673
+ # node.css('li[2]') # retrieve the second li element in a list
4674
+ #
4675
+ # ⚠ NOTE that the CSS query string is case-sensitive with regards to your document type. HTML
4676
+ # tags will match only lowercase CSS queries, so if you search for "H1" in an HTML document,
4677
+ # you'll never find anything. However, "H1" might be found in an XML document, where tags
4678
+ # names are case-sensitive (e.g., "H1" is distinct from "h1").
4679
+ def css(*args); end
4680
+
4681
+ # call-seq:
4682
+ # search(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class])
4683
+ #
4684
+ # Search this object for +paths+. +paths+ must be one or more XPath or CSS queries:
4685
+ #
4686
+ # node.search("div.employee", ".//title")
4687
+ #
4688
+ # A hash of namespace bindings may be appended:
4689
+ #
4690
+ # node.search('.//bike:tire', {'bike' => 'http://schwinn.com/'})
4691
+ # node.search('bike|tire', {'bike' => 'http://schwinn.com/'})
4692
+ #
4693
+ # For XPath queries, a hash of variable bindings may also be appended to the namespace
4694
+ # bindings. For example:
4695
+ #
4696
+ # node.search('.//address[@domestic=$value]', nil, {:value => 'Yes'})
4697
+ #
4698
+ # 💡 Custom XPath functions and CSS pseudo-selectors may also be defined. To define custom
4699
+ # functions create a class and implement the function you want to define. The first argument
4700
+ # to the method will be the current matching NodeSet. Any other arguments are ones that you
4701
+ # pass in. Note that this class may appear anywhere in the argument list. For example:
4702
+ #
4703
+ # handler = Class.new {
4704
+ # def regex node_set, regex
4705
+ # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ }
4706
+ # end
4707
+ # }.new
4708
+ # node.search('.//title[regex(., "\w+")]', 'div.employee:regex("[0-9]+")', handler)
4709
+ #
4710
+ # See Searchable#xpath and Searchable#css for further usage help.
4711
+ def search(*args); end
4712
+
4713
+ # call-seq:
4714
+ # xpath(*paths, [namespace-bindings, variable-bindings, custom-handler-class])
4715
+ #
4716
+ # Search this node for XPath +paths+. +paths+ must be one or more XPath
4717
+ # queries.
4718
+ #
4719
+ # node.xpath('.//title')
4720
+ #
4721
+ # A hash of namespace bindings may be appended. For example:
4722
+ #
4723
+ # node.xpath('.//foo:name', {'foo' => 'http://example.org/'})
4724
+ # node.xpath('.//xmlns:name', node.root.namespaces)
4725
+ #
4726
+ # A hash of variable bindings may also be appended to the namespace bindings. For example:
4727
+ #
4728
+ # node.xpath('.//address[@domestic=$value]', nil, {:value => 'Yes'})
4729
+ #
4730
+ # 💡 Custom XPath functions may also be defined. To define custom functions create a class and
4731
+ # implement the function you want to define. The first argument to the method will be the
4732
+ # current matching NodeSet. Any other arguments are ones that you pass in. Note that this
4733
+ # class may appear anywhere in the argument list. For example:
4734
+ #
4735
+ # handler = Class.new {
4736
+ # def regex(node_set, regex)
4737
+ # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ }
4738
+ # end
4739
+ # }.new
4740
+ # node.xpath('.//title[regex(., "\w+")]', handler)
4741
+ def xpath(*args); end
4742
+
4743
+ private
4744
+
4745
+ def css_internal(node, rules, handler, ns); end
4746
+ def css_rules_to_xpath(rules, ns); end
4747
+ def extract_params(params); end
4748
+ def xpath_impl(node, path, handler, ns, binds); end
4749
+ def xpath_internal(node, paths, handler, ns, binds); end
4750
+ def xpath_query_from_css_rule(rule, ns); end
4751
+ end
4752
+
4753
+ # Regular expression used by Searchable#search to determine if a query
4754
+ # string is CSS or XPath
4755
+ Nokogiri::XML::Searchable::LOOKS_LIKE_XPATH = T.let(T.unsafe(nil), Regexp)
4756
+
4757
+ # This class provides information about XML SyntaxErrors. These
4758
+ # exceptions are typically stored on Nokogiri::XML::Document#errors.
4759
+ class Nokogiri::XML::SyntaxError < ::Nokogiri::SyntaxError
4760
+ # Returns the value of attribute code.
4761
+ def code; end
4762
+
4763
+ # Returns the value of attribute column.
4764
+ def column; end
4765
+
4766
+ # Returns the value of attribute domain.
4767
+ def domain; end
4768
+
4769
+ # return true if this is an error
4770
+ #
4771
+ # @return [Boolean]
4772
+ def error?; end
4773
+
4774
+ # return true if this error is fatal
4775
+ #
4776
+ # @return [Boolean]
4777
+ def fatal?; end
4778
+
4779
+ # Returns the value of attribute file.
4780
+ def file; end
4781
+
4782
+ # Returns the value of attribute int1.
4783
+ def int1; end
4784
+
4785
+ # Returns the value of attribute level.
4786
+ def level; end
4787
+
4788
+ # Returns the value of attribute line.
4789
+ def line; end
4790
+
4791
+ # return true if this is a non error
4792
+ #
4793
+ # @return [Boolean]
4794
+ def none?; end
4795
+
4796
+ # Returns the value of attribute str1.
4797
+ def str1; end
4798
+
4799
+ # Returns the value of attribute str2.
4800
+ def str2; end
4801
+
4802
+ # Returns the value of attribute str3.
4803
+ def str3; end
4804
+
4805
+ def to_s; end
4806
+
4807
+ # return true if this is a warning
4808
+ #
4809
+ # @return [Boolean]
4810
+ def warning?; end
4811
+
4812
+ private
4813
+
4814
+ def level_to_s; end
4815
+ def location_to_s; end
4816
+
4817
+ # @return [Boolean]
4818
+ def nil_or_zero?(attribute); end
4819
+ end
4820
+
4821
+ class Nokogiri::XML::Text < ::Nokogiri::XML::CharacterData
4822
+ def content=(string); end
4823
+
4824
+ class << self
4825
+ def new(*_arg0); end
4826
+ end
4827
+ end
4828
+
4829
+ # Original C14N 1.0 spec canonicalization
4830
+ Nokogiri::XML::XML_C14N_1_0 = T.let(T.unsafe(nil), Integer)
4831
+
4832
+ # C14N 1.1 spec canonicalization
4833
+ Nokogiri::XML::XML_C14N_1_1 = T.let(T.unsafe(nil), Integer)
4834
+
4835
+ # Exclusive C14N 1.0 spec canonicalization
4836
+ Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 = T.let(T.unsafe(nil), Integer)
4837
+
4838
+ module Nokogiri::XML::XPath; end
4839
+
4840
+ # The XPath search prefix to search direct descendants of the current element, +./+
4841
+ Nokogiri::XML::XPath::CURRENT_SEARCH_PREFIX = T.let(T.unsafe(nil), String)
4842
+
4843
+ # The XPath search prefix to search globally, +//+
4844
+ Nokogiri::XML::XPath::GLOBAL_SEARCH_PREFIX = T.let(T.unsafe(nil), String)
4845
+
4846
+ # The XPath search prefix to search direct descendants of the root element, +/+
4847
+ Nokogiri::XML::XPath::ROOT_SEARCH_PREFIX = T.let(T.unsafe(nil), String)
4848
+
4849
+ # The XPath search prefix to search anywhere in the current element's subtree, +.//+
4850
+ Nokogiri::XML::XPath::SUBTREE_SEARCH_PREFIX = T.let(T.unsafe(nil), String)
4851
+
4852
+ class Nokogiri::XML::XPath::SyntaxError < ::Nokogiri::XML::SyntaxError
4853
+ def to_s; end
4854
+ end
4855
+
4856
+ class Nokogiri::XML::XPathContext
4857
+ def evaluate(*_arg0); end
4858
+
4859
+ # Register namespaces in +namespaces+
4860
+ def register_namespaces(namespaces); end
4861
+
4862
+ def register_ns(_arg0, _arg1); end
4863
+ def register_variable(_arg0, _arg1); end
4864
+
4865
+ class << self
4866
+ def new(_arg0); end
4867
+ end
4868
+ end
4869
+
4870
+ # See Nokogiri::XSLT::Stylesheet for creating and manipulating
4871
+ # Stylesheet object.
4872
+ module Nokogiri::XSLT
4873
+ class << self
4874
+ # Parse the stylesheet in +string+, register any +modules+
4875
+ def parse(string, modules = T.unsafe(nil)); end
4876
+
4877
+ # :call-seq:
4878
+ # quote_params(params) → Array
4879
+ #
4880
+ # Quote parameters in +params+ for stylesheet safety.
4881
+ # See Nokogiri::XSLT::Stylesheet.transform for example usage.
4882
+ #
4883
+ # [Parameters]
4884
+ # - +params+ (Hash, Array) XSLT parameters (key->value, or tuples of [key, value])
4885
+ #
4886
+ # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform
4887
+ def quote_params(params); end
4888
+
4889
+ def register(_arg0, _arg1); end
4890
+ end
4891
+ end
4892
+
4893
+ # A Stylesheet represents an XSLT Stylesheet object. Stylesheet creation
4894
+ # is done through Nokogiri.XSLT. Here is an example of transforming
4895
+ # an XML::Document with a Stylesheet:
4896
+ #
4897
+ # doc = Nokogiri::XML(File.read('some_file.xml'))
4898
+ # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
4899
+ #
4900
+ # puts xslt.transform(doc)
4901
+ #
4902
+ # See Nokogiri::XSLT::Stylesheet#transform for more transformation
4903
+ # information.
4904
+ class Nokogiri::XSLT::Stylesheet
4905
+ # Apply an XSLT stylesheet to an XML::Document.
4906
+ # +params+ is an array of strings used as XSLT parameters.
4907
+ # returns serialized document
4908
+ def apply_to(document, params = T.unsafe(nil)); end
4909
+
4910
+ def serialize(_arg0); end
4911
+ def transform(*_arg0); end
4912
+
4913
+ class << self
4914
+ def parse_stylesheet_doc(_arg0); end
4915
+ end
4916
+ end