packwerk 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/packwerk/application_validator.rb +2 -1
  3. data/lib/packwerk/graph.rb +15 -56
  4. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +1 -2
  5. data/lib/packwerk/run_context.rb +5 -0
  6. data/lib/packwerk/validators/dependency_validator.rb +5 -4
  7. data/lib/packwerk/version.rb +1 -1
  8. data/sorbet/rbi/gems/{actionpack@7.0.3.1.rbi → actionpack@7.0.8.7.rbi} +1338 -1227
  9. data/sorbet/rbi/gems/{actionview@7.0.3.1.rbi → actionview@7.0.8.7.rbi} +548 -503
  10. data/sorbet/rbi/gems/{activesupport@7.0.3.1.rbi → activesupport@7.0.8.7.rbi} +714 -635
  11. data/sorbet/rbi/gems/{better_html@2.0.1.rbi → better_html@2.1.1.rbi} +21 -21
  12. data/sorbet/rbi/gems/{concurrent-ruby@1.1.10.rbi → concurrent-ruby@1.3.5.rbi} +1390 -1366
  13. data/sorbet/rbi/gems/{constant_resolver@0.2.0.rbi → constant_resolver@0.3.0.rbi} +22 -13
  14. data/sorbet/rbi/gems/{erubi@1.11.0.rbi → erubi@1.13.1.rbi} +28 -17
  15. data/sorbet/rbi/gems/{i18n@1.12.0.rbi → i18n@1.14.7.rbi} +234 -172
  16. data/sorbet/rbi/gems/{json@2.6.2.rbi → json@2.7.2.rbi} +94 -74
  17. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  18. data/sorbet/rbi/gems/{loofah@2.18.0.rbi → loofah@2.24.0.rbi} +470 -243
  19. data/sorbet/rbi/gems/{minitest@5.16.2.rbi → minitest@5.25.4.rbi} +577 -472
  20. data/sorbet/rbi/gems/{mocha@1.14.0.rbi → mocha@2.5.0.rbi} +468 -684
  21. data/sorbet/rbi/gems/{nokogiri@1.15.3.rbi → nokogiri@1.18.4.rbi} +1756 -869
  22. data/sorbet/rbi/gems/{parallel@1.24.0.rbi → parallel@1.25.1.rbi} +26 -20
  23. data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.8.1.rbi} +36 -36
  24. data/sorbet/rbi/gems/{rack-test@2.0.2.rbi → rack-test@2.2.0.rbi} +87 -114
  25. data/sorbet/rbi/gems/{rack@2.2.4.rbi → rack@2.2.13.rbi} +243 -195
  26. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +754 -0
  27. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +764 -0
  28. data/sorbet/rbi/gems/{railties@7.0.3.1.rbi → railties@7.0.8.7.rbi} +146 -140
  29. data/sorbet/rbi/gems/{regexp_parser@2.5.0.rbi → regexp_parser@2.9.2.rbi} +947 -542
  30. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.3.9.rbi} +452 -312
  31. data/sorbet/rbi/gems/{rubocop-ast@1.21.0.rbi → rubocop-ast@1.31.3.rbi} +717 -588
  32. data/sorbet/rbi/gems/{rubocop@1.34.1.rbi → rubocop@1.64.1.rbi} +10916 -4406
  33. data/sorbet/rbi/gems/{ruby-progressbar@1.11.0.rbi → ruby-progressbar@1.13.0.rbi} +359 -281
  34. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  35. data/sorbet/rbi/gems/{tzinfo@2.0.5.rbi → tzinfo@2.0.6.rbi} +144 -141
  36. data/sorbet/rbi/gems/{unicode-display_width@2.2.0.rbi → unicode-display_width@2.5.0.rbi} +24 -7
  37. metadata +36 -41
  38. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +0 -8
  39. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +0 -8
  40. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -455
  41. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +0 -542
  42. data/sorbet/rbi/gems/ruby-lsp@0.2.3.rbi +0 -11
  43. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +0 -8
  44. /data/sorbet/rbi/gems/{builder@3.2.4.rbi → builder@3.3.0.rbi} +0 -0
  45. /data/sorbet/rbi/gems/{parser@3.3.1.0.rbi → parser@3.3.3.0.rbi} +0 -0
@@ -36,25 +36,18 @@
36
36
  # source://nokogiri//lib/nokogiri.rb#38
37
37
  module Nokogiri
38
38
  class << self
39
- # source://nokogiri//lib/nokogiri/html4.rb#10
40
- def HTML(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
39
+ # source://nokogiri//lib/nokogiri/html4.rb#7
40
+ def HTML(*_arg0, **_arg1, &_arg2); end
41
41
 
42
- # :call-seq:
43
- # HTML4(input, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block) → Nokogiri::HTML4::Document
44
- #
45
- # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse
42
+ # Convenience method for Nokogiri::HTML4::Document.parse
46
43
  #
47
- # source://nokogiri//lib/nokogiri/html4.rb#10
48
- def HTML4(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
44
+ # source://nokogiri//lib/nokogiri/html4.rb#7
45
+ def HTML4(*_arg0, **_arg1, &_arg2); end
49
46
 
50
- # Since v1.12.0
51
- #
52
- # ⚠ HTML5 functionality is not available when running JRuby.
53
- #
54
- # Parse an HTML5 document. Convenience method for {Nokogiri::HTML5::Document.parse}
47
+ # Convenience method for Nokogiri::HTML5::Document.parse
55
48
  #
56
- # source://nokogiri//lib/nokogiri/html5.rb#30
57
- def HTML5(input, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
49
+ # source://nokogiri//lib/nokogiri/html5.rb#28
50
+ def HTML5(*_arg0, **_arg1, &_arg2); end
58
51
 
59
52
  # Parse a document and add the Slop decorator. The Slop decorator
60
53
  # implements method_missing such that methods may be used instead of CSS
@@ -73,29 +66,25 @@ module Nokogiri
73
66
  # source://nokogiri//lib/nokogiri.rb#91
74
67
  def Slop(*args, &block); end
75
68
 
76
- # Parse XML. Convenience method for Nokogiri::XML::Document.parse
69
+ # Convenience method for Nokogiri::XML::Document.parse
77
70
  #
78
- # source://nokogiri//lib/nokogiri/xml.rb#7
79
- def XML(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
71
+ # source://nokogiri//lib/nokogiri/xml.rb#6
72
+ def XML(*_arg0, **_arg1, &_arg2); end
80
73
 
81
- # Create a Nokogiri::XSLT::Stylesheet with +stylesheet+.
74
+ # Convenience method for Nokogiri::XSLT.parse
82
75
  #
83
- # Example:
84
- #
85
- # xslt = Nokogiri::XSLT(File.read(ARGV[0]))
86
- #
87
- # source://nokogiri//lib/nokogiri/xslt.rb#13
88
- def XSLT(stylesheet, modules = T.unsafe(nil)); end
76
+ # source://nokogiri//lib/nokogiri/xslt.rb#7
77
+ def XSLT(*_arg0, **_arg1, &_arg2); end
89
78
 
90
79
  # source://nokogiri//lib/nokogiri.rb#96
91
80
  def install_default_aliases; end
92
81
 
93
82
  # @return [Boolean]
94
83
  #
95
- # source://nokogiri//lib/nokogiri/version/info.rb#205
84
+ # source://nokogiri//lib/nokogiri/version/info.rb#206
96
85
  def jruby?; end
97
86
 
98
- # source://nokogiri//lib/nokogiri/version/info.rb#210
87
+ # source://nokogiri//lib/nokogiri/version/info.rb#211
99
88
  def libxml2_patches; end
100
89
 
101
90
  # Create a new Nokogiri::XML::DocumentFragment
@@ -110,12 +99,12 @@ module Nokogiri
110
99
 
111
100
  # @return [Boolean]
112
101
  #
113
- # source://nokogiri//lib/nokogiri/version/info.rb#200
102
+ # source://nokogiri//lib/nokogiri/version/info.rb#201
114
103
  def uses_gumbo?; end
115
104
 
116
105
  # @return [Boolean]
117
106
  #
118
- # source://nokogiri//lib/nokogiri/version/info.rb#192
107
+ # source://nokogiri//lib/nokogiri/version/info.rb#193
119
108
  def uses_libxml?(requirement = T.unsafe(nil)); end
120
109
  end
121
110
  end
@@ -132,37 +121,77 @@ module Nokogiri::CSS
132
121
  def parse(selector); end
133
122
 
134
123
  # :call-seq:
135
- # xpath_for(selector) → String
136
- # xpath_for(selector [, prefix:] [, visitor:] [, ns:]) → String
124
+ # xpath_for(selector_list) → Array<String>
125
+ # xpath_for(selector_list [, prefix:] [, ns:] [, visitor:] [, cache:]) → Array<String>
126
+ #
127
+ # Translate a CSS selector list to the equivalent XPath expressions.
128
+ #
129
+ # 💡 Note that translated queries are cached by default for performance concerns.
137
130
  #
138
- # Translate a CSS selector to the equivalent XPath query.
131
+ # Users should prefer Nokogiri::XML::Searchable#css, which is mixed into all document and
132
+ # node classes, for querying documents with CSS selectors. This method is the underlying
133
+ # mechanism used by XML::Searchable and is provided solely for advanced users to translate
134
+ # \CSS selectors to XPath directly.
135
+ #
136
+ # Also see Nokogiri::XML::Searchable#css for documentation on supported CSS selector features,
137
+ # some extended syntax that Nokogiri supports, and advanced CSS features like pseudo-class
138
+ # functions.
139
139
  #
140
140
  # [Parameters]
141
- # - +selector+ (String) The CSS selector to be translated into XPath
141
+ # - +selector_list+ (String)
142
+ #
143
+ # The CSS selector to be translated into XPath. This is always a String, but that string
144
+ # value may be a {selector list}[https://www.w3.org/TR/selectors-4/#grouping] (see
145
+ # examples).
142
146
  #
147
+ # [Keyword arguments]
143
148
  # - +prefix:+ (String)
144
149
  #
145
- # The XPath prefix for the query, see Nokogiri::XML::XPath for some options. Default is
146
- # +XML::XPath::GLOBAL_SEARCH_PREFIX+.
150
+ # The XPath expression prefix which determines the search context. See Nokogiri::XML::XPath
151
+ # for standard options. Default is +XPath::GLOBAL_SEARCH_PREFIX+.
152
+ #
153
+ # - +ns:+ (Hash<String ⇒ String>, nil)
154
+ #
155
+ # Namespaces that are referenced in the query, if any. This is a hash where the keys are the
156
+ # namespace prefix and the values are the namespace URIs. Default is +nil+ indicating an
157
+ # empty set of namespaces.
147
158
  #
148
159
  # - +visitor:+ (Nokogiri::CSS::XPathVisitor)
149
160
  #
150
- # The visitor class to use to transform the AST into XPath. Default is
151
- # +Nokogiri::CSS::XPathVisitor.new+.
161
+ # Use this XPathVisitor object to transform the CSS AST into XPath expressions. See
162
+ # Nokogiri::CSS::XPathVisitor for more information on some of the complex behavior that can
163
+ # be customized for your document type. Default is +Nokogiri::CSS::XPathVisitor.new+.
164
+ #
165
+ # ⚠ Note that this option is mutually exclusive with +prefix+ and +ns+. If +visitor+ is
166
+ # provided, +prefix+ and +ns+ must not be present.
167
+ #
168
+ # - +cache:+ (Boolean)
169
+ #
170
+ # Whether to use the SelectorCache for the translated query to ensure that repeated queries
171
+ # don't incur the overhead of re-parsing the selector. Default is +true+.
172
+ #
173
+ # [Returns] (Array<String>) The equivalent set of XPath expressions for +selector_list+
152
174
  #
153
- # - +ns:+ (Hash<String String>)
175
+ # *Example* with a simple selector:
154
176
  #
155
- # The namespaces that are referenced in the query, if any. This is a hash where the keys are
156
- # the namespace prefix and the values are the namespace URIs. Default is an empty Hash.
177
+ # Nokogiri::CSS.xpath_for("div") # => ["//div"]
157
178
  #
158
- # [Returns] (String) The equivalent XPath query for +selector+
179
+ # *Example* with a compound selector:
159
180
  #
160
- # 💡 Note that translated queries are cached for performance concerns.
181
+ # Nokogiri::CSS.xpath_for("div.xl") # => ["//div[contains(concat(' ',normalize-space(@class),' '),' xl ')]"]
182
+ #
183
+ # *Example* with a complex selector:
184
+ #
185
+ # Nokogiri::CSS.xpath_for("h1 + div") # => ["//h1/following-sibling::*[1]/self::div"]
186
+ #
187
+ # *Example* with a selector list:
188
+ #
189
+ # Nokogiri::CSS.xpath_for("h1, h2, h3") # => ["//h1", "//h2", "//h3"]
161
190
  #
162
191
  # @raise [TypeError]
163
192
  #
164
- # source://nokogiri//lib/nokogiri/css.rb#42
165
- def xpath_for(selector, options = T.unsafe(nil)); end
193
+ # source://nokogiri//lib/nokogiri/css.rb#83
194
+ def xpath_for(selector, options = T.unsafe(nil), prefix: T.unsafe(nil), visitor: T.unsafe(nil), ns: T.unsafe(nil), cache: T.unsafe(nil)); end
166
195
  end
167
196
  end
168
197
 
@@ -182,23 +211,23 @@ class Nokogiri::CSS::Node
182
211
 
183
212
  # Find a node by type using +types+
184
213
  #
185
- # source://nokogiri//lib/nokogiri/css/node.rb#32
214
+ # source://nokogiri//lib/nokogiri/css/node.rb#36
186
215
  def find_by_type(types); end
187
216
 
188
217
  # Convert to array
189
218
  #
190
- # source://nokogiri//lib/nokogiri/css/node.rb#49
219
+ # source://nokogiri//lib/nokogiri/css/node.rb#53
191
220
  def to_a; end
192
221
 
193
222
  # Convert to_type
194
223
  #
195
- # source://nokogiri//lib/nokogiri/css/node.rb#42
224
+ # source://nokogiri//lib/nokogiri/css/node.rb#46
196
225
  def to_type; end
197
226
 
198
227
  # Convert this CSS node to xpath with +prefix+ using +visitor+
199
228
  #
200
229
  # source://nokogiri//lib/nokogiri/css/node.rb#26
201
- def to_xpath(prefix, visitor); end
230
+ def to_xpath(visitor); end
202
231
 
203
232
  # Get the type of this node
204
233
  #
@@ -226,233 +255,228 @@ Nokogiri::CSS::Node::ALLOW_COMBINATOR_ON_SELF = T.let(T.unsafe(nil), Array)
226
255
 
227
256
  # source://nokogiri//lib/nokogiri/css/parser_extras.rb#7
228
257
  class Nokogiri::CSS::Parser < ::Racc::Parser
229
- # Create a new CSS parser with respect to +namespaces+
230
- #
231
258
  # @return [Parser] a new instance of Parser
232
259
  #
233
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#60
234
- def initialize(namespaces = T.unsafe(nil)); end
260
+ # source://nokogiri//lib/nokogiri/css/parser_extras.rb#8
261
+ def initialize; end
235
262
 
236
263
  # reduce 0 omitted
237
264
  #
238
- # source://nokogiri//lib/nokogiri/css/parser.rb#361
265
+ # source://nokogiri//lib/nokogiri/css/parser.rb#363
239
266
  def _reduce_1(val, _values, result); end
240
267
 
241
- # source://nokogiri//lib/nokogiri/css/parser.rb#407
268
+ # source://nokogiri//lib/nokogiri/css/parser.rb#409
242
269
  def _reduce_10(val, _values, result); end
243
270
 
244
- # source://nokogiri//lib/nokogiri/css/parser.rb#412
271
+ # source://nokogiri//lib/nokogiri/css/parser.rb#414
245
272
  def _reduce_11(val, _values, result); end
246
273
 
247
274
  # reduce 12 omitted
248
275
  #
249
- # source://nokogiri//lib/nokogiri/css/parser.rb#424
276
+ # source://nokogiri//lib/nokogiri/css/parser.rb#426
250
277
  def _reduce_13(val, _values, result); end
251
278
 
252
- # source://nokogiri//lib/nokogiri/css/parser.rb#429
279
+ # source://nokogiri//lib/nokogiri/css/parser.rb#431
253
280
  def _reduce_14(val, _values, result); end
254
281
 
255
- # source://nokogiri//lib/nokogiri/css/parser.rb#434
282
+ # source://nokogiri//lib/nokogiri/css/parser.rb#436
256
283
  def _reduce_15(val, _values, result); end
257
284
 
258
285
  # reduce 16 omitted
259
286
  #
260
- # source://nokogiri//lib/nokogiri/css/parser.rb#441
287
+ # source://nokogiri//lib/nokogiri/css/parser.rb#443
261
288
  def _reduce_17(val, _values, result); end
262
289
 
263
- # source://nokogiri//lib/nokogiri/css/parser.rb#446
290
+ # source://nokogiri//lib/nokogiri/css/parser.rb#448
264
291
  def _reduce_18(val, _values, result); end
265
292
 
266
- # source://nokogiri//lib/nokogiri/css/parser.rb#451
293
+ # source://nokogiri//lib/nokogiri/css/parser.rb#453
267
294
  def _reduce_19(val, _values, result); end
268
295
 
269
- # source://nokogiri//lib/nokogiri/css/parser.rb#367
296
+ # source://nokogiri//lib/nokogiri/css/parser.rb#369
270
297
  def _reduce_2(val, _values, result); end
271
298
 
272
299
  # reduce 20 omitted
273
300
  #
274
- # source://nokogiri//lib/nokogiri/css/parser.rb#458
301
+ # source://nokogiri//lib/nokogiri/css/parser.rb#460
275
302
  def _reduce_21(val, _values, result); end
276
303
 
277
304
  # reduce 22 omitted
278
305
  #
279
- # source://nokogiri//lib/nokogiri/css/parser.rb#465
306
+ # source://nokogiri//lib/nokogiri/css/parser.rb#467
280
307
  def _reduce_23(val, _values, result); end
281
308
 
282
- # source://nokogiri//lib/nokogiri/css/parser.rb#470
309
+ # source://nokogiri//lib/nokogiri/css/parser.rb#472
283
310
  def _reduce_24(val, _values, result); end
284
311
 
285
- # source://nokogiri//lib/nokogiri/css/parser.rb#475
312
+ # source://nokogiri//lib/nokogiri/css/parser.rb#477
286
313
  def _reduce_25(val, _values, result); end
287
314
 
288
- # source://nokogiri//lib/nokogiri/css/parser.rb#482
315
+ # source://nokogiri//lib/nokogiri/css/parser.rb#484
289
316
  def _reduce_26(val, _values, result); end
290
317
 
291
318
  # reduce 27 omitted
292
319
  #
293
- # source://nokogiri//lib/nokogiri/css/parser.rb#489
320
+ # source://nokogiri//lib/nokogiri/css/parser.rb#491
294
321
  def _reduce_28(val, _values, result); end
295
322
 
296
- # source://nokogiri//lib/nokogiri/css/parser.rb#495
323
+ # source://nokogiri//lib/nokogiri/css/parser.rb#497
297
324
  def _reduce_29(val, _values, result); end
298
325
 
299
- # source://nokogiri//lib/nokogiri/css/parser.rb#372
326
+ # source://nokogiri//lib/nokogiri/css/parser.rb#374
300
327
  def _reduce_3(val, _values, result); end
301
328
 
302
- # source://nokogiri//lib/nokogiri/css/parser.rb#501
329
+ # source://nokogiri//lib/nokogiri/css/parser.rb#503
303
330
  def _reduce_30(val, _values, result); end
304
331
 
305
- # source://nokogiri//lib/nokogiri/css/parser.rb#507
332
+ # source://nokogiri//lib/nokogiri/css/parser.rb#509
306
333
  def _reduce_31(val, _values, result); end
307
334
 
308
- # source://nokogiri//lib/nokogiri/css/parser.rb#512
335
+ # source://nokogiri//lib/nokogiri/css/parser.rb#514
309
336
  def _reduce_32(val, _values, result); end
310
337
 
311
338
  # reduce 33 omitted
312
339
  #
313
- # source://nokogiri//lib/nokogiri/css/parser.rb#519
340
+ # source://nokogiri//lib/nokogiri/css/parser.rb#521
314
341
  def _reduce_34(val, _values, result); end
315
342
 
316
- # source://nokogiri//lib/nokogiri/css/parser.rb#525
343
+ # source://nokogiri//lib/nokogiri/css/parser.rb#527
317
344
  def _reduce_35(val, _values, result); end
318
345
 
319
- # source://nokogiri//lib/nokogiri/css/parser.rb#531
346
+ # source://nokogiri//lib/nokogiri/css/parser.rb#533
320
347
  def _reduce_36(val, _values, result); end
321
348
 
322
- # source://nokogiri//lib/nokogiri/css/parser.rb#537
349
+ # source://nokogiri//lib/nokogiri/css/parser.rb#539
323
350
  def _reduce_37(val, _values, result); end
324
351
 
325
- # source://nokogiri//lib/nokogiri/css/parser.rb#543
352
+ # source://nokogiri//lib/nokogiri/css/parser.rb#545
326
353
  def _reduce_38(val, _values, result); end
327
354
 
328
- # source://nokogiri//lib/nokogiri/css/parser.rb#549
355
+ # source://nokogiri//lib/nokogiri/css/parser.rb#551
329
356
  def _reduce_39(val, _values, result); end
330
357
 
331
- # source://nokogiri//lib/nokogiri/css/parser.rb#377
358
+ # source://nokogiri//lib/nokogiri/css/parser.rb#379
332
359
  def _reduce_4(val, _values, result); end
333
360
 
334
- # source://nokogiri//lib/nokogiri/css/parser.rb#554
361
+ # source://nokogiri//lib/nokogiri/css/parser.rb#556
335
362
  def _reduce_40(val, _values, result); end
336
363
 
337
- # source://nokogiri//lib/nokogiri/css/parser.rb#559
364
+ # source://nokogiri//lib/nokogiri/css/parser.rb#561
338
365
  def _reduce_41(val, _values, result); end
339
366
 
340
- # source://nokogiri//lib/nokogiri/css/parser.rb#564
367
+ # source://nokogiri//lib/nokogiri/css/parser.rb#566
341
368
  def _reduce_42(val, _values, result); end
342
369
 
343
370
  # reduce 44 omitted
344
371
  #
345
- # source://nokogiri//lib/nokogiri/css/parser.rb#573
372
+ # source://nokogiri//lib/nokogiri/css/parser.rb#575
346
373
  def _reduce_45(val, _values, result); end
347
374
 
348
375
  # reduce 46 omitted
349
376
  #
350
- # source://nokogiri//lib/nokogiri/css/parser.rb#590
377
+ # source://nokogiri//lib/nokogiri/css/parser.rb#592
351
378
  def _reduce_47(val, _values, result); end
352
379
 
353
- # source://nokogiri//lib/nokogiri/css/parser.rb#600
380
+ # source://nokogiri//lib/nokogiri/css/parser.rb#602
354
381
  def _reduce_48(val, _values, result); end
355
382
 
356
- # source://nokogiri//lib/nokogiri/css/parser.rb#616
383
+ # source://nokogiri//lib/nokogiri/css/parser.rb#618
357
384
  def _reduce_49(val, _values, result); end
358
385
 
359
- # source://nokogiri//lib/nokogiri/css/parser.rb#382
386
+ # source://nokogiri//lib/nokogiri/css/parser.rb#384
360
387
  def _reduce_5(val, _values, result); end
361
388
 
362
- # source://nokogiri//lib/nokogiri/css/parser.rb#636
389
+ # source://nokogiri//lib/nokogiri/css/parser.rb#638
363
390
  def _reduce_50(val, _values, result); end
364
391
 
365
- # source://nokogiri//lib/nokogiri/css/parser.rb#642
392
+ # source://nokogiri//lib/nokogiri/css/parser.rb#644
366
393
  def _reduce_51(val, _values, result); end
367
394
 
368
395
  # reduce 53 omitted
369
396
  #
370
- # source://nokogiri//lib/nokogiri/css/parser.rb#651
397
+ # source://nokogiri//lib/nokogiri/css/parser.rb#653
371
398
  def _reduce_54(val, _values, result); end
372
399
 
373
- # source://nokogiri//lib/nokogiri/css/parser.rb#657
400
+ # source://nokogiri//lib/nokogiri/css/parser.rb#659
374
401
  def _reduce_55(val, _values, result); end
375
402
 
376
- # source://nokogiri//lib/nokogiri/css/parser.rb#663
403
+ # source://nokogiri//lib/nokogiri/css/parser.rb#665
377
404
  def _reduce_56(val, _values, result); end
378
405
 
379
- # source://nokogiri//lib/nokogiri/css/parser.rb#669
406
+ # source://nokogiri//lib/nokogiri/css/parser.rb#671
380
407
  def _reduce_57(val, _values, result); end
381
408
 
382
- # source://nokogiri//lib/nokogiri/css/parser.rb#675
409
+ # source://nokogiri//lib/nokogiri/css/parser.rb#677
383
410
  def _reduce_58(val, _values, result); end
384
411
 
385
- # source://nokogiri//lib/nokogiri/css/parser.rb#387
412
+ # source://nokogiri//lib/nokogiri/css/parser.rb#389
386
413
  def _reduce_6(val, _values, result); end
387
414
 
388
415
  # reduce 63 omitted
389
416
  #
390
- # source://nokogiri//lib/nokogiri/css/parser.rb#691
417
+ # source://nokogiri//lib/nokogiri/css/parser.rb#693
391
418
  def _reduce_64(val, _values, result); end
392
419
 
393
- # source://nokogiri//lib/nokogiri/css/parser.rb#696
420
+ # source://nokogiri//lib/nokogiri/css/parser.rb#698
394
421
  def _reduce_65(val, _values, result); end
395
422
 
396
- # source://nokogiri//lib/nokogiri/css/parser.rb#701
423
+ # source://nokogiri//lib/nokogiri/css/parser.rb#703
397
424
  def _reduce_66(val, _values, result); end
398
425
 
399
- # source://nokogiri//lib/nokogiri/css/parser.rb#706
426
+ # source://nokogiri//lib/nokogiri/css/parser.rb#708
400
427
  def _reduce_67(val, _values, result); end
401
428
 
402
429
  # reduce 68 omitted
403
430
  #
404
- # source://nokogiri//lib/nokogiri/css/parser.rb#713
431
+ # source://nokogiri//lib/nokogiri/css/parser.rb#715
405
432
  def _reduce_69(val, _values, result); end
406
433
 
407
- # source://nokogiri//lib/nokogiri/css/parser.rb#392
434
+ # source://nokogiri//lib/nokogiri/css/parser.rb#394
408
435
  def _reduce_7(val, _values, result); end
409
436
 
410
- # source://nokogiri//lib/nokogiri/css/parser.rb#718
437
+ # source://nokogiri//lib/nokogiri/css/parser.rb#720
411
438
  def _reduce_70(val, _values, result); end
412
439
 
413
- # source://nokogiri//lib/nokogiri/css/parser.rb#723
440
+ # source://nokogiri//lib/nokogiri/css/parser.rb#725
414
441
  def _reduce_71(val, _values, result); end
415
442
 
416
- # source://nokogiri//lib/nokogiri/css/parser.rb#728
443
+ # source://nokogiri//lib/nokogiri/css/parser.rb#730
417
444
  def _reduce_72(val, _values, result); end
418
445
 
419
- # source://nokogiri//lib/nokogiri/css/parser.rb#733
446
+ # source://nokogiri//lib/nokogiri/css/parser.rb#735
420
447
  def _reduce_73(val, _values, result); end
421
448
 
422
- # source://nokogiri//lib/nokogiri/css/parser.rb#738
449
+ # source://nokogiri//lib/nokogiri/css/parser.rb#740
423
450
  def _reduce_74(val, _values, result); end
424
451
 
425
- # source://nokogiri//lib/nokogiri/css/parser.rb#743
452
+ # source://nokogiri//lib/nokogiri/css/parser.rb#745
426
453
  def _reduce_75(val, _values, result); end
427
454
 
428
- # source://nokogiri//lib/nokogiri/css/parser.rb#748
455
+ # source://nokogiri//lib/nokogiri/css/parser.rb#750
429
456
  def _reduce_76(val, _values, result); end
430
457
 
431
- # source://nokogiri//lib/nokogiri/css/parser.rb#397
458
+ # source://nokogiri//lib/nokogiri/css/parser.rb#399
432
459
  def _reduce_8(val, _values, result); end
433
460
 
434
- # source://nokogiri//lib/nokogiri/css/parser.rb#402
461
+ # source://nokogiri//lib/nokogiri/css/parser.rb#404
435
462
  def _reduce_9(val, _values, result); end
436
463
 
437
464
  # reduce 81 omitted
438
465
  #
439
- # source://nokogiri//lib/nokogiri/css/parser.rb#764
466
+ # source://nokogiri//lib/nokogiri/css/parser.rb#766
440
467
  def _reduce_none(val, _values, result); end
441
468
 
442
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#89
443
- def cache_key(query, prefix, visitor); end
444
-
445
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#71
469
+ # source://nokogiri//lib/nokogiri/css/parser_extras.rb#18
446
470
  def next_token; end
447
471
 
448
472
  # On CSS parser error, raise an exception
449
473
  #
450
474
  # @raise [SyntaxError]
451
475
  #
452
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#84
476
+ # source://nokogiri//lib/nokogiri/css/parser_extras.rb#30
453
477
  def on_error(error_token_id, error_value, value_stack); end
454
478
 
455
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#66
479
+ # source://nokogiri//lib/nokogiri/css/parser_extras.rb#13
456
480
  def parse(string); end
457
481
 
458
482
  # source://nokogiri//lib/nokogiri/css/parser.rb#26
@@ -461,58 +485,46 @@ class Nokogiri::CSS::Parser < ::Racc::Parser
461
485
  # source://nokogiri//lib/nokogiri/css/parser.rb#30
462
486
  def unescape_css_string(str); end
463
487
 
464
- # Get the xpath for +string+ using +options+
488
+ # Get the xpath for +selector+ using +visitor+
465
489
  #
466
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#76
467
- def xpath_for(string, prefix, visitor); end
490
+ # source://nokogiri//lib/nokogiri/css/parser_extras.rb#23
491
+ def xpath_for(selector, visitor); end
492
+ end
468
493
 
469
- class << self
470
- # Get the css selector in +string+ from the cache
471
- #
472
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#25
473
- def [](string); end
494
+ # source://nokogiri//lib/nokogiri/css/parser.rb#279
495
+ Nokogiri::CSS::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
474
496
 
475
- # Set the css selector in +string+ in the cache to +value+
476
- #
477
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#32
478
- def []=(string, value); end
497
+ # source://nokogiri//lib/nokogiri/css/parser.rb#357
498
+ Nokogiri::CSS::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass)
499
+
500
+ # source://nokogiri//lib/nokogiri/css/parser.rb#296
501
+ Nokogiri::CSS::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
479
502
 
480
- # Return a thread-local boolean indicating whether the CSS-to-XPath cache is active. (Default is `true`.)
503
+ # source://nokogiri//lib/nokogiri/css/selector_cache.rb#5
504
+ module Nokogiri::CSS::SelectorCache
505
+ class << self
506
+ # Retrieve the cached XPath expressions for the key
481
507
  #
482
- # @return [Boolean]
508
+ # source://nokogiri//lib/nokogiri/css/selector_cache.rb#11
509
+ def [](key); end
510
+
511
+ # Insert the XPath expressions `value` at the cache key
483
512
  #
484
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#15
485
- def cache_on?; end
513
+ # source://nokogiri//lib/nokogiri/css/selector_cache.rb#16
514
+ def []=(key, value); end
486
515
 
487
516
  # Clear the cache
488
517
  #
489
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#39
518
+ # source://nokogiri//lib/nokogiri/css/selector_cache.rb#21
490
519
  def clear_cache(create_new_object = T.unsafe(nil)); end
491
520
 
492
- # Set a thread-local boolean to turn cacheing on and off. Truthy values turn the cache on, falsey values turn the cache off.
493
- #
494
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#20
495
- def set_cache(value); end
496
-
497
- # Execute +block+ without cache
521
+ # Construct a unique key cache key
498
522
  #
499
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#50
500
- def without_cache(&block); end
523
+ # source://nokogiri//lib/nokogiri/css/selector_cache.rb#32
524
+ def key(selector:, visitor:); end
501
525
  end
502
526
  end
503
527
 
504
- # source://nokogiri//lib/nokogiri/css/parser_extras.rb#8
505
- Nokogiri::CSS::Parser::CACHE_SWITCH_NAME = T.let(T.unsafe(nil), Symbol)
506
-
507
- # source://nokogiri//lib/nokogiri/css/parser.rb#279
508
- Nokogiri::CSS::Parser::Racc_arg = T.let(T.unsafe(nil), Array)
509
-
510
- # source://nokogiri//lib/nokogiri/css/parser.rb#355
511
- Nokogiri::CSS::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass)
512
-
513
- # source://nokogiri//lib/nokogiri/css/parser.rb#295
514
- Nokogiri::CSS::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
515
-
516
528
  # source://nokogiri//lib/nokogiri/css/syntax_error.rb#6
517
529
  class Nokogiri::CSS::SyntaxError < ::Nokogiri::SyntaxError; end
518
530
 
@@ -586,83 +598,106 @@ class Nokogiri::CSS::XPathVisitor
586
598
  #
587
599
  # @return [XPathVisitor] a new instance of XPathVisitor
588
600
  #
589
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#57
590
- def initialize(builtins: T.unsafe(nil), doctype: T.unsafe(nil)); end
601
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#69
602
+ def initialize(builtins: T.unsafe(nil), doctype: T.unsafe(nil), prefix: T.unsafe(nil), namespaces: T.unsafe(nil)); end
591
603
 
592
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#267
604
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#298
593
605
  def accept(node); end
594
606
 
607
+ # The visitor configuration set via the +builtins:+ keyword argument to XPathVisitor.new.
608
+ #
609
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#48
610
+ def builtins; end
611
+
595
612
  # :call-seq: config() → Hash
596
613
  #
597
614
  # [Returns]
598
615
  # a Hash representing the configuration of the XPathVisitor, suitable for use as
599
616
  # part of the CSS cache key.
600
617
  #
601
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#74
618
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#93
602
619
  def config; end
603
620
 
604
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#263
621
+ # The visitor configuration set via the +doctype:+ keyword argument to XPathVisitor.new.
622
+ #
623
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#51
624
+ def doctype; end
625
+
626
+ # The visitor configuration set via the +namespaces:+ keyword argument to XPathVisitor.new.
627
+ #
628
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#57
629
+ def namespaces; end
630
+
631
+ # The visitor configuration set via the +prefix:+ keyword argument to XPathVisitor.new.
632
+ #
633
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#54
634
+ def prefix; end
635
+
636
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#294
605
637
  def visit_attrib_name(node); end
606
638
 
607
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#154
639
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#175
608
640
  def visit_attribute_condition(node); end
609
641
 
610
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234
642
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#256
611
643
  def visit_child_selector(node); end
612
644
 
613
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#215
645
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#237
614
646
  def visit_class_condition(node); end
615
647
 
616
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#219
648
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#241
617
649
  def visit_combinator(node); end
618
650
 
619
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#240
651
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#262
620
652
  def visit_conditional_selector(node); end
621
653
 
622
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234
654
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#256
623
655
  def visit_descendant_selector(node); end
624
656
 
625
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234
657
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#256
626
658
  def visit_direct_adjacent_selector(node); end
627
659
 
628
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#245
660
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#267
629
661
  def visit_element_name(node); end
630
662
 
631
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234
663
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#256
632
664
  def visit_following_selector(node); end
633
665
 
634
666
  # :stopdoc:
635
667
  #
636
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#79
668
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#98
637
669
  def visit_function(node); end
638
670
 
639
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#149
671
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#170
640
672
  def visit_id(node); end
641
673
 
642
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#140
674
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#161
643
675
  def visit_not(node); end
644
676
 
645
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#190
677
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#211
646
678
  def visit_pseudo_class(node); end
647
679
 
648
680
  private
649
681
 
650
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#328
682
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#365
651
683
  def css_class(hay, needle); end
652
684
 
653
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#273
685
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#310
654
686
  def html5_element_name_needs_namespace_handling(node); end
655
687
 
656
688
  # @return [Boolean]
657
689
  #
658
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#318
690
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#355
659
691
  def is_of_type_pseudo_class?(node); end
660
692
 
661
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#280
693
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#317
662
694
  def nth(node, options = T.unsafe(nil)); end
663
695
 
664
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#304
696
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#341
665
697
  def read_a_and_positive_b(values); end
698
+
699
+ # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#304
700
+ def validate_xpath_function_name(name); end
666
701
  end
667
702
 
668
703
  # Enum to direct XPathVisitor when to use Nokogiri builtin XPath functions.
@@ -719,22 +754,6 @@ Nokogiri::CSS::XPathVisitor::DoctypeConfig::XML = T.let(T.unsafe(nil), Symbol)
719
754
  # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#10
720
755
  Nokogiri::CSS::XPathVisitor::WILDCARD_NAMESPACES = T.let(T.unsafe(nil), TrueClass)
721
756
 
722
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#339
723
- module Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins
724
- class << self
725
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#340
726
- def new; end
727
- end
728
- end
729
-
730
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#349
731
- module Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins
732
- class << self
733
- # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#350
734
- def new; end
735
- end
736
- end
737
-
738
757
  # Some classes in Nokogiri are namespaced as a group, for example
739
758
  # Document, DocumentFragment, and Builder.
740
759
  #
@@ -797,7 +816,7 @@ module Nokogiri::Decorators::Slop
797
816
 
798
817
  # @return [Boolean]
799
818
  #
800
- # source://nokogiri//lib/nokogiri/decorators/slop.rb#37
819
+ # source://nokogiri//lib/nokogiri/decorators/slop.rb#35
801
820
  def respond_to_missing?(name, include_private = T.unsafe(nil)); end
802
821
  end
803
822
 
@@ -830,8 +849,8 @@ Nokogiri::EncodingHandler::USEFUL_ALIASES = T.let(T.unsafe(nil), Hash)
830
849
  # source://nokogiri//lib/nokogiri/gumbo.rb#4
831
850
  module Nokogiri::Gumbo
832
851
  class << self
833
- def fragment(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
834
- def parse(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
852
+ def fragment(*_arg0); end
853
+ def parse(*_arg0); end
835
854
  end
836
855
  end
837
856
 
@@ -863,18 +882,18 @@ Nokogiri::HTML = Nokogiri::HTML4
863
882
  # 💡 Before v1.12.0, Nokogiri::HTML4 did not exist, and Nokogiri::HTML was the module/namespace
864
883
  # for parsing HTML.
865
884
  #
866
- # source://nokogiri//lib/nokogiri/html4.rb#19
885
+ # source://nokogiri//lib/nokogiri/html4.rb#16
867
886
  module Nokogiri::HTML4
868
887
  class << self
869
- # Parse a fragment from +string+ in to a NodeSet.
888
+ # Convenience method for Nokogiri::HTML4::DocumentFragment.parse
870
889
  #
871
- # source://nokogiri//lib/nokogiri/html4.rb#29
872
- def fragment(string, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
890
+ # source://nokogiri//lib/nokogiri/html4.rb#24
891
+ def fragment(*_arg0, **_arg1, &_arg2); end
873
892
 
874
- # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse
893
+ # Convenience method for Nokogiri::HTML4::Document.parse
875
894
  #
876
- # source://nokogiri//lib/nokogiri/html4.rb#23
877
- def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
895
+ # source://nokogiri//lib/nokogiri/html4.rb#19
896
+ def parse(*_arg0, **_arg1, &_arg2); end
878
897
  end
879
898
  end
880
899
 
@@ -1002,18 +1021,34 @@ class Nokogiri::HTML4::Document < ::Nokogiri::XML::Document
1002
1021
  class << self
1003
1022
  def new(*_arg0); end
1004
1023
 
1005
- # Parse HTML. +string_or_io+ may be a String, or any object that
1006
- # responds to _read_ and _close_ such as an IO, or StringIO.
1007
- # +url+ is resource where this document is located. +encoding+ is the
1008
- # encoding that should be used when processing the document. +options+
1009
- # is a number that sets options in the parser, such as
1010
- # Nokogiri::XML::ParseOptions::RECOVER. See the constants in
1011
- # Nokogiri::XML::ParseOptions.
1024
+ # :call-seq:
1025
+ # parse(input) { |options| ... } => Nokogiri::HTML4::Document
1026
+ #
1027
+ # Parse \HTML4 input from a String or IO object, and return a new HTML4::Document.
1028
+ #
1029
+ # [Required Parameters]
1030
+ # - +input+ (String | IO) The content to be parsed.
1031
+ #
1032
+ # [Optional Keyword Arguments]
1033
+ # - +url:+ (String) The base URI for this document.
1034
+ #
1035
+ # document. When not provided, the encoding will be determined based on the document
1036
+ # content.
1037
+ #
1038
+ # - +options:+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
1039
+ # behaviors during parsing. See ParseOptions for more information. The default value is
1040
+ # +ParseOptions::DEFAULT_HTML+.
1041
+ #
1042
+ # [Yields]
1043
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
1044
+ # can be configured before parsing. See Nokogiri::XML::ParseOptions for more information.
1045
+ #
1046
+ # [Returns] Nokogiri::HTML4::Document
1012
1047
  #
1013
1048
  # @yield [options]
1014
1049
  #
1015
- # source://nokogiri//lib/nokogiri/html4/document.rb#172
1016
- def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
1050
+ # source://nokogiri//lib/nokogiri/html4/document.rb#189
1051
+ def parse(input, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), options_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), options: T.unsafe(nil)); end
1017
1052
 
1018
1053
  def read_io(_arg0, _arg1, _arg2, _arg3); end
1019
1054
  def read_memory(_arg0, _arg1, _arg2, _arg3); end
@@ -1022,17 +1057,93 @@ end
1022
1057
 
1023
1058
  # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#5
1024
1059
  class Nokogiri::HTML4::DocumentFragment < ::Nokogiri::XML::DocumentFragment
1060
+ # :call-seq:
1061
+ # new(document) { |options| ... } → HTML4::DocumentFragment
1062
+ # new(document, input) { |options| ... } → HTML4::DocumentFragment
1063
+ # new(document, input, context:, options:) { |options| ... } → HTML4::DocumentFragment
1064
+ #
1065
+ # Parse \HTML4 fragment input from a String, and return a new HTML4::DocumentFragment.
1066
+ #
1067
+ # 💡 It's recommended to use either HTML4::DocumentFragment.parse or XML::Node#parse rather
1068
+ # than call this method directly.
1069
+ #
1070
+ # [Required Parameters]
1071
+ # - +document+ (HTML4::Document) The parent document to associate the returned fragment with.
1072
+ #
1073
+ # [Optional Parameters]
1074
+ # - +input+ (String) The content to be parsed.
1075
+ #
1076
+ # [Optional Keyword Arguments]
1077
+ # - +context:+ (Nokogiri::XML::Node) The <b>context node</b> for the subtree created. See
1078
+ # below for more information.
1079
+ #
1080
+ # - +options:+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
1081
+ # behaviors during parsing. See ParseOptions for more information. The default value is
1082
+ # +ParseOptions::DEFAULT_HTML+.
1083
+ #
1084
+ # [Yields]
1085
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
1086
+ # can be configured before parsing. See ParseOptions for more information.
1087
+ #
1088
+ # [Returns] HTML4::DocumentFragment
1089
+ #
1090
+ # === Context \Node
1091
+ #
1092
+ # If a context node is specified using +context:+, then the fragment will be created by
1093
+ # calling XML::Node#parse on that node, so the parser will behave as if that Node is the
1094
+ # parent of the fragment subtree.
1095
+ #
1025
1096
  # @return [DocumentFragment] a new instance of DocumentFragment
1026
1097
  # @yield [options]
1027
1098
  #
1028
- # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#27
1029
- def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
1099
+ # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#134
1100
+ def initialize(document, input = T.unsafe(nil), context_ = T.unsafe(nil), options_ = T.unsafe(nil), context: T.unsafe(nil), options: T.unsafe(nil)); end
1030
1101
 
1031
1102
  class << self
1032
- # Create a Nokogiri::XML::DocumentFragment from +tags+, using +encoding+
1103
+ # :call-seq:
1104
+ # parse(input) { |options| ... } → HTML4::DocumentFragment
1105
+ #
1106
+ # Parse \HTML4 fragment input from a String, and return a new HTML4::DocumentFragment. This
1107
+ # method creates a new, empty HTML4::Document to contain the fragment.
1108
+ #
1109
+ # [Required Parameters]
1110
+ # - +input+ (String | IO) The content to be parsed.
1111
+ #
1112
+ # [Optional Keyword Arguments]
1113
+ # document. When not provided, the encoding will be determined based on the document
1114
+ # content.
1115
+ #
1116
+ # - +options:+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
1117
+ # behaviors during parsing. See ParseOptions for more information. The default value is
1118
+ # +ParseOptions::DEFAULT_HTML+.
1119
+ #
1120
+ # [Yields]
1121
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
1122
+ # can be configured before parsing. See ParseOptions for more information.
1033
1123
  #
1034
- # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#8
1035
- def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
1124
+ # [Returns] HTML4::DocumentFragment
1125
+ #
1126
+ # *Example:* Parsing a string
1127
+ #
1128
+ # fragment = HTML4::DocumentFragment.parse("<div>Hello World</div>")
1129
+ #
1130
+ # *Example:* Parsing an IO
1131
+ #
1132
+ # fragment = File.open("fragment.html") do |file|
1133
+ # HTML4::DocumentFragment.parse(file)
1134
+ # end
1135
+ #
1136
+ # *Example:* Specifying encoding
1137
+ #
1138
+ #
1139
+ # *Example:* Setting parse options dynamically
1140
+ #
1141
+ # HTML4::DocumentFragment.parse("<div>Hello World") do |options|
1142
+ # options.huge.pedantic
1143
+ # end
1144
+ #
1145
+ # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#52
1146
+ def parse(input, encoding_ = T.unsafe(nil), options_ = T.unsafe(nil), encoding: T.unsafe(nil), options: T.unsafe(nil), &block); end
1036
1147
  end
1037
1148
  end
1038
1149
 
@@ -1505,10 +1616,11 @@ end
1505
1616
 
1506
1617
  # Instance of Nokogiri::HTML4::EntityLookup
1507
1618
  #
1508
- # source://nokogiri//lib/nokogiri/html4.rb#35
1619
+ # source://nokogiri//lib/nokogiri/html4.rb#30
1509
1620
  Nokogiri::HTML4::NamedCharacters = T.let(T.unsafe(nil), Nokogiri::HTML4::EntityLookup)
1510
1621
 
1511
- # Nokogiri lets you write a SAX parser to process HTML but get HTML correction features.
1622
+ # Nokogiri provides a SAX parser to process HTML4 which will provide HTML recovery
1623
+ # ("autocorrection") features.
1512
1624
  #
1513
1625
  # See Nokogiri::HTML4::SAX::Parser for a basic example of using a SAX parser with HTML.
1514
1626
  #
@@ -1517,60 +1629,51 @@ Nokogiri::HTML4::NamedCharacters = T.let(T.unsafe(nil), Nokogiri::HTML4::EntityL
1517
1629
  # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#5
1518
1630
  module Nokogiri::HTML4::SAX; end
1519
1631
 
1520
- # This class lets you perform SAX style parsing on HTML with HTML error correction.
1632
+ # This parser is a SAX style parser that reads its input as it deems necessary. The parser
1633
+ # takes a Nokogiri::XML::SAX::Document, an optional encoding, then given an HTML input, sends
1634
+ # messages to the Nokogiri::XML::SAX::Document.
1635
+ #
1636
+ # ⚠ This is an HTML4 parser and so may not support some HTML5 features and behaviors.
1521
1637
  #
1522
1638
  # Here is a basic usage example:
1523
1639
  #
1524
- # class MyDoc < Nokogiri::XML::SAX::Document
1640
+ # class MyHandler < Nokogiri::XML::SAX::Document
1525
1641
  # def start_element name, attributes = []
1526
1642
  # puts "found a #{name}"
1527
1643
  # end
1528
1644
  # end
1529
1645
  #
1530
- # parser = Nokogiri::HTML4::SAX::Parser.new(MyDoc.new)
1531
- # parser.parse(File.read(ARGV[0], mode: 'rb'))
1646
+ # parser = Nokogiri::HTML4::SAX::Parser.new(MyHandler.new)
1532
1647
  #
1533
- # For more information on SAX parsers, see Nokogiri::XML::SAX
1648
+ # # Hand an IO object to the parser, which will read the HTML from the IO.
1649
+ # File.open(path_to_html) do |f|
1650
+ # parser.parse(f)
1651
+ # end
1652
+ #
1653
+ # For more information on \SAX parsers, see Nokogiri::XML::SAX or the parent class
1654
+ # Nokogiri::XML::SAX::Parser.
1655
+ #
1656
+ # Also see Nokogiri::XML::SAX::Document for the available events.
1534
1657
  #
1535
- # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#27
1658
+ # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#41
1536
1659
  class Nokogiri::HTML4::SAX::Parser < ::Nokogiri::XML::SAX::Parser
1537
- # Parse a file with +filename+
1538
- #
1539
- # @raise [ArgumentError]
1540
- # @yield [ctx]
1541
- #
1542
- # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#51
1543
- def parse_file(filename, encoding = T.unsafe(nil)); end
1544
-
1545
- # Parse given +io+
1546
- #
1547
- # @yield [ctx]
1548
- #
1549
- # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#41
1550
- def parse_io(io, encoding = T.unsafe(nil)); end
1660
+ private
1551
1661
 
1552
- # Parse html stored in +data+ using +encoding+
1553
- #
1554
- # @raise [TypeError]
1555
- # @yield [ctx]
1556
- #
1557
- # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#30
1558
- def parse_memory(data, encoding = T.unsafe(nil)); end
1662
+ def initialize_native; end
1559
1663
  end
1560
1664
 
1561
- # Context for HTML SAX parsers. This class is usually not instantiated by the user. Instead,
1562
- # you should be looking at Nokogiri::HTML4::SAX::Parser
1665
+ # Context object to invoke the HTML4 SAX parser on the SAX::Document handler.
1563
1666
  #
1564
- # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#9
1667
+ # 💡 This class is usually not instantiated by the user. Use Nokogiri::HTML4::SAX::Parser
1668
+ # instead.
1669
+ #
1670
+ # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#11
1565
1671
  class Nokogiri::HTML4::SAX::ParserContext < ::Nokogiri::XML::SAX::ParserContext
1566
1672
  def parse_with(_arg0); end
1567
1673
 
1568
1674
  class << self
1569
- def file(_arg0, _arg1); end
1570
- def memory(_arg0, _arg1); end
1571
-
1572
- # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#10
1573
- def new(thing, encoding = T.unsafe(nil)); end
1675
+ def native_file(_arg0, _arg1); end
1676
+ def native_memory(_arg0, _arg1); end
1574
1677
  end
1575
1678
  end
1576
1679
 
@@ -1619,34 +1722,36 @@ end
1619
1722
 
1620
1723
  # == Usage
1621
1724
  #
1622
- # ⚠ HTML5 functionality is not available when running JRuby.
1623
- #
1624
1725
  # Parse an HTML5 document:
1625
1726
  #
1626
- # doc = Nokogiri.HTML5(string)
1727
+ # doc = Nokogiri.HTML5(input)
1627
1728
  #
1628
1729
  # Parse an HTML5 fragment:
1629
1730
  #
1630
- # fragment = Nokogiri::HTML5.fragment(string)
1731
+ # fragment = Nokogiri::HTML5.fragment(input)
1732
+ #
1733
+ # ⚠ HTML5 functionality is not available when running JRuby.
1631
1734
  #
1632
1735
  # == Parsing options
1633
1736
  #
1634
- # The document and fragment parsing methods support options that are different from Nokogiri's.
1737
+ # The document and fragment parsing methods support options that are different from
1738
+ # Nokogiri::HTML4::Document or Nokogiri::XML::Document.
1635
1739
  #
1636
- # - <tt>Nokogiri.HTML5(html, url = nil, encoding = nil, options = {})</tt>
1637
- # - <tt>Nokogiri::HTML5.parse(html, url = nil, encoding = nil, options = {})</tt>
1638
- # - <tt>Nokogiri::HTML5::Document.parse(html, url = nil, encoding = nil, options = {})</tt>
1639
- # - <tt>Nokogiri::HTML5.fragment(html, encoding = nil, options = {})</tt>
1640
- # - <tt>Nokogiri::HTML5::DocumentFragment.parse(html, encoding = nil, options = {})</tt>
1641
1740
  #
1642
- # The three currently supported options are +:max_errors+, +:max_tree_depth+ and
1643
- # +:max_attributes+, described below.
1741
+ # The four currently supported parse options are
1644
1742
  #
1645
- # === Error reporting
1743
+ # - +max_errors:+ (Integer, default 0) Maximum number of parse errors to report in HTML5::Document#errors.
1744
+ # - +max_tree_depth:+ (Integer, default +Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+) Maximum tree depth to parse.
1745
+ # - +max_attributes:+ (Integer, default +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+) Maximum number of attributes to parse per element.
1746
+ # - +parse_noscript_content_as_text:+ (Boolean, default false) When enabled, parse +noscript+ tag content as text, mimicking the behavior of web browsers.
1747
+ #
1748
+ # These options are explained in the following sections.
1749
+ #
1750
+ # === Error reporting: +max_errors:+
1646
1751
  #
1647
1752
  # Nokogiri contains an experimental HTML5 parse error reporting facility. By default, no parse
1648
1753
  # errors are reported but this can be configured by passing the +:max_errors+ option to
1649
- # {HTML5.parse} or {HTML5.fragment}.
1754
+ # HTML5.parse or HTML5.fragment.
1650
1755
  #
1651
1756
  # For example, this script:
1652
1757
  #
@@ -1672,20 +1777,21 @@ end
1672
1777
  #
1673
1778
  # Using <tt>max_errors: -1</tt> results in an unlimited number of errors being returned.
1674
1779
  #
1675
- # The errors returned by {HTML5::Document#errors} are instances of {Nokogiri::XML::SyntaxError}.
1780
+ # The errors returned by HTML5::Document#errors are instances of Nokogiri::XML::SyntaxError.
1676
1781
  #
1677
- # The {https://html.spec.whatwg.org/multipage/parsing.html#parse-errors HTML standard} defines a
1782
+ # The {HTML standard}[https://html.spec.whatwg.org/multipage/parsing.html#parse-errors] defines a
1678
1783
  # number of standard parse error codes. These error codes only cover the "tokenization" stage of
1679
1784
  # parsing HTML. The parse errors in the "tree construction" stage do not have standardized error
1680
1785
  # codes (yet).
1681
1786
  #
1682
- # As a convenience to Nokogiri users, the defined error codes are available via
1683
- # {Nokogiri::XML::SyntaxError#str1} method.
1787
+ # As a convenience to Nokogiri users, the defined error codes are available
1788
+ # via Nokogiri::XML::SyntaxError#str1 method.
1684
1789
  #
1685
1790
  # doc = Nokogiri::HTML5.parse('<span/>Hi there!</span foo=bar />', max_errors: 10)
1686
1791
  # doc.errors.each do |err|
1687
1792
  # puts("#{err.line}:#{err.column}: #{err.str1}")
1688
1793
  # end
1794
+ # doc = Nokogiri::HTML5.parse('<span/>Hi there!</span foo=bar />',
1689
1795
  # # => 1:1: generic-parser
1690
1796
  # # 1:1: non-void-html-element-start-tag-with-trailing-solidus
1691
1797
  # # 1:17: end-tag-with-trailing-solidus
@@ -1698,40 +1804,75 @@ end
1698
1804
  # are not part of Nokogiri's public API. That is, these are subject to change without Nokogiri's
1699
1805
  # major version number changing. These may be stabilized in the future.
1700
1806
  #
1701
- # === Maximum tree depth
1807
+ # === Maximum tree depth: +max_tree_depth:+
1702
1808
  #
1703
1809
  # The maximum depth of the DOM tree parsed by the various parsing methods is configurable by the
1704
1810
  # +:max_tree_depth+ option. If the depth of the tree would exceed this limit, then an
1705
- # {::ArgumentError} is thrown.
1811
+ # +ArgumentError+ is thrown.
1706
1812
  #
1707
- # This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = 400</tt>) can be
1708
- # removed by giving the option <tt>max_tree_depth: -1</tt>.
1813
+ # This limit (which defaults to +Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+) can be removed by
1814
+ # giving the option <tt>max_tree_depth: -1</tt>.
1709
1815
  #
1710
1816
  # html = '<!DOCTYPE html>' + '<div>' * 1000
1711
1817
  # doc = Nokogiri.HTML5(html)
1712
1818
  # # raises ArgumentError: Document tree depth limit exceeded
1713
1819
  # doc = Nokogiri.HTML5(html, max_tree_depth: -1)
1714
1820
  #
1715
- # === Attribute limit per element
1821
+ # === Attribute limit per element: +max_attributes:+
1716
1822
  #
1717
1823
  # The maximum number of attributes per DOM element is configurable by the +:max_attributes+
1718
- # option. If a given element would exceed this limit, then an {::ArgumentError} is thrown.
1824
+ # option. If a given element would exceed this limit, then an +ArgumentError+ is thrown.
1719
1825
  #
1720
- # This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = 400</tt>) can be
1721
- # removed by giving the option <tt>max_attributes: -1</tt>.
1826
+ # This limit (which defaults to +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+) can be removed by
1827
+ # giving the option <tt>max_attributes: -1</tt>.
1722
1828
  #
1723
- # html = '<!DOCTYPE html><div ' + (1..1000).map { |x| "attr-#{x}" }.join(' ') + '>'
1829
+ # html = '<!DOCTYPE html><div ' + (1..1000).map { |x| "attr-#{x}" }.join(' # ') + '>'
1724
1830
  # # "<!DOCTYPE html><div attr-1 attr-2 attr-3 ... attr-1000>"
1725
1831
  # doc = Nokogiri.HTML5(html)
1726
1832
  # # raises ArgumentError: Attributes per element limit exceeded
1833
+ #
1727
1834
  # doc = Nokogiri.HTML5(html, max_attributes: -1)
1835
+ # # parses successfully
1836
+ #
1837
+ # === Parse +noscript+ elements' content as text: +parse_noscript_content_as_text:+
1838
+ #
1839
+ # By default, the content of +noscript+ elements is parsed as HTML elements. Browsers that
1840
+ # support scripting parse the content of +noscript+ elements as raw text.
1841
+ #
1842
+ # The +:parse_noscript_content_as_text+ option causes Nokogiri to parse the content of +noscript+
1843
+ # elements as a single text node.
1844
+ #
1845
+ # html = "<!DOCTYPE html><noscript><meta charset='UTF-8'><link rel=stylesheet href=!></noscript>"
1846
+ # doc = Nokogiri::HTML5.parse(html, parse_noscript_content_as_text: true)
1847
+ # pp doc.at_xpath("/html/head/noscript")
1848
+ # # => #(Element:0x878c {
1849
+ # # name = "noscript",
1850
+ # # children = [ #(Text "<meta charset='UTF-8'><link rel=stylesheet href=!>")]
1851
+ # # })
1852
+ #
1853
+ # In contrast, <tt>parse_noscript_content_as_text: false</tt> (the default) causes the +noscript+
1854
+ # element in the previous example to have two children, a +meta+ element and a +link+ element.
1855
+ #
1856
+ # doc = Nokogiri::HTML5.parse(html)
1857
+ # puts doc.at_xpath("/html/head/noscript")
1858
+ # # => #(Element:0x96b4 {
1859
+ # # name = "noscript",
1860
+ # # children = [
1861
+ # # #(Element:0x97e0 { name = "meta", attribute_nodes = [ #(Attr:0x990c { name = "charset", value = "UTF-8" })] }),
1862
+ # # #(Element:0x9b00 {
1863
+ # # name = "link",
1864
+ # # attribute_nodes = [
1865
+ # # #(Attr:0x9c2c { name = "rel", value = "stylesheet" }),
1866
+ # # #(Attr:0x9dd0 { name = "href", value = "!" })]
1867
+ # # })]
1868
+ # # })
1728
1869
  #
1729
1870
  # == HTML Serialization
1730
1871
  #
1731
- # After parsing HTML, it may be serialized using any of the {Nokogiri::XML::Node} serialization
1732
- # methods. In particular, {XML::Node#serialize}, {XML::Node#to_html}, and {XML::Node#to_s} will
1872
+ # After parsing HTML, it may be serialized using any of the Nokogiri::XML::Node serialization
1873
+ # methods. In particular, XML::Node#serialize, XML::Node#to_html, and XML::Node#to_s will
1733
1874
  # serialize a given node and its children. (This is the equivalent of JavaScript's
1734
- # +Element.outerHTML+.) Similarly, {XML::Node#inner_html} will serialize the children of a given
1875
+ # +Element.outerHTML+.) Similarly, XML::Node#inner_html will serialize the children of a given
1735
1876
  # node. (This is the equivalent of JavaScript's +Element.innerHTML+.)
1736
1877
  #
1737
1878
  # doc = Nokogiri::HTML5("<!DOCTYPE html><span>Hello world!</span>")
@@ -1739,12 +1880,12 @@ end
1739
1880
  # # => <!DOCTYPE html><html><head></head><body><span>Hello world!</span></body></html>
1740
1881
  #
1741
1882
  # Due to quirks in how HTML is parsed and serialized, it's possible for a DOM tree to be
1742
- # serialized and then re-parsed, resulting in a different DOM. Mostly, this happens with DOMs
1883
+ # serialized and then re-parsed, resulting in a different DOM. Mostly, this happens with DOMs
1743
1884
  # produced from invalid HTML. Unfortunately, even valid HTML may not survive serialization and
1744
1885
  # re-parsing.
1745
1886
  #
1746
- # In particular, a newline at the start of +pre+, +listing+, and +textarea+ elements is ignored by
1747
- # the parser.
1887
+ # In particular, a newline at the start of +pre+, +listing+, and +textarea+
1888
+ # elements is ignored by the parser.
1748
1889
  #
1749
1890
  # doc = Nokogiri::HTML5(<<-EOF)
1750
1891
  # <!DOCTYPE html>
@@ -1773,95 +1914,117 @@ end
1773
1914
  #
1774
1915
  # == Encodings
1775
1916
  #
1776
- # Nokogiri always parses HTML5 using {https://en.wikipedia.org/wiki/UTF-8 UTF-8}; however, the
1917
+ # Nokogiri always parses HTML5 using {UTF-8}[https://en.wikipedia.org/wiki/UTF-8]; however, the
1777
1918
  # encoding of the input can be explicitly selected via the optional +encoding+ parameter. This is
1778
1919
  # most useful when the input comes not from a string but from an IO object.
1779
1920
  #
1780
1921
  # When serializing a document or node, the encoding of the output string can be specified via the
1781
1922
  # +:encoding+ options. Characters that cannot be encoded in the selected encoding will be encoded
1782
- # as {https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references HTML numeric
1783
- # entities}.
1923
+ # as {HTML numeric
1924
+ # entities}[https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references].
1784
1925
  #
1785
1926
  # frag = Nokogiri::HTML5.fragment('<span>아는 길도 물어가라</span>')
1786
1927
  # puts html
1787
1928
  # # => <span>&#xc544;&#xb294; &#xae38;&#xb3c4; &#xbb3c;&#xc5b4;&#xac00;&#xb77c;</span>
1929
+ #
1788
1930
  # frag = Nokogiri::HTML5.fragment(html)
1789
1931
  # puts frag.serialize
1790
1932
  # # => <span>아는 길도 물어가라</span>
1791
1933
  #
1792
- # (There's a {https://bugs.ruby-lang.org/issues/15033 bug} in all current versions of Ruby that
1934
+ # (There's a {bug}[https://bugs.ruby-lang.org/issues/15033] in all current versions of Ruby that
1793
1935
  # can cause the entity encoding to fail. Of the mandated supported encodings for HTML, the only
1794
1936
  # encoding I'm aware of that has this bug is <tt>'ISO-2022-JP'</tt>. We recommend avoiding this
1795
1937
  # encoding.)
1796
1938
  #
1797
1939
  # == Notes
1798
1940
  #
1799
- # * The {Nokogiri::HTML5.fragment} function takes a string and parses it
1800
- # as a HTML5 document. The +<html>+, +<head>+, and +<body>+ elements are
1801
- # removed from this document, and any children of these elements that remain
1802
- # are returned as a {Nokogiri::HTML5::DocumentFragment}.
1941
+ # * The Nokogiri::HTML5.fragment function takes a String or IO and parses it as a HTML5 document
1942
+ # in a +body+ context. As a result, the +html+, +head+, and +body+ elements are removed from
1943
+ # this document, and any children of these elements that remain are returned as a
1944
+ # Nokogiri::HTML5::DocumentFragment; but you can pass in a different context (e.g., "html" to
1945
+ # get +head+ and +body+ tags in the result).
1803
1946
  #
1804
- # * The {Nokogiri::HTML5.parse} function takes a string and passes it to the
1805
- # <code>gumbo_parse_with_options</code> method, using the default options.
1806
- # The resulting Gumbo parse tree is then walked.
1947
+ # * The Nokogiri::HTML5.parse function takes a String or IO and passes it to the
1948
+ # <code>gumbo_parse_with_options</code> method, using the default options. The resulting Gumbo
1949
+ # parse tree is then walked.
1807
1950
  #
1808
1951
  # * Instead of uppercase element names, lowercase element names are produced.
1809
1952
  #
1810
- # * Instead of returning +unknown+ as the element name for unknown tags, the
1811
- # original tag name is returned verbatim.
1953
+ # * Instead of returning +unknown+ as the element name for unknown tags, the original tag name is
1954
+ # returned verbatim.
1812
1955
  #
1813
1956
  # Since v1.12.0
1814
1957
  #
1815
1958
  # source://nokogiri//lib/nokogiri/html5/document.rb#23
1816
1959
  module Nokogiri::HTML5
1817
1960
  class << self
1818
- # Parse a fragment from +string+. Convenience method for
1819
- # {Nokogiri::HTML5::DocumentFragment.parse}.
1961
+ # Convenience method for Nokogiri::HTML5::DocumentFragment.parse
1820
1962
  #
1821
- # source://nokogiri//lib/nokogiri/html5.rb#238
1822
- def fragment(string, encoding = T.unsafe(nil), **options); end
1963
+ # source://nokogiri//lib/nokogiri/html5.rb#280
1964
+ def fragment(*_arg0, **_arg1, &_arg2); end
1823
1965
 
1824
- # Fetch and parse a HTML document from the web, following redirects,
1825
- # handling https, and determining the character encoding using HTML5
1826
- # rules. +uri+ may be a +String+ or a +URI+. +options+ contains
1827
- # http headers and special options. Everything which is not a
1828
- # special option is considered a header. Special options include:
1829
- # * :follow_limit => number of redirects which are followed
1830
- # * :basic_auth => [username, password]
1966
+ # Convenience method for Nokogiri::HTML5::Document.parse
1831
1967
  #
1832
- # source://nokogiri//lib/nokogiri/html5.rb#249
1833
- def get(uri, options = T.unsafe(nil)); end
1968
+ # source://nokogiri//lib/nokogiri/html5.rb#275
1969
+ def parse(*_arg0, **_arg1, &_arg2); end
1834
1970
 
1835
- # Parse an HTML 5 document. Convenience method for {Nokogiri::HTML5::Document.parse}
1836
- #
1837
- # source://nokogiri//lib/nokogiri/html5.rb#232
1838
- def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
1839
-
1840
- # source://nokogiri//lib/nokogiri/html5.rb#260
1971
+ # source://nokogiri//lib/nokogiri/html5.rb#285
1841
1972
  def read_and_encode(string, encoding); end
1842
1973
 
1843
1974
  private
1844
1975
 
1845
- # source://nokogiri//lib/nokogiri/html5.rb#286
1846
- def get_impl(uri, options = T.unsafe(nil)); end
1847
-
1848
1976
  # Charset sniffing is a complex and controversial topic that understandably isn't done _by
1849
- # default_ by the Ruby Net::HTTP library. This being said, it is a very real problem for
1977
+ # default_ by the Ruby Net::HTTP library. This being said, it is a very real problem for
1850
1978
  # consumers of HTML as the default for HTML is iso-8859-1, most "good" producers use utf-8, and
1851
1979
  # the Gumbo parser *only* supports utf-8.
1852
1980
  #
1853
- # Accordingly, Nokogiri::HTML4::Document.parse provides limited encoding detection. Following
1981
+ # Accordingly, Nokogiri::HTML4::Document.parse provides limited encoding detection. Following
1854
1982
  # this lead, Nokogiri::HTML5 attempts to do likewise, while attempting to more closely follow
1855
1983
  # the HTML5 standard.
1856
1984
  #
1857
1985
  # http://bugs.ruby-lang.org/issues/2567
1858
1986
  # http://www.w3.org/TR/html5/syntax.html#determining-the-character-encoding
1859
1987
  #
1860
- # source://nokogiri//lib/nokogiri/html5.rb#347
1988
+ # source://nokogiri//lib/nokogiri/html5.rb#323
1861
1989
  def reencode(body, content_type = T.unsafe(nil)); end
1862
1990
  end
1863
1991
  end
1864
1992
 
1993
+ # Nokogiri HTML5 builder is used for building HTML documents. It is very similar to the
1994
+ # Nokogiri::XML::Builder. In fact, you should go read the documentation for
1995
+ # Nokogiri::XML::Builder before reading this documentation.
1996
+ #
1997
+ # The construction behavior is identical to HTML4::Builder, but HTML5 documents implement the
1998
+ # [HTML5 standard's serialization
1999
+ # algorithm](https://www.w3.org/TR/2008/WD-html5-20080610/serializing.html).
2000
+ #
2001
+ # == Synopsis:
2002
+ #
2003
+ # Create an HTML5 document with a body that has an onload attribute, and a
2004
+ # span tag with a class of "bold" that has content of "Hello world".
2005
+ #
2006
+ # builder = Nokogiri::HTML5::Builder.new do |doc|
2007
+ # doc.html {
2008
+ # doc.body(:onload => 'some_func();') {
2009
+ # doc.span.bold {
2010
+ # doc.text "Hello world"
2011
+ # }
2012
+ # }
2013
+ # }
2014
+ # end
2015
+ # puts builder.to_html
2016
+ #
2017
+ # The HTML5 builder inherits from the XML builder, so make sure to read the
2018
+ # Nokogiri::XML::Builder documentation.
2019
+ #
2020
+ # source://nokogiri//lib/nokogiri/html5/builder.rb#32
2021
+ class Nokogiri::HTML5::Builder < ::Nokogiri::XML::Builder
2022
+ # Convert the builder to HTML
2023
+ #
2024
+ # source://nokogiri//lib/nokogiri/html5/builder.rb#35
2025
+ def to_html; end
2026
+ end
2027
+
1865
2028
  # Since v1.12.0
1866
2029
  #
1867
2030
  # 💡 HTML5 functionality is not available when running JRuby.
@@ -1870,7 +2033,7 @@ end
1870
2033
  class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1871
2034
  # @return [Document] a new instance of Document
1872
2035
  #
1873
- # source://nokogiri//lib/nokogiri/html5/document.rb#129
2036
+ # source://nokogiri//lib/nokogiri/html5/document.rb#159
1874
2037
  def initialize(*args); end
1875
2038
 
1876
2039
  # :call-seq:
@@ -1883,21 +2046,22 @@ class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1883
2046
  # - +markup+ (String) The HTML5 markup fragment to be parsed
1884
2047
  #
1885
2048
  # [Returns]
1886
- # Nokogiri::HTML5::DocumentFragment. This object's children will be empty if `markup` is not passed, is empty, or is `nil`.
2049
+ # Nokogiri::HTML5::DocumentFragment. This object's children will be empty if +markup+ is not
2050
+ # passed, is empty, or is +nil+.
1887
2051
  #
1888
- # source://nokogiri//lib/nokogiri/html5/document.rb#147
2052
+ # source://nokogiri//lib/nokogiri/html5/document.rb#178
1889
2053
  def fragment(markup = T.unsafe(nil)); end
1890
2054
 
1891
2055
  # Get the parser's quirks mode value. See HTML5::QuirksMode.
1892
2056
  #
1893
- # This method returns `nil` if the parser was not invoked (e.g., `Nokogiri::HTML5::Document.new`).
2057
+ # This method returns +nil+ if the parser was not invoked (e.g., Nokogiri::HTML5::Document.new).
1894
2058
  #
1895
2059
  # Since v1.14.0
1896
2060
  #
1897
2061
  # source://nokogiri//lib/nokogiri/html5/document.rb#49
1898
2062
  def quirks_mode; end
1899
2063
 
1900
- # source://nokogiri//lib/nokogiri/html5/document.rb#151
2064
+ # source://nokogiri//lib/nokogiri/html5/document.rb#182
1901
2065
  def to_xml(options = T.unsafe(nil), &block); end
1902
2066
 
1903
2067
  # Get the url name for this document, as passed into Document.parse, Document.read_io, or
@@ -1913,42 +2077,60 @@ class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1913
2077
  #
1914
2078
  # See CSS::XPathVisitor for more information.
1915
2079
  #
1916
- # source://nokogiri//lib/nokogiri/html5/document.rb#163
2080
+ # source://nokogiri//lib/nokogiri/html5/document.rb#194
1917
2081
  def xpath_doctype; end
1918
2082
 
1919
2083
  class << self
1920
2084
  # :call-seq:
1921
- # parse(input)
1922
- # parse(input, url=nil, encoding=nil, **options)
1923
- # parse(input, url=nil, encoding=nil) { |options| ... }
2085
+ # parse(input) { |options| ... } → HTML5::Document
2086
+ # parse(input, **options) → HTML5::Document
1924
2087
  #
1925
- # Parse HTML5 input.
2088
+ # Parse \HTML input with a parser compliant with the HTML5 spec. This method uses the
2089
+ # parameter.
1926
2090
  #
1927
- # [Parameters]
1928
- # - +input+ may be a String, or any object that responds to _read_ and _close_ such as an
1929
- # IO, or StringIO.
2091
+ # [Required Parameters]
2092
+ # - +input+ (String | IO) the \HTML content to be parsed.
2093
+ #
2094
+ # [Optional Parameters]
2095
+ # - +url:+ (String) the base URI of the document.
1930
2096
  #
1931
- # - +url+ (optional) is a String indicating the canonical URI where this document is located.
2097
+ # [Optional Keyword Arguments]
2098
+ # document. When not provided, the encoding will be determined based on the document
2099
+ # content.
1932
2100
  #
1933
- # - +encoding+ (optional) is the encoding that should be used when processing
1934
- # the document.
2101
+ # - +max_errors:+ (Integer) The maximum number of parse errors to record. (default
2102
+ # +Nokogiri::Gumbo::DEFAULT_MAX_ERRORS+ which is currently 0)
1935
2103
  #
1936
- # - +options+ (optional) is a configuration Hash (or keyword arguments) to set options
1937
- # during parsing. The three currently supported options are +:max_errors+,
1938
- # +:max_tree_depth+ and +:max_attributes+, described at Nokogiri::HTML5.
2104
+ # - +max_tree_depth:+ (Integer) The maximum depth of the parse tree. (default
2105
+ # +Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+)
1939
2106
  #
1940
- # Note that these options are different than those made available by
1941
- # Nokogiri::XML::Document and Nokogiri::HTML4::Document.
2107
+ # - +max_attributes:+ (Integer) The maximum number of attributes allowed on an
2108
+ # element. (default +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+)
2109
+ #
2110
+ # - +parse_noscript_content_as_text:+ (Boolean) Whether to parse the content of +noscript+
2111
+ # elements as text. (default +false+)
2112
+ #
2113
+ # See rdoc-ref:HTML5@Parsing+options for a complete description of these parsing options.
2114
+ #
2115
+ # [Yields]
2116
+ # If present, the block will be passed a Hash object to modify with parse options before the
2117
+ # input is parsed. See rdoc-ref:HTML5@Parsing+options for a list of available options.
1942
2118
  #
1943
- # - +block+ (optional) is passed a configuration Hash on which parse options may be set. See
1944
- # Nokogiri::HTML5 for more information and usage.
1945
2119
  #
1946
2120
  # [Returns] Nokogiri::HTML5::Document
1947
2121
  #
2122
+ # *Example:* Parse a string with a specific encoding and custom max errors limit.
2123
+ #
2124
+ #
2125
+ # *Example:* Parse a string setting the +:parse_noscript_content_as_text+ option using the
2126
+ # configuration block parameter.
2127
+ #
2128
+ # Nokogiri::HTML5::Document.parse(input) { |c| c[:parse_noscript_content_as_text] = true }
2129
+ #
1948
2130
  # @yield [options]
1949
2131
  #
1950
- # source://nokogiri//lib/nokogiri/html5/document.rb#80
1951
- def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end
2132
+ # source://nokogiri//lib/nokogiri/html5/document.rb#103
2133
+ def parse(string_or_io, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), **options, &block); end
1952
2134
 
1953
2135
  # Create a new document from an IO object.
1954
2136
  #
@@ -1956,8 +2138,8 @@ class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1956
2138
  #
1957
2139
  # @raise [ArgumentError]
1958
2140
  #
1959
- # source://nokogiri//lib/nokogiri/html5/document.rb#101
1960
- def read_io(io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end
2141
+ # source://nokogiri//lib/nokogiri/html5/document.rb#129
2142
+ def read_io(io, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), **options); end
1961
2143
 
1962
2144
  # Create a new document from a String.
1963
2145
  #
@@ -1965,13 +2147,13 @@ class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document
1965
2147
  #
1966
2148
  # @raise [ArgumentError]
1967
2149
  #
1968
- # source://nokogiri//lib/nokogiri/html5/document.rb#110
1969
- def read_memory(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end
2150
+ # source://nokogiri//lib/nokogiri/html5/document.rb#138
2151
+ def read_memory(string, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), **options); end
1970
2152
 
1971
2153
  private
1972
2154
 
1973
- # source://nokogiri//lib/nokogiri/html5/document.rb#118
1974
- def do_parse(string_or_io, url, encoding, options); end
2155
+ # source://nokogiri//lib/nokogiri/html5/document.rb#146
2156
+ def do_parse(string_or_io, url, encoding, **options); end
1975
2157
  end
1976
2158
  end
1977
2159
 
@@ -1981,57 +2163,136 @@ end
1981
2163
  #
1982
2164
  # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#27
1983
2165
  class Nokogiri::HTML5::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
1984
- # Create a document fragment.
2166
+ # :call-seq:
2167
+ # new(document, input, **options) → HTML5::DocumentFragment
2168
+ #
2169
+ # Parse \HTML5 fragment input from a String, and return a new HTML5::DocumentFragment.
2170
+ #
2171
+ # 💡 It's recommended to use either HTML5::DocumentFragment.parse or HTML5::Node#fragment
2172
+ # rather than call this method directly.
2173
+ #
2174
+ # [Required Parameters]
2175
+ # - +document+ (HTML5::Document) The parent document to associate the returned fragment with.
2176
+ #
2177
+ # [Optional Parameters]
2178
+ # - +input+ (String) The content to be parsed.
2179
+ #
2180
+ # [Optional Keyword Arguments]
2181
+ # used when processing the document. When not provided, the encoding will be determined
2182
+ # based on the document content. Also see Nokogiri::HTML5 for a longer explanation of how
2183
+ # encoding is handled by the parser.
2184
+ #
2185
+ # - +context:+ (String | Nokogiri::XML::Node) The node, or the name of an HTML5 element, in
2186
+ # which to parse the document fragment. (default +"body"+)
2187
+ #
2188
+ # - +max_errors:+ (Integer) The maximum number of parse errors to record. (default
2189
+ # +Nokogiri::Gumbo::DEFAULT_MAX_ERRORS+ which is currently 0)
2190
+ #
2191
+ # - +max_tree_depth:+ (Integer) The maximum depth of the parse tree. (default
2192
+ # +Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+)
2193
+ #
2194
+ # - +max_attributes:+ (Integer) The maximum number of attributes allowed on an
2195
+ # element. (default +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+)
2196
+ #
2197
+ # - +parse_noscript_content_as_text:+ (Boolean) Whether to parse the content of +noscript+
2198
+ # elements as text. (default +false+)
2199
+ #
2200
+ # See rdoc-ref:HTML5@Parsing+options for a complete description of these parsing options.
2201
+ #
2202
+ # [Returns] HTML5::DocumentFragment
2203
+ #
2204
+ # === Context \Node
2205
+ #
2206
+ # If a context node is specified using +context:+, then the parser will behave as if that
2207
+ # Node, or a hypothetical tag named as specified, is the parent of the fragment subtree.
1985
2208
  #
1986
2209
  # @return [DocumentFragment] a new instance of DocumentFragment
1987
2210
  #
1988
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#39
1989
- def initialize(doc, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
2211
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#144
2212
+ def initialize(doc, input = T.unsafe(nil), context_ = T.unsafe(nil), positional_options_hash = T.unsafe(nil), context: T.unsafe(nil), **options); end
1990
2213
 
1991
2214
  # Returns the value of attribute document.
1992
2215
  #
1993
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#28
2216
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#88
1994
2217
  def document; end
1995
2218
 
1996
2219
  # Sets the attribute document
1997
2220
  #
1998
2221
  # @param value the value to set the attribute document to.
1999
2222
  #
2000
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#28
2223
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#88
2001
2224
  def document=(_arg0); end
2002
2225
 
2003
2226
  # Returns the value of attribute errors.
2004
2227
  #
2005
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#29
2228
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#89
2006
2229
  def errors; end
2007
2230
 
2008
2231
  # Sets the attribute errors
2009
2232
  #
2010
2233
  # @param value the value to set the attribute errors to.
2011
2234
  #
2012
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#29
2235
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#89
2013
2236
  def errors=(_arg0); end
2014
2237
 
2015
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#65
2238
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#175
2016
2239
  def extract_params(params); end
2017
2240
 
2018
2241
  # Get the parser's quirks mode value. See HTML5::QuirksMode.
2019
2242
  #
2020
- # This method returns `nil` if the parser was not invoked (e.g., `Nokogiri::HTML5::DocumentFragment.new(doc)`).
2243
+ # This method returns `nil` if the parser was not invoked (e.g.,
2244
+ # `Nokogiri::HTML5::DocumentFragment.new(doc)`).
2021
2245
  #
2022
2246
  # Since v1.14.0
2023
2247
  #
2024
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#36
2248
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#97
2025
2249
  def quirks_mode; end
2026
2250
 
2027
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#51
2251
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#169
2028
2252
  def serialize(options = T.unsafe(nil), &block); end
2029
2253
 
2030
2254
  class << self
2031
- # Parse a document fragment from +tags+, returning a Nodeset.
2255
+ # :call-seq:
2256
+ # parse(input, **options) → HTML5::DocumentFragment
2257
+ #
2258
+ # Parse \HTML5 fragment input from a String, and return a new HTML5::DocumentFragment. This
2259
+ # method creates a new, empty HTML5::Document to contain the fragment.
2260
+ #
2261
+ # [Parameters]
2262
+ # - +input+ (String | IO) The HTML5 document fragment to parse.
2263
+ #
2264
+ # [Optional Keyword Arguments]
2265
+ # used when processing the document. When not provided, the encoding will be determined
2266
+ # based on the document content. Also see Nokogiri::HTML5 for a longer explanation of how
2267
+ # encoding is handled by the parser.
2268
+ #
2269
+ # - +context:+ (String | Nokogiri::XML::Node) The node, or the name of an HTML5 element, "in
2270
+ # context" of which to parse the document fragment. See below for more
2271
+ # information. (default +"body"+)
2032
2272
  #
2033
- # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#58
2034
- def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil)); end
2273
+ # - +max_errors:+ (Integer) The maximum number of parse errors to record. (default
2274
+ # +Nokogiri::Gumbo::DEFAULT_MAX_ERRORS+ which is currently 0)
2275
+ #
2276
+ # - +max_tree_depth:+ (Integer) The maximum depth of the parse tree. (default
2277
+ # +Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH+)
2278
+ #
2279
+ # - +max_attributes:+ (Integer) The maximum number of attributes allowed on an
2280
+ # element. (default +Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES+)
2281
+ #
2282
+ # - +parse_noscript_content_as_text:+ (Boolean) Whether to parse the content of +noscript+
2283
+ # elements as text. (default +false+)
2284
+ #
2285
+ # See rdoc-ref:HTML5@Parsing+options for a complete description of these parsing options.
2286
+ #
2287
+ # [Returns] Nokogiri::HTML5::DocumentFragment
2288
+ #
2289
+ # === Context \Node
2290
+ #
2291
+ # If a context node is specified using +context:+, then the parser will behave as if that
2292
+ # Node, or a hypothetical tag named as specified, is the parent of the fragment subtree.
2293
+ #
2294
+ # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#69
2295
+ def parse(input, encoding_ = T.unsafe(nil), positional_options_hash = T.unsafe(nil), encoding: T.unsafe(nil), **options); end
2035
2296
  end
2036
2297
  end
2037
2298
 
@@ -2094,6 +2355,7 @@ Nokogiri::LIBXML_COMPILED_VERSION = T.let(T.unsafe(nil), String)
2094
2355
  Nokogiri::LIBXML_ICONV_ENABLED = T.let(T.unsafe(nil), TrueClass)
2095
2356
  Nokogiri::LIBXML_LOADED_VERSION = T.let(T.unsafe(nil), String)
2096
2357
  Nokogiri::LIBXML_MEMORY_MANAGEMENT = T.let(T.unsafe(nil), String)
2358
+ Nokogiri::LIBXML_ZLIB_ENABLED = T.let(T.unsafe(nil), TrueClass)
2097
2359
  Nokogiri::LIBXSLT_COMPILED_VERSION = T.let(T.unsafe(nil), String)
2098
2360
  Nokogiri::LIBXSLT_DATETIME_ENABLED = T.let(T.unsafe(nil), TrueClass)
2099
2361
  Nokogiri::LIBXSLT_LOADED_VERSION = T.let(T.unsafe(nil), String)
@@ -2118,7 +2380,7 @@ Nokogiri::VERSION = T.let(T.unsafe(nil), String)
2118
2380
 
2119
2381
  # Detailed version info about Nokogiri and the installed extension dependencies.
2120
2382
  #
2121
- # source://nokogiri//lib/nokogiri/version/info.rb#222
2383
+ # source://nokogiri//lib/nokogiri/version/info.rb#223
2122
2384
  Nokogiri::VERSION_INFO = T.let(T.unsafe(nil), Hash)
2123
2385
 
2124
2386
  # source://nokogiri//lib/nokogiri/version/info.rb#7
@@ -2182,7 +2444,7 @@ class Nokogiri::VersionInfo
2182
2444
  # source://nokogiri//lib/nokogiri/version/info.rb#88
2183
2445
  def to_hash; end
2184
2446
 
2185
- # source://nokogiri//lib/nokogiri/version/info.rb#180
2447
+ # source://nokogiri//lib/nokogiri/version/info.rb#181
2186
2448
  def to_markdown; end
2187
2449
 
2188
2450
  # source://nokogiri//lib/nokogiri/version/info.rb#72
@@ -2201,38 +2463,41 @@ class Nokogiri::VersionInfo
2201
2463
  end
2202
2464
  end
2203
2465
 
2204
- # source://nokogiri//lib/nokogiri/xml.rb#12
2466
+ # source://nokogiri//lib/nokogiri/xml.rb#11
2205
2467
  module Nokogiri::XML
2206
2468
  class << self
2207
- # Parse an XML document using the Nokogiri::XML::Reader API. See
2208
- # Nokogiri::XML::Reader for mor information
2469
+ # Convenience method for Nokogiri::XML::Reader.new
2209
2470
  #
2210
- # @yield [options]
2211
- #
2212
- # source://nokogiri//lib/nokogiri/xml.rb#23
2213
- def Reader(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
2471
+ # source://nokogiri//lib/nokogiri/xml.rb#21
2472
+ def Reader(*_arg0, **_arg1, &_arg2); end
2214
2473
 
2215
- # Create a new Nokogiri::XML::RelaxNG document from +string_or_io+.
2216
- # See Nokogiri::XML::RelaxNG for an example.
2474
+ # :call-seq:
2475
+ # RelaxNG(input) Nokogiri::XML::RelaxNG
2476
+ # RelaxNG(input, options:) → Nokogiri::XML::RelaxNG
2477
+ #
2478
+ # Convenience method for Nokogiri::XML::RelaxNG.new
2217
2479
  #
2218
- # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#9
2219
- def RelaxNG(string_or_io, options = T.unsafe(nil)); end
2480
+ # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#11
2481
+ def RelaxNG(*_arg0, **_arg1, &_arg2); end
2220
2482
 
2221
- # Create a new Nokogiri::XML::Schema object using a +string_or_io+
2222
- # object.
2483
+ # :call-seq:
2484
+ # Schema(input) → Nokogiri::XML::Schema
2485
+ # Schema(input, parse_options) → Nokogiri::XML::Schema
2486
+ #
2487
+ # Convenience method for Nokogiri::XML::Schema.new
2223
2488
  #
2224
- # source://nokogiri//lib/nokogiri/xml/schema.rb#9
2225
- def Schema(string_or_io, options = T.unsafe(nil)); end
2489
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#11
2490
+ def Schema(*_arg0, **_arg1, &_arg2); end
2226
2491
 
2227
- # Parse a fragment from +string+ in to a NodeSet.
2492
+ # Convenience method for Nokogiri::XML::DocumentFragment.parse
2228
2493
  #
2229
- # source://nokogiri//lib/nokogiri/xml.rb#42
2230
- def fragment(string, options = T.unsafe(nil), &block); end
2494
+ # source://nokogiri//lib/nokogiri/xml.rb#31
2495
+ def fragment(*_arg0, **_arg1, &_arg2); end
2231
2496
 
2232
- # Parse XML. Convenience method for Nokogiri::XML::Document.parse
2497
+ # Convenience method for Nokogiri::XML::Document.parse
2233
2498
  #
2234
- # source://nokogiri//lib/nokogiri/xml.rb#36
2235
- def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end
2499
+ # source://nokogiri//lib/nokogiri/xml.rb#26
2500
+ def parse(*_arg0, **_arg1, &_arg2); end
2236
2501
  end
2237
2502
  end
2238
2503
 
@@ -2249,8 +2514,6 @@ class Nokogiri::XML::Attr < ::Nokogiri::XML::Node
2249
2514
  # - +value+ → (String) The value of the attribute.
2250
2515
  # - +namespace+ → (Namespace, nil) The Namespace of the attribute, or +nil+ if there is no namespace.
2251
2516
  #
2252
- # ⚡ This is an experimental feature, available since v1.14.0
2253
- #
2254
2517
  # *Example*
2255
2518
  #
2256
2519
  # doc = Nokogiri::XML.parse(<<~XML)
@@ -2283,6 +2546,8 @@ class Nokogiri::XML::Attr < ::Nokogiri::XML::Node
2283
2546
  # # href = "http://nokogiri.org/ns/noko"
2284
2547
  # # })}
2285
2548
  #
2549
+ # Since v1.14.0
2550
+ #
2286
2551
  # source://nokogiri//lib/nokogiri/xml/attr.rb#55
2287
2552
  def deconstruct_keys(keys); end
2288
2553
 
@@ -2758,28 +3023,40 @@ class Nokogiri::XML::DTD < ::Nokogiri::XML::Node
2758
3023
  def validate(_arg0); end
2759
3024
  end
2760
3025
 
2761
- # Nokogiri::XML::Document is the main entry point for dealing with XML documents. The Document
2762
- # is created by parsing an XML document. See Nokogiri::XML::Document.parse for more information
2763
- # on parsing.
3026
+ # Nokogiri::XML::Document is the main entry point for dealing with \XML documents. The Document
3027
+ # is created by parsing \XML content from a String or an IO object. See
3028
+ # Nokogiri::XML::Document.parse for more information on parsing.
2764
3029
  #
2765
- # For searching a Document, see Nokogiri::XML::Searchable#css and
2766
- # Nokogiri::XML::Searchable#xpath
3030
+ # Document inherits a great deal of functionality from its superclass Nokogiri::XML::Node, so
3031
+ # please read that class's documentation as well.
2767
3032
  #
2768
3033
  # source://nokogiri//lib/nokogiri/xml/document.rb#14
2769
3034
  class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2770
3035
  # @return [Document] a new instance of Document
2771
3036
  #
2772
- # source://nokogiri//lib/nokogiri/xml/document.rb#178
3037
+ # source://nokogiri//lib/nokogiri/xml/document.rb#190
2773
3038
  def initialize(*args); end
2774
3039
 
2775
- # source://nokogiri//lib/nokogiri/xml/document.rb#394
3040
+ # source://nokogiri//lib/nokogiri/xml/document.rb#437
2776
3041
  def <<(node_or_tags); end
2777
3042
 
2778
- # source://nokogiri//lib/nokogiri/xml/document.rb#394
3043
+ # source://nokogiri//lib/nokogiri/xml/document.rb#437
2779
3044
  def add_child(node_or_tags); end
2780
3045
 
2781
3046
  def canonicalize(*_arg0); end
2782
- def clone(*_arg0); end
3047
+
3048
+ # :call-seq:
3049
+ # clone → Nokogiri::XML::Document
3050
+ # clone(level) → Nokogiri::XML::Document
3051
+ #
3052
+ # Clone this node.
3053
+ #
3054
+ # [Parameters]
3055
+ # - +level+ (optional Integer). 0 is a shallow copy, 1 (the default) is a deep copy.
3056
+ # [Returns] The new Nokogiri::XML::Document
3057
+ #
3058
+ # source://nokogiri//lib/nokogiri/xml/document.rb#223
3059
+ def clone(level = T.unsafe(nil)); end
2783
3060
 
2784
3061
  # :call-seq:
2785
3062
  # collect_namespaces() → Hash<String(Namespace#prefix) ⇒ String(Namespace#href)>
@@ -2817,17 +3094,17 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2817
3094
  #
2818
3095
  # {"xmlns:foo" => "baz"}
2819
3096
  #
2820
- # source://nokogiri//lib/nokogiri/xml/document.rb#317
3097
+ # source://nokogiri//lib/nokogiri/xml/document.rb#361
2821
3098
  def collect_namespaces; end
2822
3099
 
2823
3100
  # Create a CDATA Node containing +string+
2824
3101
  #
2825
- # source://nokogiri//lib/nokogiri/xml/document.rb#262
3102
+ # source://nokogiri//lib/nokogiri/xml/document.rb#306
2826
3103
  def create_cdata(string, &block); end
2827
3104
 
2828
3105
  # Create a Comment Node containing +string+
2829
3106
  #
2830
- # source://nokogiri//lib/nokogiri/xml/document.rb#267
3107
+ # source://nokogiri//lib/nokogiri/xml/document.rb#311
2831
3108
  def create_comment(string, &block); end
2832
3109
 
2833
3110
  # :call-seq:
@@ -2878,14 +3155,14 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2878
3155
  #
2879
3156
  # doc.create_element("div") { |node| node["class"] = "blue" if before_noon? }
2880
3157
  #
2881
- # source://nokogiri//lib/nokogiri/xml/document.rb#232
3158
+ # source://nokogiri//lib/nokogiri/xml/document.rb#276
2882
3159
  def create_element(name, *contents_or_attrs, &block); end
2883
3160
 
2884
3161
  def create_entity(*_arg0); end
2885
3162
 
2886
3163
  # Create a Text Node with +string+
2887
3164
  #
2888
- # source://nokogiri//lib/nokogiri/xml/document.rb#257
3165
+ # source://nokogiri//lib/nokogiri/xml/document.rb#301
2889
3166
  def create_text_node(string, &block); end
2890
3167
 
2891
3168
  # :call-seq: deconstruct_keys(array_of_names) → Hash
@@ -2899,8 +3176,6 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2899
3176
  # instructions. If you have a use case and would like this functionality, please let us know
2900
3177
  # by opening an issue or a discussion on the github project.
2901
3178
  #
2902
- # ⚡ This is an experimental feature, available since v1.14.0
2903
- #
2904
3179
  # *Example*
2905
3180
  #
2906
3181
  # doc = Nokogiri::XML.parse(<<~XML)
@@ -2927,25 +3202,39 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2927
3202
  # doc.deconstruct_keys([:root])
2928
3203
  # # => {:root=>nil}
2929
3204
  #
2930
- # source://nokogiri//lib/nokogiri/xml/document.rb#458
3205
+ # Since v1.14.0
3206
+ #
3207
+ # source://nokogiri//lib/nokogiri/xml/document.rb#501
2931
3208
  def deconstruct_keys(keys); end
2932
3209
 
2933
3210
  # Apply any decorators to +node+
2934
3211
  #
2935
- # source://nokogiri//lib/nokogiri/xml/document.rb#365
3212
+ # source://nokogiri//lib/nokogiri/xml/document.rb#409
2936
3213
  def decorate(node); end
2937
3214
 
2938
3215
  # Get the list of decorators given +key+
2939
3216
  #
2940
- # source://nokogiri//lib/nokogiri/xml/document.rb#324
3217
+ # source://nokogiri//lib/nokogiri/xml/document.rb#368
2941
3218
  def decorators(key); end
2942
3219
 
2943
3220
  # A reference to +self+
2944
3221
  #
2945
- # source://nokogiri//lib/nokogiri/xml/document.rb#277
3222
+ # source://nokogiri//lib/nokogiri/xml/document.rb#321
2946
3223
  def document; end
2947
3224
 
2948
- def dup(*_arg0); end
3225
+ # :call-seq:
3226
+ # dup → Nokogiri::XML::Document
3227
+ # dup(level) → Nokogiri::XML::Document
3228
+ #
3229
+ # Duplicate this node.
3230
+ #
3231
+ # [Parameters]
3232
+ # - +level+ (optional Integer). 0 is a shallow copy, 1 (the default) is a deep copy.
3233
+ # [Returns] The new Nokogiri::XML::Document
3234
+ #
3235
+ # source://nokogiri//lib/nokogiri/xml/document.rb#207
3236
+ def dup(level = T.unsafe(nil)); end
3237
+
2949
3238
  def encoding; end
2950
3239
  def encoding=(_arg0); end
2951
3240
 
@@ -2953,25 +3242,25 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
2953
3242
  #
2954
3243
  # [Returns] Array<Nokogiri::XML::SyntaxError>
2955
3244
  #
2956
- # source://nokogiri//lib/nokogiri/xml/document.rb#128
3245
+ # source://nokogiri//lib/nokogiri/xml/document.rb#141
2957
3246
  def errors; end
2958
3247
 
2959
3248
  # The errors found while parsing a document.
2960
3249
  #
2961
3250
  # [Returns] Array<Nokogiri::XML::SyntaxError>
2962
3251
  #
2963
- # source://nokogiri//lib/nokogiri/xml/document.rb#128
3252
+ # source://nokogiri//lib/nokogiri/xml/document.rb#141
2964
3253
  def errors=(_arg0); end
2965
3254
 
2966
3255
  # Create a Nokogiri::XML::DocumentFragment from +tags+
2967
3256
  # Returns an empty fragment if +tags+ is nil.
2968
3257
  #
2969
- # source://nokogiri//lib/nokogiri/xml/document.rb#386
3258
+ # source://nokogiri//lib/nokogiri/xml/document.rb#429
2970
3259
  def fragment(tags = T.unsafe(nil)); end
2971
3260
 
2972
3261
  # The name of this document. Always returns "document"
2973
3262
  #
2974
- # source://nokogiri//lib/nokogiri/xml/document.rb#272
3263
+ # source://nokogiri//lib/nokogiri/xml/document.rb#316
2975
3264
  def name; end
2976
3265
 
2977
3266
  # When `true`, reparented elements without a namespace will inherit their new parent's
@@ -3020,7 +3309,7 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
3020
3309
  #
3021
3310
  # Since v1.12.4
3022
3311
  #
3023
- # source://nokogiri//lib/nokogiri/xml/document.rb#175
3312
+ # source://nokogiri//lib/nokogiri/xml/document.rb#188
3024
3313
  def namespace_inheritance; end
3025
3314
 
3026
3315
  # When `true`, reparented elements without a namespace will inherit their new parent's
@@ -3069,12 +3358,12 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
3069
3358
  #
3070
3359
  # Since v1.12.4
3071
3360
  #
3072
- # source://nokogiri//lib/nokogiri/xml/document.rb#175
3361
+ # source://nokogiri//lib/nokogiri/xml/document.rb#188
3073
3362
  def namespace_inheritance=(_arg0); end
3074
3363
 
3075
3364
  # Get the hash of namespaces on the root Nokogiri::XML::Node
3076
3365
  #
3077
- # source://nokogiri//lib/nokogiri/xml/document.rb#379
3366
+ # source://nokogiri//lib/nokogiri/xml/document.rb#422
3078
3367
  def namespaces; end
3079
3368
 
3080
3369
  def remove_namespaces!; end
@@ -3096,18 +3385,18 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
3096
3385
  # irb> doc.slop!
3097
3386
  # ... which does absolutely nothing.
3098
3387
  #
3099
- # source://nokogiri//lib/nokogiri/xml/document.rb#354
3388
+ # source://nokogiri//lib/nokogiri/xml/document.rb#398
3100
3389
  def slop!; end
3101
3390
 
3102
- # source://nokogiri//lib/nokogiri/xml/node.rb#1280
3391
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1364
3103
3392
  def to_xml(*args, &block); end
3104
3393
 
3105
3394
  def url; end
3106
3395
 
3107
- # Validate this Document against it's DTD. Returns a list of errors on
3396
+ # Validate this Document against its DTD. Returns a list of errors on
3108
3397
  # the document or +nil+ when there is no DTD.
3109
3398
  #
3110
- # source://nokogiri//lib/nokogiri/xml/document.rb#332
3399
+ # source://nokogiri//lib/nokogiri/xml/document.rb#376
3111
3400
  def validate; end
3112
3401
 
3113
3402
  def version; end
@@ -3119,46 +3408,53 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
3119
3408
  #
3120
3409
  # See XPathVisitor for more information.
3121
3410
  #
3122
- # source://nokogiri//lib/nokogiri/xml/document.rb#414
3411
+ # source://nokogiri//lib/nokogiri/xml/document.rb#457
3123
3412
  def xpath_doctype; end
3124
3413
 
3414
+ protected
3415
+
3416
+ def initialize_copy_with_args(_arg0, _arg1); end
3417
+
3125
3418
  private
3126
3419
 
3127
- # source://nokogiri//lib/nokogiri/xml/document.rb#466
3420
+ # source://nokogiri//lib/nokogiri/xml/document.rb#509
3128
3421
  def inspect_attributes; end
3129
3422
 
3130
3423
  class << self
3131
3424
  def new(*_arg0); end
3132
3425
 
3133
- # Parse an XML file.
3426
+ # call-seq:
3427
+ # parse(input) { |options| ... } => Nokogiri::XML::Document
3428
+ #
3429
+ # Parse \XML input from a String or IO object, and return a new XML::Document.
3134
3430
  #
3135
- # +string_or_io+ may be a String, or any object that responds to
3136
- # _read_ and _close_ such as an IO, or StringIO.
3431
+ # 🛡 By default, Nokogiri treats documents as untrusted, and so does not attempt to load DTDs
3432
+ # or access the network. See Nokogiri::XML::ParseOptions for a complete list of options; and
3433
+ # that module's DEFAULT_XML constant for what's set (and not set) by default.
3137
3434
  #
3138
- # +url+ (optional) is the URI where this document is located.
3435
+ # [Required Parameters]
3436
+ # - +input+ (String | IO) The content to be parsed.
3139
3437
  #
3140
- # +encoding+ (optional) is the encoding that should be used when processing
3141
- # the document.
3438
+ # [Optional Keyword Arguments]
3439
+ # - +url:+ (String) The base URI for this document.
3142
3440
  #
3143
- # +options+ (optional) is a configuration object that sets options during
3144
- # parsing, such as Nokogiri::XML::ParseOptions::RECOVER. See the
3145
- # Nokogiri::XML::ParseOptions for more information.
3441
+ # document. When not provided, the encoding will be determined based on the document
3442
+ # content.
3146
3443
  #
3147
- # +block+ (optional) is passed a configuration object on which
3148
- # parse options may be set.
3444
+ # - +options:+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
3445
+ # behaviors during parsing. See ParseOptions for more information. The default value is
3446
+ # +ParseOptions::DEFAULT_XML+.
3149
3447
  #
3150
- # By default, Nokogiri treats documents as untrusted, and so
3151
- # does not attempt to load DTDs or access the network. See
3152
- # Nokogiri::XML::ParseOptions for a complete list of options;
3153
- # and that module's DEFAULT_XML constant for what's set (and not
3154
- # set) by default.
3448
+ # [Yields]
3449
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
3450
+ # can be configured before parsing. See Nokogiri::XML::ParseOptions for more information.
3155
3451
  #
3156
- # Nokogiri.XML() is a convenience method which will call this method.
3452
+ # [Returns] Nokogiri::XML::Document
3157
3453
  #
3158
3454
  # @yield [options]
3159
3455
  #
3160
- # source://nokogiri//lib/nokogiri/xml/document.rb#48
3161
- def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end
3456
+ # source://nokogiri//lib/nokogiri/xml/document.rb#56
3457
+ def parse(string_or_io, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), options_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), options: T.unsafe(nil)); end
3162
3458
 
3163
3459
  def read_io(_arg0, _arg1, _arg2, _arg3); end
3164
3460
  def read_memory(_arg0, _arg1, _arg2, _arg3); end
@@ -3167,12 +3463,12 @@ class Nokogiri::XML::Document < ::Nokogiri::XML::Node
3167
3463
 
3168
3464
  # @return [Boolean]
3169
3465
  #
3170
- # source://nokogiri//lib/nokogiri/xml/document.rb#83
3466
+ # source://nokogiri//lib/nokogiri/xml/document.rb#96
3171
3467
  def empty_doc?(string_or_io); end
3172
3468
  end
3173
3469
  end
3174
3470
 
3175
- # source://nokogiri//lib/nokogiri/xml/document.rb#464
3471
+ # source://nokogiri//lib/nokogiri/xml/document.rb#507
3176
3472
  Nokogiri::XML::Document::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
3177
3473
 
3178
3474
  # source://nokogiri//lib/nokogiri/xml/document.rb#19
@@ -3188,19 +3484,58 @@ Nokogiri::XML::Document::NCNAME_RE = T.let(T.unsafe(nil), Regexp)
3188
3484
  # source://nokogiri//lib/nokogiri/xml/document.rb#18
3189
3485
  Nokogiri::XML::Document::NCNAME_START_CHAR = T.let(T.unsafe(nil), String)
3190
3486
 
3191
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#6
3487
+ # source://nokogiri//lib/nokogiri/xml/document.rb#23
3488
+ Nokogiri::XML::Document::OBJECT_CLONE_METHOD = T.let(T.unsafe(nil), UnboundMethod)
3489
+
3490
+ # source://nokogiri//lib/nokogiri/xml/document.rb#22
3491
+ Nokogiri::XML::Document::OBJECT_DUP_METHOD = T.let(T.unsafe(nil), UnboundMethod)
3492
+
3493
+ # DocumentFragment represents a fragment of an \XML document. It provides the same functionality
3494
+ # exposed by XML::Node and can be used to contain one or more \XML subtrees.
3495
+ #
3496
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#8
3192
3497
  class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node
3193
- # Create a new DocumentFragment from +tags+.
3498
+ # :call-seq:
3499
+ # new(document, input=nil) { |options| ... } → DocumentFragment
3500
+ # new(document, input=nil, context:, options:) → DocumentFragment
3501
+ #
3502
+ # Parse \XML fragment input from a String, and return a new DocumentFragment that is
3503
+ # associated with the given +document+.
3504
+ #
3505
+ # 💡 It's recommended to use either XML::DocumentFragment.parse or Node#parse rather than call
3506
+ # this method directly.
3194
3507
  #
3195
- # If +ctx+ is present, it is used as a context node for the
3196
- # subtree created, e.g., namespaces will be resolved relative
3197
- # to +ctx+.
3508
+ # [Required Parameters]
3509
+ # - +document+ (XML::Document) The parent document to associate the returned fragment with.
3510
+ #
3511
+ # [Optional Parameters]
3512
+ # - +input+ (String) The content to be parsed.
3513
+ #
3514
+ # [Optional Keyword Arguments]
3515
+ # - +context:+ (Nokogiri::XML::Node) The <b>context node</b> for the subtree created. See
3516
+ # below for more information.
3517
+ #
3518
+ # - +options:+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
3519
+ # behaviors during parsing. See ParseOptions for more information. The default value is
3520
+ # +ParseOptions::DEFAULT_XML+.
3521
+ #
3522
+ # [Yields]
3523
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
3524
+ # can be configured before parsing. See ParseOptions for more information.
3525
+ #
3526
+ # [Returns] XML::DocumentFragment
3527
+ #
3528
+ # === Context \Node
3529
+ #
3530
+ # If a context node is specified using +context:+, then the fragment will be created by
3531
+ # calling Node#parse on that node, so the parser will behave as if that Node is the parent of
3532
+ # the fragment subtree, and will resolve namespaces relative to that node.
3198
3533
  #
3199
3534
  # @return [DocumentFragment] a new instance of DocumentFragment
3200
3535
  # @yield [options]
3201
3536
  #
3202
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#19
3203
- def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end
3537
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#85
3538
+ def initialize(document, tags = T.unsafe(nil), context_ = T.unsafe(nil), options_ = T.unsafe(nil), context: T.unsafe(nil), options: T.unsafe(nil)); end
3204
3539
 
3205
3540
  # call-seq: css *rules, [namespace-bindings, custom-pseudo-class]
3206
3541
  #
@@ -3209,7 +3544,7 @@ class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node
3209
3544
  #
3210
3545
  # For more information see Nokogiri::XML::Searchable#css
3211
3546
  #
3212
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#102
3547
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#173
3213
3548
  def css(*args); end
3214
3549
 
3215
3550
  # :call-seq: deconstruct() → Array
@@ -3220,8 +3555,6 @@ class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node
3220
3555
  # root elements, you should deconstruct the array returned by
3221
3556
  # <tt>DocumentFragment#elements</tt>.
3222
3557
  #
3223
- # ⚡ This is an experimental feature, available since v1.14.0
3224
- #
3225
3558
  # *Example*
3226
3559
  #
3227
3560
  # frag = Nokogiri::HTML5.fragment(<<~HTML)
@@ -3253,79 +3586,114 @@ class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node
3253
3586
  # # }),
3254
3587
  # # #(Element:0x398 { name = "div", children = [ #(Text "End")] })]
3255
3588
  #
3256
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#190
3589
+ # Since v1.14.0
3590
+ #
3591
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#261
3257
3592
  def deconstruct; end
3258
3593
 
3259
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#42
3594
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#113
3260
3595
  def dup; end
3261
3596
 
3262
3597
  # A list of Nokogiri::XML::SyntaxError found when parsing a document
3263
3598
  #
3264
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#136
3599
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#207
3265
3600
  def errors; end
3266
3601
 
3267
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#140
3602
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#211
3268
3603
  def errors=(things); end
3269
3604
 
3270
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#144
3605
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#215
3271
3606
  def fragment(data); end
3272
3607
 
3273
3608
  # return the name for DocumentFragment
3274
3609
  #
3275
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#54
3610
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#125
3276
3611
  def name; end
3277
3612
 
3613
+ # The options used to parse the document fragment. Returns the value of any options that were
3614
+ # passed into the constructor as a parameter or set in a config block, else the default
3615
+ # options for the specific subclass.
3616
+ #
3617
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#12
3618
+ def parse_options; end
3619
+
3278
3620
  # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
3279
3621
  #
3280
3622
  # Search this fragment for +paths+. +paths+ must be one or more XPath or CSS queries.
3281
3623
  #
3282
3624
  # For more information see Nokogiri::XML::Searchable#search
3283
3625
  #
3284
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#121
3626
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#192
3285
3627
  def search(*rules); end
3286
3628
 
3287
3629
  # Convert this DocumentFragment to a string
3288
3630
  #
3289
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#60
3631
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#131
3290
3632
  def serialize; end
3291
3633
 
3292
3634
  # Convert this DocumentFragment to html
3293
3635
  # See Nokogiri::XML::NodeSet#to_html
3294
3636
  #
3295
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#67
3637
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#138
3296
3638
  def to_html(*args); end
3297
3639
 
3298
3640
  # Convert this DocumentFragment to a string
3299
3641
  #
3300
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#60
3642
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#131
3301
3643
  def to_s; end
3302
3644
 
3303
3645
  # Convert this DocumentFragment to xhtml
3304
3646
  # See Nokogiri::XML::NodeSet#to_xhtml
3305
3647
  #
3306
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#79
3648
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#150
3307
3649
  def to_xhtml(*args); end
3308
3650
 
3309
3651
  # Convert this DocumentFragment to xml
3310
3652
  # See Nokogiri::XML::NodeSet#to_xml
3311
3653
  #
3312
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#91
3654
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#162
3313
3655
  def to_xml(*args); end
3314
3656
 
3315
3657
  private
3316
3658
 
3317
3659
  # fix for issue 770
3318
3660
  #
3319
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#197
3661
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#268
3320
3662
  def namespace_declarations(ctx); end
3321
3663
 
3322
3664
  class << self
3323
- def new(*_arg0); end
3665
+ def native_new(_arg0); end
3666
+
3667
+ # Wrapper method to separate the concerns of:
3668
+ # - the native object allocator's parameter (it only requires `document`)
3669
+ # - the initializer's parameters
3670
+ #
3671
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#42
3672
+ def new(document, *_arg1, **_arg2, &_arg3); end
3324
3673
 
3325
- # Create a Nokogiri::XML::DocumentFragment from +tags+
3674
+ # :call-seq:
3675
+ # parse(input) { |options| ... } → XML::DocumentFragment
3676
+ # parse(input, options:) → XML::DocumentFragment
3326
3677
  #
3327
- # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#9
3328
- def parse(tags, options = T.unsafe(nil), &block); end
3678
+ # Parse \XML fragment input from a String, and return a new XML::DocumentFragment. This
3679
+ # method creates a new, empty XML::Document to contain the fragment.
3680
+ #
3681
+ # [Required Parameters]
3682
+ # - +input+ (String) The content to be parsed.
3683
+ #
3684
+ # [Optional Keyword Arguments]
3685
+ # - +options+ (Nokogiri::XML::ParseOptions) Configuration object that determines some
3686
+ # behaviors during parsing. See ParseOptions for more information. The default value is
3687
+ # +ParseOptions::DEFAULT_XML+.
3688
+ #
3689
+ # [Yields]
3690
+ # If a block is given, a Nokogiri::XML::ParseOptions object is yielded to the block which
3691
+ # can be configured before parsing. See Nokogiri::XML::ParseOptions for more information.
3692
+ #
3693
+ # [Returns] Nokogiri::XML::DocumentFragment
3694
+ #
3695
+ # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#35
3696
+ def parse(tags, options_ = T.unsafe(nil), options: T.unsafe(nil), &block); end
3329
3697
  end
3330
3698
  end
3331
3699
 
@@ -3461,8 +3829,6 @@ class Nokogiri::XML::Namespace
3461
3829
  # - +prefix+ → (String, nil) The namespace's prefix, or +nil+ if there is no prefix (e.g., default namespace).
3462
3830
  # - +href+ → (String) The namespace's URI
3463
3831
  #
3464
- # ⚡ This is an experimental feature, available since v1.14.0
3465
- #
3466
3832
  # *Example*
3467
3833
  #
3468
3834
  # doc = Nokogiri::XML.parse(<<~XML)
@@ -3488,7 +3854,9 @@ class Nokogiri::XML::Namespace
3488
3854
  # doc.root.elements.last.namespace.deconstruct_keys([:prefix, :href])
3489
3855
  # # => {:prefix=>"noko", :href=>"http://nokogiri.org/ns/noko"}
3490
3856
  #
3491
- # source://nokogiri//lib/nokogiri/xml/namespace.rb#47
3857
+ # Since v1.14.0
3858
+ #
3859
+ # source://nokogiri//lib/nokogiri/xml/namespace.rb#46
3492
3860
  def deconstruct_keys(keys); end
3493
3861
 
3494
3862
  # Returns the value of attribute document.
@@ -3501,7 +3869,7 @@ class Nokogiri::XML::Namespace
3501
3869
 
3502
3870
  private
3503
3871
 
3504
- # source://nokogiri//lib/nokogiri/xml/namespace.rb#53
3872
+ # source://nokogiri//lib/nokogiri/xml/namespace.rb#52
3505
3873
  def inspect_attributes; end
3506
3874
  end
3507
3875
 
@@ -3595,18 +3963,18 @@ class Nokogiri::XML::Node
3595
3963
  #
3596
3964
  # Also see related method +add_child+.
3597
3965
  #
3598
- # source://nokogiri//lib/nokogiri/xml/node.rb#256
3966
+ # source://nokogiri//lib/nokogiri/xml/node.rb#292
3599
3967
  def <<(node_or_tags); end
3600
3968
 
3601
3969
  # Compare two Node objects with respect to their Document. Nodes from
3602
3970
  # different documents cannot be compared.
3603
3971
  #
3604
- # source://nokogiri//lib/nokogiri/xml/node.rb#1256
3972
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1340
3605
3973
  def <=>(other); end
3606
3974
 
3607
3975
  # Test to see if this Node is equal to +other+
3608
3976
  #
3609
- # source://nokogiri//lib/nokogiri/xml/node.rb#1246
3977
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1330
3610
3978
  def ==(other); end
3611
3979
 
3612
3980
  # :call-seq: [](name) → (String, nil)
@@ -3639,7 +4007,7 @@ class Nokogiri::XML::Node
3639
4007
  # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
3640
4008
  # # => "broad"
3641
4009
  #
3642
- # source://nokogiri//lib/nokogiri/xml/node.rb#512
4010
+ # source://nokogiri//lib/nokogiri/xml/node.rb#587
3643
4011
  def [](name); end
3644
4012
 
3645
4013
  # :call-seq: []=(name, value) → value
@@ -3676,12 +4044,12 @@ class Nokogiri::XML::Node
3676
4044
  # # " <child width:size=\"broad\"></child>\n" +
3677
4045
  # # "</root>\n"
3678
4046
  #
3679
- # source://nokogiri//lib/nokogiri/xml/node.rb#550
4047
+ # source://nokogiri//lib/nokogiri/xml/node.rb#625
3680
4048
  def []=(name, value); end
3681
4049
 
3682
4050
  # Accept a visitor. This method calls "visit" on +visitor+ with self.
3683
4051
  #
3684
- # source://nokogiri//lib/nokogiri/xml/node.rb#1240
4052
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1324
3685
4053
  def accept(visitor); end
3686
4054
 
3687
4055
  # Add +node_or_tags+ as a child of this Node.
@@ -3694,7 +4062,7 @@ class Nokogiri::XML::Node
3694
4062
  #
3695
4063
  # Also see related method +<<+.
3696
4064
  #
3697
- # source://nokogiri//lib/nokogiri/xml/node.rb#148
4065
+ # source://nokogiri//lib/nokogiri/xml/node.rb#184
3698
4066
  def add_child(node_or_tags); end
3699
4067
 
3700
4068
  # :call-seq: add_class(names) → self
@@ -3738,7 +4106,7 @@ class Nokogiri::XML::Node
3738
4106
  # node # => <div></div>
3739
4107
  # node.add_class(["section", "header"]) # => <div class="section header"></div>
3740
4108
  #
3741
- # source://nokogiri//lib/nokogiri/xml/node.rb#715
4109
+ # source://nokogiri//lib/nokogiri/xml/node.rb#790
3742
4110
  def add_class(names); end
3743
4111
 
3744
4112
  def add_namespace(_arg0, _arg1); end
@@ -3756,7 +4124,7 @@ class Nokogiri::XML::Node
3756
4124
  #
3757
4125
  # @raise [ArgumentError]
3758
4126
  #
3759
- # source://nokogiri//lib/nokogiri/xml/node.rb#288
4127
+ # source://nokogiri//lib/nokogiri/xml/node.rb#324
3760
4128
  def add_next_sibling(node_or_tags); end
3761
4129
 
3762
4130
  # Insert +node_or_tags+ before this Node (as a sibling).
@@ -3771,7 +4139,7 @@ class Nokogiri::XML::Node
3771
4139
  #
3772
4140
  # @raise [ArgumentError]
3773
4141
  #
3774
- # source://nokogiri//lib/nokogiri/xml/node.rb#271
4142
+ # source://nokogiri//lib/nokogiri/xml/node.rb#307
3775
4143
  def add_previous_sibling(node_or_tags); end
3776
4144
 
3777
4145
  # Insert +node_or_tags+ after this node (as a sibling).
@@ -3783,13 +4151,13 @@ class Nokogiri::XML::Node
3783
4151
  #
3784
4152
  # Also see related method +add_next_sibling+.
3785
4153
  #
3786
- # source://nokogiri//lib/nokogiri/xml/node.rb#318
4154
+ # source://nokogiri//lib/nokogiri/xml/node.rb#354
3787
4155
  def after(node_or_tags); end
3788
4156
 
3789
4157
  # Get a list of ancestor Node for this Node. If +selector+ is given,
3790
4158
  # the ancestors must match +selector+
3791
4159
  #
3792
- # source://nokogiri//lib/nokogiri/xml/node.rb#1209
4160
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1293
3793
4161
  def ancestors(selector = T.unsafe(nil)); end
3794
4162
 
3795
4163
  # :call-seq: append_class(names) → self
@@ -3831,7 +4199,7 @@ class Nokogiri::XML::Node
3831
4199
  # node.append_class(["section", "header"]) # => <div class="section header"></div>
3832
4200
  # node.append_class(["section", "header"]) # => <div class="section header section header"></div>
3833
4201
  #
3834
- # source://nokogiri//lib/nokogiri/xml/node.rb#759
4202
+ # source://nokogiri//lib/nokogiri/xml/node.rb#834
3835
4203
  def append_class(names); end
3836
4204
 
3837
4205
  # :call-seq: [](name) → (String, nil)
@@ -3864,7 +4232,7 @@ class Nokogiri::XML::Node
3864
4232
  # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
3865
4233
  # # => "broad"
3866
4234
  #
3867
- # source://nokogiri//lib/nokogiri/xml/node.rb#512
4235
+ # source://nokogiri//lib/nokogiri/xml/node.rb#587
3868
4236
  def attr(name); end
3869
4237
 
3870
4238
  def attribute(_arg0); end
@@ -3925,7 +4293,7 @@ class Nokogiri::XML::Node
3925
4293
  # # value = "tall"
3926
4294
  # # })}
3927
4295
  #
3928
- # source://nokogiri//lib/nokogiri/xml/node.rb#609
4296
+ # source://nokogiri//lib/nokogiri/xml/node.rb#684
3929
4297
  def attributes; end
3930
4298
 
3931
4299
  # Insert +node_or_tags+ before this node (as a sibling).
@@ -3937,19 +4305,19 @@ class Nokogiri::XML::Node
3937
4305
  #
3938
4306
  # Also see related method +add_previous_sibling+.
3939
4307
  #
3940
- # source://nokogiri//lib/nokogiri/xml/node.rb#304
4308
+ # source://nokogiri//lib/nokogiri/xml/node.rb#340
3941
4309
  def before(node_or_tags); end
3942
4310
 
3943
4311
  def blank?; end
3944
4312
 
3945
- # source://nokogiri//lib/nokogiri/xml/node.rb#1407
4313
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1492
3946
4314
  def canonicalize(mode = T.unsafe(nil), inclusive_namespaces = T.unsafe(nil), with_comments = T.unsafe(nil)); end
3947
4315
 
3948
4316
  # Returns true if this is a CDATA
3949
4317
  #
3950
4318
  # @return [Boolean]
3951
4319
  #
3952
- # source://nokogiri//lib/nokogiri/xml/node.rb#1130
4320
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1214
3953
4321
  def cdata?; end
3954
4322
 
3955
4323
  def child; end
@@ -3962,7 +4330,7 @@ class Nokogiri::XML::Node
3962
4330
  #
3963
4331
  # Also see related method +inner_html=+
3964
4332
  #
3965
- # source://nokogiri//lib/nokogiri/xml/node.rb#349
4333
+ # source://nokogiri//lib/nokogiri/xml/node.rb#385
3966
4334
  def children=(node_or_tags); end
3967
4335
 
3968
4336
  # :call-seq: classes() → Array<String>
@@ -3984,24 +4352,77 @@ class Nokogiri::XML::Node
3984
4352
  # node # => <div class="section title header"></div>
3985
4353
  # node.classes # => ["section", "title", "header"]
3986
4354
  #
3987
- # source://nokogiri//lib/nokogiri/xml/node.rb#669
4355
+ # source://nokogiri//lib/nokogiri/xml/node.rb#744
3988
4356
  def classes; end
3989
4357
 
3990
- def clone(*_arg0); end
4358
+ # :call-seq:
4359
+ # clone → Nokogiri::XML::Node
4360
+ # clone(level) → Nokogiri::XML::Node
4361
+ # clone(level, new_parent_doc) → Nokogiri::XML::Node
4362
+ #
4363
+ # Clone this node.
4364
+ #
4365
+ # [Parameters]
4366
+ # - +level+ (optional Integer). 0 is a shallow copy, 1 (the default) is a deep copy.
4367
+ # - +new_parent_doc+
4368
+ # The new node's parent Document. Defaults to the the Document of the current node.
4369
+ # [Returns] The new Nokogiri::XML::Node
4370
+ #
4371
+ # source://nokogiri//lib/nokogiri/xml/node.rb#162
4372
+ def clone(level = T.unsafe(nil), new_parent_doc = T.unsafe(nil)); end
3991
4373
 
3992
4374
  # Returns true if this is a Comment
3993
4375
  #
3994
4376
  # @return [Boolean]
3995
4377
  #
3996
- # source://nokogiri//lib/nokogiri/xml/node.rb#1125
4378
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1209
3997
4379
  def comment?; end
3998
4380
 
3999
4381
  def content; end
4000
4382
 
4001
- # Set the Node's content to a Text node containing +string+. The string gets XML escaped, not
4002
- # interpreted as markup.
4383
+ # call-seq:
4384
+ # content=(input)
4385
+ #
4386
+ # Set the content of this node to +input+.
4387
+ #
4388
+ # [Parameters]
4389
+ # - +input+ (String) The new content for this node. Input is considered to be raw content, and
4390
+ # so will be entity-escaped in the final DOM string.
4391
+ #
4392
+ # [Example]
4393
+ # Note how entities are handled:
4394
+ #
4395
+ # doc = Nokogiri::HTML::Document.parse(<<~HTML)
4396
+ # <html>
4397
+ # <body>
4398
+ # <div id="first">asdf</div>
4399
+ # <div id="second">asdf</div>
4400
+ # HTML
4401
+ #
4402
+ # text_node = doc.at_css("div#first").children.first
4403
+ # div_node = doc.at_css("div#second")
4404
+ #
4405
+ # value = "You &amp; Me"
4406
+ #
4407
+ # text_node.content = value
4408
+ # div_node.content = value
4409
+ #
4410
+ # doc.css("div").to_html
4411
+ # # => "<div id=\"first\">You &amp;amp; Me</div>
4412
+ # # <div id=\"second\">You &amp;amp; Me</div>"
4413
+ #
4414
+ # For content that is already entity-escaped, use CGI::unescapeHTML to decode it:
4415
+ #
4416
+ # text_node.content = CGI::unescapeHTML(value)
4417
+ # div_node.content = CGI::unescapeHTML(value)
4003
4418
  #
4004
- # source://nokogiri//lib/nokogiri/xml/node.rb#411
4419
+ # doc.css("div").to_html
4420
+ # # => "<div id=\"first\">You &amp; Me</div>
4421
+ # # <div id=\"second\">You &amp; Me</div>"
4422
+ #
4423
+ # See also: #native_content=
4424
+ #
4425
+ # source://nokogiri//lib/nokogiri/xml/node.rb#487
4005
4426
  def content=(string); end
4006
4427
 
4007
4428
  def create_external_subset(_arg0, _arg1, _arg2); end
@@ -4009,9 +4430,11 @@ class Nokogiri::XML::Node
4009
4430
 
4010
4431
  # Get the path to this node as a CSS expression
4011
4432
  #
4012
- # source://nokogiri//lib/nokogiri/xml/node.rb#1200
4433
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1284
4013
4434
  def css_path; end
4014
4435
 
4436
+ def data_ptr?; end
4437
+
4015
4438
  # :call-seq: deconstruct_keys(array_of_names) → Hash
4016
4439
  #
4017
4440
  # Returns a hash describing the Node, to use in pattern matching.
@@ -4025,8 +4448,6 @@ class Nokogiri::XML::Node
4025
4448
  # - +content+ → (String) The contents of all the text nodes in this node's subtree. See #content.
4026
4449
  # - +inner_html+ → (String) The inner markup for the children of this node. See #inner_html.
4027
4450
  #
4028
- # ⚡ This is an experimental feature, available since v1.14.0
4029
- #
4030
4451
  # *Example*
4031
4452
  #
4032
4453
  # doc = Nokogiri::XML.parse(<<~XML)
@@ -4061,12 +4482,14 @@ class Nokogiri::XML::Node
4061
4482
  # # value = "def"
4062
4483
  # # })]}
4063
4484
  #
4064
- # source://nokogiri//lib/nokogiri/xml/node.rb#1468
4485
+ # Since v1.14.0
4486
+ #
4487
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1553
4065
4488
  def deconstruct_keys(keys); end
4066
4489
 
4067
4490
  # Decorate this node with the decorators set up in this node's Document
4068
4491
  #
4069
- # source://nokogiri//lib/nokogiri/xml/node.rb#132
4492
+ # source://nokogiri//lib/nokogiri/xml/node.rb#168
4070
4493
  def decorate!; end
4071
4494
 
4072
4495
  # Adds a default namespace supplied as a string +url+ href, to self.
@@ -4075,18 +4498,18 @@ class Nokogiri::XML::Node
4075
4498
  # now show up in #attributes, but when this node is serialized to XML an
4076
4499
  # "xmlns" attribute will appear. See also #namespace and #namespace=
4077
4500
  #
4078
- # source://nokogiri//lib/nokogiri/xml/node.rb#427
4501
+ # source://nokogiri//lib/nokogiri/xml/node.rb#503
4079
4502
  def default_namespace=(url); end
4080
4503
 
4081
4504
  # Remove the attribute named +name+
4082
4505
  #
4083
- # source://nokogiri//lib/nokogiri/xml/node.rb#643
4506
+ # source://nokogiri//lib/nokogiri/xml/node.rb#718
4084
4507
  def delete(name); end
4085
4508
 
4086
4509
  # Fetch the Nokogiri::HTML4::ElementDescription for this node. Returns
4087
4510
  # nil on XML documents and on unknown tags.
4088
4511
  #
4089
- # source://nokogiri//lib/nokogiri/xml/node.rb#1167
4512
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1251
4090
4513
  def description; end
4091
4514
 
4092
4515
  # Do xinclude substitution on the subtree below node. If given a block, a
@@ -4095,7 +4518,7 @@ class Nokogiri::XML::Node
4095
4518
  #
4096
4519
  # @yield [options]
4097
4520
  #
4098
- # source://nokogiri//lib/nokogiri/xml/node.rb#454
4521
+ # source://nokogiri//lib/nokogiri/xml/node.rb#530
4099
4522
  def do_xinclude(options = T.unsafe(nil)); end
4100
4523
 
4101
4524
  def document; end
@@ -4104,28 +4527,42 @@ class Nokogiri::XML::Node
4104
4527
  #
4105
4528
  # @return [Boolean]
4106
4529
  #
4107
- # source://nokogiri//lib/nokogiri/xml/node.rb#1145
4530
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1229
4108
4531
  def document?; end
4109
4532
 
4110
- def dup(*_arg0); end
4533
+ # :call-seq:
4534
+ # dup → Nokogiri::XML::Node
4535
+ # dup(level) → Nokogiri::XML::Node
4536
+ # dup(level, new_parent_doc) → Nokogiri::XML::Node
4537
+ #
4538
+ # Duplicate this node.
4539
+ #
4540
+ # [Parameters]
4541
+ # - +level+ (optional Integer). 0 is a shallow copy, 1 (the default) is a deep copy.
4542
+ # - +new_parent_doc+ (optional Nokogiri::XML::Document)
4543
+ # The new node's parent Document. Defaults to the the Document of the current node.
4544
+ # [Returns] The new Nokogiri::XML::Node
4545
+ #
4546
+ # source://nokogiri//lib/nokogiri/xml/node.rb#144
4547
+ def dup(level = T.unsafe(nil), new_parent_doc = T.unsafe(nil)); end
4111
4548
 
4112
4549
  # Iterate over each attribute name and value pair for this Node.
4113
4550
  #
4114
- # source://nokogiri//lib/nokogiri/xml/node.rb#635
4551
+ # source://nokogiri//lib/nokogiri/xml/node.rb#710
4115
4552
  def each; end
4116
4553
 
4117
4554
  # Returns true if this is an Element node
4118
4555
  #
4119
4556
  # @return [Boolean]
4120
4557
  #
4121
- # source://nokogiri//lib/nokogiri/xml/node.rb#1181
4558
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1265
4122
4559
  def elem?; end
4123
4560
 
4124
4561
  # Returns true if this is an Element node
4125
4562
  #
4126
4563
  # @return [Boolean]
4127
4564
  #
4128
- # source://nokogiri//lib/nokogiri/xml/node.rb#1181
4565
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1265
4129
4566
  def element?; end
4130
4567
 
4131
4568
  def element_children; end
@@ -4144,7 +4581,7 @@ class Nokogiri::XML::Node
4144
4581
  #
4145
4582
  # @return [Boolean]
4146
4583
  #
4147
- # source://nokogiri//lib/nokogiri/xml/node.rb#1160
4584
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1244
4148
4585
  def fragment?; end
4149
4586
 
4150
4587
  # :call-seq: [](name) → (String, nil)
@@ -4177,7 +4614,7 @@ class Nokogiri::XML::Node
4177
4614
  # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value
4178
4615
  # # => "broad"
4179
4616
  #
4180
- # source://nokogiri//lib/nokogiri/xml/node.rb#512
4617
+ # source://nokogiri//lib/nokogiri/xml/node.rb#587
4181
4618
  def get_attribute(name); end
4182
4619
 
4183
4620
  def has_attribute?(_arg0); end
@@ -4186,7 +4623,7 @@ class Nokogiri::XML::Node
4186
4623
  #
4187
4624
  # @return [Boolean]
4188
4625
  #
4189
- # source://nokogiri//lib/nokogiri/xml/node.rb#1140
4626
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1224
4190
4627
  def html?; end
4191
4628
 
4192
4629
  # Get the inner_html for this node's Node#children
@@ -4209,7 +4646,7 @@ class Nokogiri::XML::Node
4209
4646
  #
4210
4647
  # Also see related method +children=+
4211
4648
  #
4212
- # source://nokogiri//lib/nokogiri/xml/node.rb#338
4649
+ # source://nokogiri//lib/nokogiri/xml/node.rb#374
4213
4650
  def inner_html=(node_or_tags); end
4214
4651
 
4215
4652
  # :section:
@@ -4220,7 +4657,7 @@ class Nokogiri::XML::Node
4220
4657
 
4221
4658
  # Get the attribute names for this Node.
4222
4659
  #
4223
- # source://nokogiri//lib/nokogiri/xml/node.rb#629
4660
+ # source://nokogiri//lib/nokogiri/xml/node.rb#704
4224
4661
  def keys; end
4225
4662
 
4226
4663
  # :call-seq:
@@ -4274,7 +4711,7 @@ class Nokogiri::XML::Node
4274
4711
  #
4275
4712
  # Since v1.11.0
4276
4713
  #
4277
- # source://nokogiri//lib/nokogiri/xml/node.rb#892
4714
+ # source://nokogiri//lib/nokogiri/xml/node.rb#967
4278
4715
  def kwattr_add(attribute_name, keywords); end
4279
4716
 
4280
4717
  # :call-seq:
@@ -4323,7 +4760,7 @@ class Nokogiri::XML::Node
4323
4760
  #
4324
4761
  # Since v1.11.0
4325
4762
  #
4326
- # source://nokogiri//lib/nokogiri/xml/node.rb#945
4763
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1020
4327
4764
  def kwattr_append(attribute_name, keywords); end
4328
4765
 
4329
4766
  # :call-seq:
@@ -4362,7 +4799,7 @@ class Nokogiri::XML::Node
4362
4799
  #
4363
4800
  # Since v1.11.0
4364
4801
  #
4365
- # source://nokogiri//lib/nokogiri/xml/node.rb#988
4802
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1063
4366
4803
  def kwattr_remove(attribute_name, keywords); end
4367
4804
 
4368
4805
  # :call-seq:
@@ -4391,7 +4828,7 @@ class Nokogiri::XML::Node
4391
4828
  #
4392
4829
  # Since v1.11.0
4393
4830
  #
4394
- # source://nokogiri//lib/nokogiri/xml/node.rb#838
4831
+ # source://nokogiri//lib/nokogiri/xml/node.rb#913
4395
4832
  def kwattr_values(attribute_name); end
4396
4833
 
4397
4834
  def lang; end
@@ -4404,7 +4841,7 @@ class Nokogiri::XML::Node
4404
4841
  #
4405
4842
  # @return [Boolean]
4406
4843
  #
4407
- # source://nokogiri//lib/nokogiri/xml/node.rb#1015
4844
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1090
4408
4845
  def matches?(selector); end
4409
4846
 
4410
4847
  def name; end
@@ -4417,7 +4854,7 @@ class Nokogiri::XML::Node
4417
4854
  # for this node. You probably want #default_namespace= instead, or perhaps
4418
4855
  # #add_namespace_definition with a nil prefix argument.
4419
4856
  #
4420
- # source://nokogiri//lib/nokogiri/xml/node.rb#437
4857
+ # source://nokogiri//lib/nokogiri/xml/node.rb#513
4421
4858
  def namespace=(ns); end
4422
4859
 
4423
4860
  def namespace_definitions; end
@@ -4460,7 +4897,7 @@ class Nokogiri::XML::Node
4460
4897
  # # "xmlns"=>"http://example.com/root",
4461
4898
  # # "xmlns:in_scope"=>"http://example.com/in_scope"}
4462
4899
  #
4463
- # source://nokogiri//lib/nokogiri/xml/node.rb#1116
4900
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1200
4464
4901
  def namespaces; end
4465
4902
 
4466
4903
  def native_content=(_arg0); end
@@ -4478,7 +4915,7 @@ class Nokogiri::XML::Node
4478
4915
  #
4479
4916
  # @raise [ArgumentError]
4480
4917
  #
4481
- # source://nokogiri//lib/nokogiri/xml/node.rb#288
4918
+ # source://nokogiri//lib/nokogiri/xml/node.rb#324
4482
4919
  def next=(node_or_tags); end
4483
4920
 
4484
4921
  def next_element; end
@@ -4490,7 +4927,7 @@ class Nokogiri::XML::Node
4490
4927
 
4491
4928
  # Set the parent Node for this Node
4492
4929
  #
4493
- # source://nokogiri//lib/nokogiri/xml/node.rb#417
4930
+ # source://nokogiri//lib/nokogiri/xml/node.rb#493
4494
4931
  def parent=(parent_node); end
4495
4932
 
4496
4933
  # Parse +string_or_io+ as a document fragment within the context of
@@ -4499,7 +4936,7 @@ class Nokogiri::XML::Node
4499
4936
  #
4500
4937
  # @yield [options]
4501
4938
  #
4502
- # source://nokogiri//lib/nokogiri/xml/node.rb#1030
4939
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1105
4503
4940
  def parse(string_or_io, options = T.unsafe(nil)); end
4504
4941
 
4505
4942
  def path; end
@@ -4515,7 +4952,7 @@ class Nokogiri::XML::Node
4515
4952
  #
4516
4953
  # Also see related method +add_child+.
4517
4954
  #
4518
- # source://nokogiri//lib/nokogiri/xml/node.rb#168
4955
+ # source://nokogiri//lib/nokogiri/xml/node.rb#204
4519
4956
  def prepend_child(node_or_tags); end
4520
4957
 
4521
4958
  def previous; end
@@ -4532,7 +4969,7 @@ class Nokogiri::XML::Node
4532
4969
  #
4533
4970
  # @raise [ArgumentError]
4534
4971
  #
4535
- # source://nokogiri//lib/nokogiri/xml/node.rb#271
4972
+ # source://nokogiri//lib/nokogiri/xml/node.rb#307
4536
4973
  def previous=(node_or_tags); end
4537
4974
 
4538
4975
  def previous_element; end
@@ -4542,21 +4979,21 @@ class Nokogiri::XML::Node
4542
4979
  #
4543
4980
  # @return [Boolean]
4544
4981
  #
4545
- # source://nokogiri//lib/nokogiri/xml/node.rb#1150
4982
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1234
4546
4983
  def processing_instruction?; end
4547
4984
 
4548
4985
  # Is this a read only node?
4549
4986
  #
4550
4987
  # @return [Boolean]
4551
4988
  #
4552
- # source://nokogiri//lib/nokogiri/xml/node.rb#1175
4989
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1259
4553
4990
  def read_only?; end
4554
4991
 
4555
4992
  def remove; end
4556
4993
 
4557
4994
  # Remove the attribute named +name+
4558
4995
  #
4559
- # source://nokogiri//lib/nokogiri/xml/node.rb#643
4996
+ # source://nokogiri//lib/nokogiri/xml/node.rb#718
4560
4997
  def remove_attribute(name); end
4561
4998
 
4562
4999
  # :call-seq:
@@ -4605,7 +5042,7 @@ class Nokogiri::XML::Node
4605
5042
  # node # => <div class="section header float"></div>
4606
5043
  # node.remove_class(["section", "float"]) # => <div class="header"></div>
4607
5044
  #
4608
- # source://nokogiri//lib/nokogiri/xml/node.rb#809
5045
+ # source://nokogiri//lib/nokogiri/xml/node.rb#884
4609
5046
  def remove_class(names = T.unsafe(nil)); end
4610
5047
 
4611
5048
  # Replace this Node with +node_or_tags+.
@@ -4618,7 +5055,7 @@ class Nokogiri::XML::Node
4618
5055
  #
4619
5056
  # Also see related method +swap+.
4620
5057
  #
4621
- # source://nokogiri//lib/nokogiri/xml/node.rb#369
5058
+ # source://nokogiri//lib/nokogiri/xml/node.rb#405
4622
5059
  def replace(node_or_tags); end
4623
5060
 
4624
5061
  # Serialize Node using +options+. Save options can also be set using a block.
@@ -4633,7 +5070,7 @@ class Nokogiri::XML::Node
4633
5070
  # config.format.as_xml
4634
5071
  # end
4635
5072
  #
4636
- # source://nokogiri//lib/nokogiri/xml/node.rb#1280
5073
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1364
4637
5074
  def serialize(*args, &block); end
4638
5075
 
4639
5076
  # :call-seq: []=(name, value) → value
@@ -4670,7 +5107,7 @@ class Nokogiri::XML::Node
4670
5107
  # # " <child width:size=\"broad\"></child>\n" +
4671
5108
  # # "</root>\n"
4672
5109
  #
4673
- # source://nokogiri//lib/nokogiri/xml/node.rb#550
5110
+ # source://nokogiri//lib/nokogiri/xml/node.rb#625
4674
5111
  def set_attribute(name, value); end
4675
5112
 
4676
5113
  # Swap this Node for +node_or_tags+
@@ -4682,7 +5119,7 @@ class Nokogiri::XML::Node
4682
5119
  #
4683
5120
  # Also see related method +replace+.
4684
5121
  #
4685
- # source://nokogiri//lib/nokogiri/xml/node.rb#403
5122
+ # source://nokogiri//lib/nokogiri/xml/node.rb#439
4686
5123
  def swap(node_or_tags); end
4687
5124
 
4688
5125
  def text; end
@@ -4691,7 +5128,7 @@ class Nokogiri::XML::Node
4691
5128
  #
4692
5129
  # @return [Boolean]
4693
5130
  #
4694
- # source://nokogiri//lib/nokogiri/xml/node.rb#1155
5131
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1239
4695
5132
  def text?; end
4696
5133
 
4697
5134
  # Serialize this Node to HTML
@@ -4701,13 +5138,13 @@ class Nokogiri::XML::Node
4701
5138
  # See Node#write_to for a list of +options+. For formatted output,
4702
5139
  # use Node#to_xhtml instead.
4703
5140
  #
4704
- # source://nokogiri//lib/nokogiri/xml/node.rb#1306
5141
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1391
4705
5142
  def to_html(options = T.unsafe(nil)); end
4706
5143
 
4707
5144
  # Turn this node in to a string. If the document is HTML, this method
4708
5145
  # returns html. If the document is XML, this method returns XML.
4709
5146
  #
4710
- # source://nokogiri//lib/nokogiri/xml/node.rb#1190
5147
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1274
4711
5148
  def to_s; end
4712
5149
 
4713
5150
  def to_str; end
@@ -4717,7 +5154,7 @@ class Nokogiri::XML::Node
4717
5154
  #
4718
5155
  # See Node#write_to for a list of +options+
4719
5156
  #
4720
- # source://nokogiri//lib/nokogiri/xml/node.rb#1327
5157
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1412
4721
5158
  def to_xhtml(options = T.unsafe(nil)); end
4722
5159
 
4723
5160
  # Serialize this Node to XML using +options+
@@ -4725,7 +5162,7 @@ class Nokogiri::XML::Node
4725
5162
  #
4726
5163
  # See Node#write_to for a list of +options+
4727
5164
  #
4728
- # source://nokogiri//lib/nokogiri/xml/node.rb#1316
5165
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1401
4729
5166
  def to_xml(options = T.unsafe(nil)); end
4730
5167
 
4731
5168
  # Yields self and all children to +block+ recursively.
@@ -4733,7 +5170,7 @@ class Nokogiri::XML::Node
4733
5170
  # @yield [_self]
4734
5171
  # @yieldparam _self [Nokogiri::XML::Node] the object that the method was called on
4735
5172
  #
4736
- # source://nokogiri//lib/nokogiri/xml/node.rb#1233
5173
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1317
4737
5174
  def traverse(&block); end
4738
5175
 
4739
5176
  def type; end
@@ -4743,12 +5180,12 @@ class Nokogiri::XML::Node
4743
5180
  #
4744
5181
  # @return [Boolean]
4745
5182
  #
4746
- # source://nokogiri//lib/nokogiri/xml/node.rb#623
5183
+ # source://nokogiri//lib/nokogiri/xml/node.rb#698
4747
5184
  def value?(value); end
4748
5185
 
4749
5186
  # Get the attribute values for this Node.
4750
5187
  #
4751
- # source://nokogiri//lib/nokogiri/xml/node.rb#617
5188
+ # source://nokogiri//lib/nokogiri/xml/node.rb#692
4752
5189
  def values; end
4753
5190
 
4754
5191
  # :call-seq:
@@ -4795,14 +5232,14 @@ class Nokogiri::XML::Node
4795
5232
  # # <div><a>asdf</a></div>
4796
5233
  # # </body></html>
4797
5234
  #
4798
- # source://nokogiri//lib/nokogiri/xml/node.rb#223
5235
+ # source://nokogiri//lib/nokogiri/xml/node.rb#259
4799
5236
  def wrap(node_or_tags); end
4800
5237
 
4801
5238
  # Write Node as HTML to +io+ with +options+
4802
5239
  #
4803
5240
  # See Node#write_to for a list of +options+
4804
5241
  #
4805
- # source://nokogiri//lib/nokogiri/xml/node.rb#1384
5242
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1469
4806
5243
  def write_html_to(io, options = T.unsafe(nil)); end
4807
5244
 
4808
5245
  # :call-seq:
@@ -4836,7 +5273,7 @@ class Nokogiri::XML::Node
4836
5273
  #
4837
5274
  # See Node#write_to for a list of +options+
4838
5275
  #
4839
- # source://nokogiri//lib/nokogiri/xml/node.rb#1392
5276
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1477
4840
5277
  def write_xhtml_to(io, options = T.unsafe(nil)); end
4841
5278
 
4842
5279
  # Write Node as XML to +io+ with +options+
@@ -4845,23 +5282,25 @@ class Nokogiri::XML::Node
4845
5282
  #
4846
5283
  # See Node#write_to for a list of options
4847
5284
  #
4848
- # source://nokogiri//lib/nokogiri/xml/node.rb#1402
5285
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1487
4849
5286
  def write_xml_to(io, options = T.unsafe(nil)); end
4850
5287
 
4851
5288
  # Returns true if this is an XML::Document node
4852
5289
  #
4853
5290
  # @return [Boolean]
4854
5291
  #
4855
- # source://nokogiri//lib/nokogiri/xml/node.rb#1135
5292
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1219
4856
5293
  def xml?; end
4857
5294
 
4858
5295
  protected
4859
5296
 
4860
5297
  # @raise [ArgumentError]
4861
5298
  #
4862
- # source://nokogiri//lib/nokogiri/xml/node.rb#1482
5299
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1567
4863
5300
  def coerce(data); end
4864
5301
 
5302
+ def initialize_copy_with_args(_arg0, _arg1, _arg2); end
5303
+
4865
5304
  private
4866
5305
 
4867
5306
  def add_child_node(_arg0); end
@@ -4872,7 +5311,7 @@ class Nokogiri::XML::Node
4872
5311
  def add_next_sibling_node(_arg0); end
4873
5312
  def add_previous_sibling_node(_arg0); end
4874
5313
 
4875
- # source://nokogiri//lib/nokogiri/xml/node.rb#1516
5314
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1601
4876
5315
  def add_sibling(next_or_previous, node_or_tags); end
4877
5316
 
4878
5317
  def compare(_arg0); end
@@ -4881,10 +5320,10 @@ class Nokogiri::XML::Node
4881
5320
  def html_standard_serialize(_arg0); end
4882
5321
  def in_context(_arg0, _arg1); end
4883
5322
 
4884
- # source://nokogiri//lib/nokogiri/xml/node.rb#1555
5323
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1633
4885
5324
  def inspect_attributes; end
4886
5325
 
4887
- # source://nokogiri//lib/nokogiri/xml/node.rb#1504
5326
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1589
4888
5327
  def keywordify(keywords); end
4889
5328
 
4890
5329
  def native_write_to(_arg0, _arg1, _arg2, _arg3); end
@@ -4894,10 +5333,10 @@ class Nokogiri::XML::Node
4894
5333
  def set(_arg0, _arg1); end
4895
5334
  def set_namespace(_arg0); end
4896
5335
 
4897
- # source://nokogiri//lib/nokogiri/xml/node.rb#1541
5336
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1623
4898
5337
  def to_format(save_option, options); end
4899
5338
 
4900
- # source://nokogiri//lib/nokogiri/xml/node.rb#1548
5339
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1628
4901
5340
  def write_format_to(save_option, io, options); end
4902
5341
 
4903
5342
  class << self
@@ -4925,10 +5364,10 @@ Nokogiri::XML::Node::CDATA_SECTION_NODE = T.let(T.unsafe(nil), Integer)
4925
5364
  # source://nokogiri//lib/nokogiri/xml/node.rb#77
4926
5365
  Nokogiri::XML::Node::COMMENT_NODE = T.let(T.unsafe(nil), Integer)
4927
5366
 
4928
- # source://nokogiri//lib/nokogiri/xml/node.rb#1415
5367
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1500
4929
5368
  Nokogiri::XML::Node::DECONSTRUCT_KEYS = T.let(T.unsafe(nil), Array)
4930
5369
 
4931
- # source://nokogiri//lib/nokogiri/xml/node.rb#1416
5370
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1501
4932
5371
  Nokogiri::XML::Node::DECONSTRUCT_METHODS = T.let(T.unsafe(nil), Hash)
4933
5372
 
4934
5373
  # DOCB document node type
@@ -4986,7 +5425,7 @@ Nokogiri::XML::Node::ENTITY_REF_NODE = T.let(T.unsafe(nil), Integer)
4986
5425
  # source://nokogiri//lib/nokogiri/xml/node.rb#87
4987
5426
  Nokogiri::XML::Node::HTML_DOCUMENT_NODE = T.let(T.unsafe(nil), Integer)
4988
5427
 
4989
- # source://nokogiri//lib/nokogiri/xml/node.rb#1559
5428
+ # source://nokogiri//lib/nokogiri/xml/node.rb#1637
4990
5429
  Nokogiri::XML::Node::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
4991
5430
 
4992
5431
  # Namespace declaration type
@@ -5145,9 +5584,6 @@ Nokogiri::XML::Node::SaveOptions::NO_XHTML = T.let(T.unsafe(nil), Integer)
5145
5584
  # source://nokogiri//lib/nokogiri/xml/node.rb#67
5146
5585
  Nokogiri::XML::Node::TEXT_NODE = T.let(T.unsafe(nil), Integer)
5147
5586
 
5148
- # source://nokogiri//lib/nokogiri/xml/node.rb#1538
5149
- Nokogiri::XML::Node::USING_LIBXML_WITH_BROKEN_SERIALIZATION = T.let(T.unsafe(nil), FalseClass)
5150
-
5151
5587
  # XInclude end type
5152
5588
  #
5153
5589
  # source://nokogiri//lib/nokogiri/xml/node.rb#101
@@ -5158,11 +5594,15 @@ Nokogiri::XML::Node::XINCLUDE_END = T.let(T.unsafe(nil), Integer)
5158
5594
  # source://nokogiri//lib/nokogiri/xml/node.rb#99
5159
5595
  Nokogiri::XML::Node::XINCLUDE_START = T.let(T.unsafe(nil), Integer)
5160
5596
 
5161
- # A NodeSet contains a list of Nokogiri::XML::Node objects. Typically
5162
- # a NodeSet is return as a result of searching a Document via
5163
- # Nokogiri::XML::Searchable#css or Nokogiri::XML::Searchable#xpath
5597
+ # A NodeSet is an Enumerable that contains a list of Nokogiri::XML::Node objects.
5598
+ #
5599
+ # Typically a NodeSet is returned as a result of searching a Document via
5600
+ # Nokogiri::XML::Searchable#css or Nokogiri::XML::Searchable#xpath.
5164
5601
  #
5165
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#10
5602
+ # Note that the `#dup` and `#clone` methods perform shallow copies; these methods do not copy
5603
+ # the Nodes contained in the NodeSet (similar to how Array and other Enumerable classes work).
5604
+ #
5605
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#14
5166
5606
  class Nokogiri::XML::NodeSet
5167
5607
  include ::Nokogiri::XML::Searchable
5168
5608
  include ::Enumerable
@@ -5173,7 +5613,7 @@ class Nokogiri::XML::NodeSet
5173
5613
  # @yield [_self]
5174
5614
  # @yieldparam _self [Nokogiri::XML::NodeSet] the object that the method was called on
5175
5615
  #
5176
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#20
5616
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#22
5177
5617
  def initialize(document, list = T.unsafe(nil)); end
5178
5618
 
5179
5619
  # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
@@ -5187,7 +5627,7 @@ class Nokogiri::XML::NodeSet
5187
5627
  #
5188
5628
  # node_set.at(3) # same as node_set[3]
5189
5629
  #
5190
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#119
5630
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#121
5191
5631
  def %(*args); end
5192
5632
 
5193
5633
  def &(_arg0); end
@@ -5199,7 +5639,7 @@ class Nokogiri::XML::NodeSet
5199
5639
  # of elements and if each element is equal to the corresponding
5200
5640
  # element in the other NodeSet
5201
5641
  #
5202
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#393
5642
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#395
5203
5643
  def ==(other); end
5204
5644
 
5205
5645
  def [](*_arg0); end
@@ -5209,12 +5649,12 @@ class Nokogiri::XML::NodeSet
5209
5649
  #
5210
5650
  # See Nokogiri::XML::Node#add_class for more information.
5211
5651
  #
5212
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#139
5652
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#141
5213
5653
  def add_class(name); end
5214
5654
 
5215
5655
  # Insert +datum+ after the last Node in this NodeSet
5216
5656
  #
5217
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#69
5657
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#71
5218
5658
  def after(datum); end
5219
5659
 
5220
5660
  # Append the class attribute +name+ to all Node objects in the
@@ -5222,7 +5662,7 @@ class Nokogiri::XML::NodeSet
5222
5662
  #
5223
5663
  # See Nokogiri::XML::Node#append_class for more information.
5224
5664
  #
5225
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#151
5665
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#153
5226
5666
  def append_class(name); end
5227
5667
 
5228
5668
  # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]
@@ -5236,7 +5676,7 @@ class Nokogiri::XML::NodeSet
5236
5676
  #
5237
5677
  # node_set.at(3) # same as node_set[3]
5238
5678
  #
5239
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#119
5679
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#121
5240
5680
  def at(*args); end
5241
5681
 
5242
5682
  # Set attributes on each Node in the NodeSet, or get an
@@ -5271,7 +5711,7 @@ class Nokogiri::XML::NodeSet
5271
5711
  #
5272
5712
  # node_set.attr("class") { |node| node.name }
5273
5713
  #
5274
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#203
5714
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#205
5275
5715
  def attr(key, value = T.unsafe(nil), &block); end
5276
5716
 
5277
5717
  # Set attributes on each Node in the NodeSet, or get an
@@ -5306,22 +5746,20 @@ class Nokogiri::XML::NodeSet
5306
5746
  #
5307
5747
  # node_set.attr("class") { |node| node.name }
5308
5748
  #
5309
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#203
5749
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#205
5310
5750
  def attribute(key, value = T.unsafe(nil), &block); end
5311
5751
 
5312
5752
  # Insert +datum+ before the first Node in this NodeSet
5313
5753
  #
5314
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#63
5754
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#65
5315
5755
  def before(datum); end
5316
5756
 
5317
5757
  # Returns a new NodeSet containing all the children of all the nodes in
5318
5758
  # the NodeSet
5319
5759
  #
5320
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#406
5760
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#408
5321
5761
  def children; end
5322
5762
 
5323
- def clone; end
5324
-
5325
5763
  # call-seq: css *rules, [namespace-bindings, custom-pseudo-class]
5326
5764
  #
5327
5765
  # Search this node set for CSS +rules+. +rules+ must be one or more CSS
@@ -5329,64 +5767,62 @@ class Nokogiri::XML::NodeSet
5329
5767
  #
5330
5768
  # For more information see Nokogiri::XML::Searchable#css
5331
5769
  #
5332
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#83
5770
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#85
5333
5771
  def css(*args); end
5334
5772
 
5335
5773
  # :call-seq: deconstruct() → Array
5336
5774
  #
5337
5775
  # Returns the members of this NodeSet as an array, to use in pattern matching.
5338
5776
  #
5339
- # This is an experimental feature, available since v1.14.0
5777
+ # Since v1.14.0
5340
5778
  #
5341
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#440
5779
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#442
5342
5780
  def deconstruct; end
5343
5781
 
5344
5782
  def delete(_arg0); end
5345
5783
 
5346
5784
  # The Document this NodeSet is associated with
5347
5785
  #
5348
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#15
5786
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#19
5349
5787
  def document; end
5350
5788
 
5351
5789
  # The Document this NodeSet is associated with
5352
5790
  #
5353
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#15
5791
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#19
5354
5792
  def document=(_arg0); end
5355
5793
 
5356
- def dup; end
5357
-
5358
5794
  # Iterate over each node, yielding to +block+
5359
5795
  #
5360
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#231
5796
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#233
5361
5797
  def each; end
5362
5798
 
5363
5799
  # Is this NodeSet empty?
5364
5800
  #
5365
5801
  # @return [Boolean]
5366
5802
  #
5367
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#45
5803
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#47
5368
5804
  def empty?; end
5369
5805
 
5370
5806
  # Filter this list for nodes that match +expr+
5371
5807
  #
5372
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#130
5808
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#132
5373
5809
  def filter(expr); end
5374
5810
 
5375
5811
  # Get the first element of the NodeSet.
5376
5812
  #
5377
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#29
5813
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#31
5378
5814
  def first(n = T.unsafe(nil)); end
5379
5815
 
5380
5816
  def include?(_arg0); end
5381
5817
 
5382
5818
  # 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.
5383
5819
  #
5384
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#51
5820
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#53
5385
5821
  def index(node = T.unsafe(nil)); end
5386
5822
 
5387
5823
  # Get the inner html of all contained Node objects
5388
5824
  #
5389
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#260
5825
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#262
5390
5826
  def inner_html(*args); end
5391
5827
 
5392
5828
  # Get the inner text of all contained Node objects
@@ -5402,17 +5838,17 @@ class Nokogiri::XML::NodeSet
5402
5838
  #
5403
5839
  # See Nokogiri::XML::Node#content for more information.
5404
5840
  #
5405
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#253
5841
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#255
5406
5842
  def inner_text; end
5407
5843
 
5408
- # Return a nicely formated string representation
5844
+ # Return a nicely formatted string representation
5409
5845
  #
5410
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#427
5846
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#429
5411
5847
  def inspect; end
5412
5848
 
5413
5849
  # Get the last element of the NodeSet.
5414
5850
  #
5415
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#39
5851
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#41
5416
5852
  def last; end
5417
5853
 
5418
5854
  def length; end
@@ -5420,7 +5856,7 @@ class Nokogiri::XML::NodeSet
5420
5856
  # Removes the last element from set and returns it, or +nil+ if
5421
5857
  # the set is empty
5422
5858
  #
5423
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#374
5859
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#376
5424
5860
  def pop; end
5425
5861
 
5426
5862
  def push(_arg0); end
@@ -5428,12 +5864,12 @@ class Nokogiri::XML::NodeSet
5428
5864
 
5429
5865
  # Remove the attributed named +name+ from all Node objects in the NodeSet
5430
5866
  #
5431
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#223
5867
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#225
5432
5868
  def remove_attr(name); end
5433
5869
 
5434
5870
  # Remove the attributed named +name+ from all Node objects in the NodeSet
5435
5871
  #
5436
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#223
5872
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#225
5437
5873
  def remove_attribute(name); end
5438
5874
 
5439
5875
  # Remove the class attribute +name+ from all Node objects in the
@@ -5441,13 +5877,13 @@ class Nokogiri::XML::NodeSet
5441
5877
  #
5442
5878
  # See Nokogiri::XML::Node#remove_class for more information.
5443
5879
  #
5444
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#163
5880
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#165
5445
5881
  def remove_class(name = T.unsafe(nil)); end
5446
5882
 
5447
5883
  # Returns a new NodeSet containing all the nodes in the NodeSet
5448
5884
  # in reverse order
5449
5885
  #
5450
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#417
5886
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#419
5451
5887
  def reverse; end
5452
5888
 
5453
5889
  # Set attributes on each Node in the NodeSet, or get an
@@ -5482,13 +5918,13 @@ class Nokogiri::XML::NodeSet
5482
5918
  #
5483
5919
  # node_set.attr("class") { |node| node.name }
5484
5920
  #
5485
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#203
5921
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#205
5486
5922
  def set(key, value = T.unsafe(nil), &block); end
5487
5923
 
5488
5924
  # Returns the first element of the NodeSet and removes it. Returns
5489
5925
  # +nil+ if the set is empty.
5490
5926
  #
5491
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#383
5927
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#385
5492
5928
  def shift; end
5493
5929
 
5494
5930
  def size; end
@@ -5507,7 +5943,7 @@ class Nokogiri::XML::NodeSet
5507
5943
  #
5508
5944
  # See Nokogiri::XML::Node#content for more information.
5509
5945
  #
5510
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#253
5946
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#255
5511
5947
  def text; end
5512
5948
 
5513
5949
  def to_a; end
@@ -5515,22 +5951,22 @@ class Nokogiri::XML::NodeSet
5515
5951
 
5516
5952
  # Convert this NodeSet to HTML
5517
5953
  #
5518
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#341
5954
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#343
5519
5955
  def to_html(*args); end
5520
5956
 
5521
5957
  # Convert this NodeSet to a string.
5522
5958
  #
5523
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#335
5959
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#337
5524
5960
  def to_s; end
5525
5961
 
5526
5962
  # Convert this NodeSet to XHTML
5527
5963
  #
5528
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#358
5964
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#360
5529
5965
  def to_xhtml(*args); end
5530
5966
 
5531
5967
  # Convert this NodeSet to XML
5532
5968
  #
5533
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#364
5969
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#366
5534
5970
  def to_xml(*args); end
5535
5971
 
5536
5972
  def unlink; end
@@ -5599,7 +6035,7 @@ class Nokogiri::XML::NodeSet
5599
6035
  # # <div><a>d</a></div>
5600
6036
  # # </body></html>
5601
6037
  #
5602
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#328
6038
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#330
5603
6039
  def wrap(node_or_tags); end
5604
6040
 
5605
6041
  # call-seq: xpath *paths, [namespace-bindings, variable-bindings, custom-handler-class]
@@ -5609,13 +6045,17 @@ class Nokogiri::XML::NodeSet
5609
6045
  #
5610
6046
  # For more information see Nokogiri::XML::Searchable#xpath
5611
6047
  #
5612
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#99
6048
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#101
5613
6049
  def xpath(*args); end
5614
6050
 
5615
6051
  def |(_arg0); end
6052
+
6053
+ private
6054
+
6055
+ def initialize_copy(_arg0); end
5616
6056
  end
5617
6057
 
5618
- # source://nokogiri//lib/nokogiri/xml/node_set.rb#444
6058
+ # source://nokogiri//lib/nokogiri/xml/node_set.rb#446
5619
6059
  Nokogiri::XML::NodeSet::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array)
5620
6060
 
5621
6061
  # Struct representing an {XML Schema Notation}[https://www.w3.org/TR/xml/#Notations]
@@ -5640,7 +6080,7 @@ module Nokogiri::XML::PP::Node
5640
6080
  # source://nokogiri//lib/nokogiri/xml/pp/node.rb#10
5641
6081
  def inspect; end
5642
6082
 
5643
- # source://nokogiri//lib/nokogiri/xml/pp/node.rb#27
6083
+ # source://nokogiri//lib/nokogiri/xml/pp/node.rb#32
5644
6084
  def pretty_print(pp); end
5645
6085
  end
5646
6086
 
@@ -6026,7 +6466,7 @@ Nokogiri::XML::ParseOptions::DTDVALID = T.let(T.unsafe(nil), Integer)
6026
6466
 
6027
6467
  # Relax any hardcoded limit from the parser. Off by default.
6028
6468
  #
6029
- # ⚠ There may be a performance penalty when this option is set.
6469
+ # ⚠ <b>It is UNSAFE to set this option</b> when parsing untrusted documents.
6030
6470
  #
6031
6471
  # source://nokogiri//lib/nokogiri/xml/parse_options.rb#144
6032
6472
  Nokogiri::XML::ParseOptions::HUGE = T.let(T.unsafe(nil), Integer)
@@ -6131,47 +6571,48 @@ class Nokogiri::XML::ProcessingInstruction < ::Nokogiri::XML::Node
6131
6571
  end
6132
6572
  end
6133
6573
 
6134
- # Nokogiri::XML::Reader parses an XML document similar to the way a cursor
6135
- # would move. The Reader is given an XML document, and yields nodes
6136
- # to an each block.
6574
+ # The Reader parser allows you to effectively pull parse an \XML document. Once instantiated,
6575
+ # call Nokogiri::XML::Reader#each to iterate over each node.
6576
+ #
6577
+ # Nokogiri::XML::Reader parses an \XML document similar to the way a cursor would move. The
6578
+ # Reader is given an \XML document, and yields nodes to an each block.
6579
+ #
6580
+ # The Reader parser might be good for when you need the speed and low memory usage of a \SAX
6581
+ # parser, but do not want to write a SAX::Document handler.
6137
6582
  #
6138
6583
  # Here is an example of usage:
6139
6584
  #
6140
- # reader = Nokogiri::XML::Reader(<<-eoxml)
6585
+ # reader = Nokogiri::XML::Reader.new <<~XML
6141
6586
  # <x xmlns:tenderlove='http://tenderlovemaking.com/'>
6142
6587
  # <tenderlove:foo awesome='true'>snuggles!</tenderlove:foo>
6143
6588
  # </x>
6144
- # eoxml
6589
+ # XML
6145
6590
  #
6146
6591
  # reader.each do |node|
6147
- #
6148
6592
  # # node is an instance of Nokogiri::XML::Reader
6149
6593
  # puts node.name
6150
- #
6151
6594
  # end
6152
6595
  #
6153
- # Note that Nokogiri::XML::Reader#each can only be called once!! Once
6154
- # the cursor moves through the entire document, you must parse the
6155
- # document again. So make sure that you capture any information you
6156
- # need during the first iteration.
6596
+ # Nokogiri::XML::Reader#each can only be called once! Once the cursor moves through the entire
6597
+ # document, you must parse the document again. It may be better to capture all information you
6598
+ # need during a single iteration.
6157
6599
  #
6158
- # The Reader parser is good for when you need the speed of a SAX parser,
6159
- # but do not want to write a Document handler.
6600
+ # libxml2 does not support error recovery in the Reader parser. The +RECOVER+ ParseOption is
6601
+ # ignored. If a syntax error is encountered during parsing, an exception will be raised.
6160
6602
  #
6161
- # source://nokogiri//lib/nokogiri/xml/reader.rb#32
6603
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#34
6162
6604
  class Nokogiri::XML::Reader
6163
6605
  include ::Enumerable
6164
6606
 
6165
6607
  # @return [Reader] a new instance of Reader
6166
6608
  #
6167
- # source://nokogiri//lib/nokogiri/xml/reader.rb#79
6609
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#114
6168
6610
  def initialize(source, url = T.unsafe(nil), encoding = T.unsafe(nil)); end
6169
6611
 
6170
6612
  def attribute(_arg0); end
6171
6613
  def attribute_at(_arg0); end
6172
6614
  def attribute_count; end
6173
6615
  def attribute_hash; end
6174
- def attribute_nodes; end
6175
6616
 
6176
6617
  # Get the attributes and namespaces of the current node as a Hash.
6177
6618
  #
@@ -6180,7 +6621,7 @@ class Nokogiri::XML::Reader
6180
6621
  # [Returns]
6181
6622
  # (Hash<String, String>) Attribute names and values, and namespace prefixes and hrefs.
6182
6623
  #
6183
- # source://nokogiri//lib/nokogiri/xml/reader.rb#92
6624
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#126
6184
6625
  def attributes; end
6185
6626
 
6186
6627
  def attributes?; end
@@ -6190,7 +6631,7 @@ class Nokogiri::XML::Reader
6190
6631
 
6191
6632
  # Move the cursor through the document yielding the cursor to the block
6192
6633
  #
6193
- # source://nokogiri//lib/nokogiri/xml/reader.rb#98
6634
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#132
6194
6635
  def each; end
6195
6636
 
6196
6637
  def empty_element?; end
@@ -6198,12 +6639,12 @@ class Nokogiri::XML::Reader
6198
6639
 
6199
6640
  # A list of errors encountered while parsing
6200
6641
  #
6201
- # source://nokogiri//lib/nokogiri/xml/reader.rb#72
6642
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#74
6202
6643
  def errors; end
6203
6644
 
6204
6645
  # A list of errors encountered while parsing
6205
6646
  #
6206
- # source://nokogiri//lib/nokogiri/xml/reader.rb#72
6647
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#74
6207
6648
  def errors=(_arg0); end
6208
6649
 
6209
6650
  def inner_xml; end
@@ -6218,9 +6659,9 @@ class Nokogiri::XML::Reader
6218
6659
  def read; end
6219
6660
  def self_closing?; end
6220
6661
 
6221
- # The XML source
6662
+ # The \XML source
6222
6663
  #
6223
- # source://nokogiri//lib/nokogiri/xml/reader.rb#75
6664
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#77
6224
6665
  def source; end
6225
6666
 
6226
6667
  def state; end
@@ -6231,119 +6672,146 @@ class Nokogiri::XML::Reader
6231
6672
  class << self
6232
6673
  def from_io(*_arg0); end
6233
6674
  def from_memory(*_arg0); end
6675
+
6676
+ # :call-seq:
6677
+ # Reader.new(input) { |options| ... } → Reader
6678
+ #
6679
+ # Create a new Reader to parse an \XML document.
6680
+ #
6681
+ # [Required Parameters]
6682
+ # - +input+ (String | IO): The \XML document to parse.
6683
+ #
6684
+ # [Optional Parameters]
6685
+ # - +url:+ (String) The base URL of the document.
6686
+ # - +options:+ (Integer | ParseOptions) Options to control the parser behavior.
6687
+ # Defaults to +ParseOptions::STRICT+.
6688
+ #
6689
+ # [Yields]
6690
+ # If present, the block will be passed a Nokogiri::XML::ParseOptions object to modify before
6691
+ # the fragment is parsed. See Nokogiri::XML::ParseOptions for more information.
6692
+ #
6693
+ # @yield [options]
6694
+ #
6695
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#99
6696
+ def new(string_or_io, url_ = T.unsafe(nil), encoding_ = T.unsafe(nil), options_ = T.unsafe(nil), url: T.unsafe(nil), encoding: T.unsafe(nil), options: T.unsafe(nil)); end
6234
6697
  end
6235
6698
  end
6236
6699
 
6237
6700
  # Attribute node type
6238
6701
  #
6239
- # source://nokogiri//lib/nokogiri/xml/reader.rb#39
6702
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#41
6240
6703
  Nokogiri::XML::Reader::TYPE_ATTRIBUTE = T.let(T.unsafe(nil), Integer)
6241
6704
 
6242
6705
  # CDATA node type
6243
6706
  #
6244
- # source://nokogiri//lib/nokogiri/xml/reader.rb#43
6707
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#45
6245
6708
  Nokogiri::XML::Reader::TYPE_CDATA = T.let(T.unsafe(nil), Integer)
6246
6709
 
6247
6710
  # Comment node type
6248
6711
  #
6249
- # source://nokogiri//lib/nokogiri/xml/reader.rb#51
6712
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#53
6250
6713
  Nokogiri::XML::Reader::TYPE_COMMENT = T.let(T.unsafe(nil), Integer)
6251
6714
 
6252
6715
  # Document node type
6253
6716
  #
6254
- # source://nokogiri//lib/nokogiri/xml/reader.rb#53
6717
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#55
6255
6718
  Nokogiri::XML::Reader::TYPE_DOCUMENT = T.let(T.unsafe(nil), Integer)
6256
6719
 
6257
6720
  # Document Fragment node type
6258
6721
  #
6259
- # source://nokogiri//lib/nokogiri/xml/reader.rb#57
6722
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#59
6260
6723
  Nokogiri::XML::Reader::TYPE_DOCUMENT_FRAGMENT = T.let(T.unsafe(nil), Integer)
6261
6724
 
6262
6725
  # Document Type node type
6263
6726
  #
6264
- # source://nokogiri//lib/nokogiri/xml/reader.rb#55
6727
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#57
6265
6728
  Nokogiri::XML::Reader::TYPE_DOCUMENT_TYPE = T.let(T.unsafe(nil), Integer)
6266
6729
 
6267
6730
  # Element node type
6268
6731
  #
6269
- # source://nokogiri//lib/nokogiri/xml/reader.rb#37
6732
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#39
6270
6733
  Nokogiri::XML::Reader::TYPE_ELEMENT = T.let(T.unsafe(nil), Integer)
6271
6734
 
6272
6735
  # Element end node type
6273
6736
  #
6274
- # source://nokogiri//lib/nokogiri/xml/reader.rb#65
6737
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#67
6275
6738
  Nokogiri::XML::Reader::TYPE_END_ELEMENT = T.let(T.unsafe(nil), Integer)
6276
6739
 
6277
6740
  # Entity end node type
6278
6741
  #
6279
- # source://nokogiri//lib/nokogiri/xml/reader.rb#67
6742
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#69
6280
6743
  Nokogiri::XML::Reader::TYPE_END_ENTITY = T.let(T.unsafe(nil), Integer)
6281
6744
 
6282
6745
  # Entity node type
6283
6746
  #
6284
- # source://nokogiri//lib/nokogiri/xml/reader.rb#47
6747
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#49
6285
6748
  Nokogiri::XML::Reader::TYPE_ENTITY = T.let(T.unsafe(nil), Integer)
6286
6749
 
6287
6750
  # Entity Reference node type
6288
6751
  #
6289
- # source://nokogiri//lib/nokogiri/xml/reader.rb#45
6752
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#47
6290
6753
  Nokogiri::XML::Reader::TYPE_ENTITY_REFERENCE = T.let(T.unsafe(nil), Integer)
6291
6754
 
6292
- # source://nokogiri//lib/nokogiri/xml/reader.rb#35
6755
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#37
6293
6756
  Nokogiri::XML::Reader::TYPE_NONE = T.let(T.unsafe(nil), Integer)
6294
6757
 
6295
6758
  # Notation node type
6296
6759
  #
6297
- # source://nokogiri//lib/nokogiri/xml/reader.rb#59
6760
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#61
6298
6761
  Nokogiri::XML::Reader::TYPE_NOTATION = T.let(T.unsafe(nil), Integer)
6299
6762
 
6300
6763
  # PI node type
6301
6764
  #
6302
- # source://nokogiri//lib/nokogiri/xml/reader.rb#49
6765
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#51
6303
6766
  Nokogiri::XML::Reader::TYPE_PROCESSING_INSTRUCTION = T.let(T.unsafe(nil), Integer)
6304
6767
 
6305
6768
  # Significant Whitespace node type
6306
6769
  #
6307
- # source://nokogiri//lib/nokogiri/xml/reader.rb#63
6770
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#65
6308
6771
  Nokogiri::XML::Reader::TYPE_SIGNIFICANT_WHITESPACE = T.let(T.unsafe(nil), Integer)
6309
6772
 
6310
6773
  # Text node type
6311
6774
  #
6312
- # source://nokogiri//lib/nokogiri/xml/reader.rb#41
6775
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#43
6313
6776
  Nokogiri::XML::Reader::TYPE_TEXT = T.let(T.unsafe(nil), Integer)
6314
6777
 
6315
6778
  # Whitespace node type
6316
6779
  #
6317
- # source://nokogiri//lib/nokogiri/xml/reader.rb#61
6780
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#63
6318
6781
  Nokogiri::XML::Reader::TYPE_WHITESPACE = T.let(T.unsafe(nil), Integer)
6319
6782
 
6320
- # XML Declaration node type
6783
+ # \XML Declaration node type
6321
6784
  #
6322
- # source://nokogiri//lib/nokogiri/xml/reader.rb#69
6785
+ # source://nokogiri//lib/nokogiri/xml/reader.rb#71
6323
6786
  Nokogiri::XML::Reader::TYPE_XML_DECLARATION = T.let(T.unsafe(nil), Integer)
6324
6787
 
6325
- # Nokogiri::XML::RelaxNG is used for validating XML against a
6326
- # RelaxNG schema.
6788
+ # Nokogiri::XML::RelaxNG is used for validating \XML against a RELAX NG schema definition.
6327
6789
  #
6328
- # == Synopsis
6790
+ # 🛡 <b>Do not use this class for untrusted schema documents.</b> RELAX NG input is always
6791
+ # treated as *trusted*, meaning that the underlying parsing libraries <b>will access network
6792
+ # resources</b>. This is counter to Nokogiri's "untrusted by default" security policy, but is an
6793
+ # unfortunate limitation of the underlying libraries.
6329
6794
  #
6330
- # Validate an XML document against a RelaxNG schema. Loop over the errors
6331
- # that are returned and print them out:
6795
+ # *Example:* Determine whether an \XML document is valid.
6332
6796
  #
6333
- # schema = Nokogiri::XML::RelaxNG(File.open(ADDRESS_SCHEMA_FILE))
6334
- # doc = Nokogiri::XML(File.open(ADDRESS_XML_FILE))
6797
+ # schema = Nokogiri::XML::RelaxNG.new(File.read(RELAX_NG_FILE))
6798
+ # doc = Nokogiri::XML::Document.parse(File.read(XML_FILE))
6799
+ # schema.valid?(doc) # Boolean
6335
6800
  #
6336
- # schema.validate(doc).each do |error|
6337
- # puts error.message
6338
- # end
6801
+ # *Example:* Validate an \XML document against a \RelaxNG schema, and capture any errors that are found.
6802
+ #
6803
+ # schema = Nokogiri::XML::RelaxNG.new(File.open(RELAX_NG_FILE))
6804
+ # doc = Nokogiri::XML::Document.parse(File.open(XML_FILE))
6805
+ # errors = schema.validate(doc) # Array<SyntaxError>
6339
6806
  #
6340
- # The list of errors are Nokogiri::XML::SyntaxError objects.
6807
+ # *Example:* Validate an \XML document using a Document containing a RELAX NG schema definition.
6341
6808
  #
6342
- # NOTE: RelaxNG input is always treated as TRUSTED documents, meaning that they will cause the
6343
- # underlying parsing libraries to access network resources. This is counter to Nokogiri's
6344
- # "untrusted by default" security policy, but is a limitation of the underlying libraries.
6809
+ # schema_doc = Nokogiri::XML::Document.parse(File.read(RELAX_NG_FILE))
6810
+ # schema = Nokogiri::XML::RelaxNG.from_document(schema_doc)
6811
+ # doc = Nokogiri::XML::Document.parse(File.open(XML_FILE))
6812
+ # schema.valid?(doc) # Boolean
6345
6813
  #
6346
- # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#35
6814
+ # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#42
6347
6815
  class Nokogiri::XML::RelaxNG < ::Nokogiri::XML::Schema
6348
6816
  private
6349
6817
 
@@ -6351,25 +6819,59 @@ class Nokogiri::XML::RelaxNG < ::Nokogiri::XML::Schema
6351
6819
 
6352
6820
  class << self
6353
6821
  def from_document(*_arg0); end
6354
- def read_memory(*_arg0); end
6822
+
6823
+ # :call-seq:
6824
+ # new(input) → Nokogiri::XML::RelaxNG
6825
+ # new(input, options:) → Nokogiri::XML::RelaxNG
6826
+ #
6827
+ # Parse a RELAX NG schema definition from a String or IO to create a new Nokogiri::XML::RelaxNG.
6828
+ #
6829
+ # [Parameters]
6830
+ # - +input+ (String | IO) RELAX NG schema definition
6831
+ # - +options:+ (Nokogiri::XML::ParseOptions)
6832
+ # Defaults to Nokogiri::XML::ParseOptions::DEFAULT_SCHEMA ⚠ Unused
6833
+ #
6834
+ # [Returns] Nokogiri::XML::RelaxNG
6835
+ #
6836
+ # ⚠ +parse_options+ is currently unused by this method and is present only as a placeholder for
6837
+ # future functionality.
6838
+ #
6839
+ # Also see convenience method Nokogiri::XML::RelaxNG()
6840
+ #
6841
+ # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#60
6842
+ def new(input, parse_options_ = T.unsafe(nil), options: T.unsafe(nil)); end
6843
+
6844
+ # :call-seq:
6845
+ # read_memory(input) → Nokogiri::XML::RelaxNG
6846
+ # read_memory(input, options:) → Nokogiri::XML::RelaxNG
6847
+ #
6848
+ # Convenience method for Nokogiri::XML::RelaxNG.new.
6849
+ #
6850
+ # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#69
6851
+ def read_memory(*_arg0, **_arg1, &_arg2); end
6355
6852
  end
6356
6853
  end
6357
6854
 
6358
- # SAX Parsers are event driven parsers. Nokogiri provides two different event based parsers when
6359
- # dealing with XML. If you want to do SAX style parsing using HTML, check out
6360
- # Nokogiri::HTML4::SAX.
6855
+ # SAX Parsers are event-driven parsers.
6856
+ #
6857
+ # Two SAX parsers for XML are available, a parser that reads from a string or IO object as it
6858
+ # feels necessary, and a parser that you explicitly feed XML in chunks. If you want to let
6859
+ # Nokogiri deal with reading your XML, use the Nokogiri::XML::SAX::Parser. If you want to have
6860
+ # fine grain control over the XML input, use the Nokogiri::XML::SAX::PushParser.
6861
+ #
6862
+ # If you want to do SAX style parsing of HTML, check out Nokogiri::HTML4::SAX.
6361
6863
  #
6362
6864
  # The basic way a SAX style parser works is by creating a parser, telling the parser about the
6363
6865
  # events we're interested in, then giving the parser some XML to process. The parser will notify
6364
6866
  # you when it encounters events you said you would like to know about.
6365
6867
  #
6366
- # To register for events, you simply subclass Nokogiri::XML::SAX::Document, and implement the
6367
- # methods for which you would like notification.
6868
+ # To register for events, subclass Nokogiri::XML::SAX::Document and implement the methods for
6869
+ # which you would like notification.
6368
6870
  #
6369
6871
  # For example, if I want to be notified when a document ends, and when an element starts, I
6370
6872
  # would write a class like this:
6371
6873
  #
6372
- # class MyDocument < Nokogiri::XML::SAX::Document
6874
+ # class MyHandler < Nokogiri::XML::SAX::Document
6373
6875
  # def end_document
6374
6876
  # puts "the document has ended"
6375
6877
  # end
@@ -6382,7 +6884,7 @@ end
6382
6884
  # Then I would instantiate a SAX parser with this document, and feed the parser some XML
6383
6885
  #
6384
6886
  # # Create a new parser
6385
- # parser = Nokogiri::XML::SAX::Parser.new(MyDocument.new)
6887
+ # parser = Nokogiri::XML::SAX::Parser.new(MyHandler.new)
6386
6888
  #
6387
6889
  # # Feed the parser some XML
6388
6890
  # parser.parse(File.open(ARGV[0]))
@@ -6390,133 +6892,254 @@ end
6390
6892
  # Now my document handler will be called when each node starts, and when then document ends. To
6391
6893
  # see what kinds of events are available, take a look at Nokogiri::XML::SAX::Document.
6392
6894
  #
6393
- # Two SAX parsers for XML are available, a parser that reads from a string or IO object as it
6394
- # feels necessary, and a parser that lets you spoon feed it XML. If you want to let Nokogiri
6395
- # deal with reading your XML, use the Nokogiri::XML::SAX::Parser. If you want to have fine grain
6396
- # control over the XML input, use the Nokogiri::XML::SAX::PushParser.
6397
- #
6398
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#45
6895
+ # source://nokogiri//lib/nokogiri/xml/sax.rb#46
6399
6896
  module Nokogiri::XML::SAX; end
6400
6897
 
6401
- # This class is used for registering types of events you are interested in handling. All of
6402
- # the methods on this class are available as possible events while parsing an XML document. To
6403
- # register for any particular event, just subclass this class and implement the methods you
6404
- # are interested in knowing about.
6898
+ # :markup: markdown
6899
+ #
6900
+ # The SAX::Document class is used for registering types of events you are interested in
6901
+ # handling. All of the methods on this class are available as possible events while parsing an
6902
+ # \XML document. To register for any particular event, subclass this class and implement the
6903
+ # methods you are interested in knowing about.
6405
6904
  #
6406
6905
  # To only be notified about start and end element events, write a class like this:
6407
6906
  #
6408
- # class MyDocument < Nokogiri::XML::SAX::Document
6409
- # def start_element name, attrs = []
6410
- # puts "#{name} started!"
6411
- # end
6907
+ # class MyHandler < Nokogiri::XML::SAX::Document
6908
+ # def start_element name, attrs = []
6909
+ # puts "#{name} started!"
6910
+ # end
6412
6911
  #
6413
- # def end_element name
6414
- # puts "#{name} ended"
6912
+ # def end_element name
6913
+ # puts "#{name} ended"
6914
+ # end
6415
6915
  # end
6416
- # end
6417
6916
  #
6418
- # You can use this event handler for any SAX style parser included with Nokogiri. See
6419
- # Nokogiri::XML::SAX, and Nokogiri::HTML4::SAX.
6917
+ # You can use this event handler for any SAX-style parser included with Nokogiri.
6918
+ #
6919
+ # See also:
6920
+ #
6921
+ # - Nokogiri::XML::SAX
6922
+ # - Nokogiri::HTML4::SAX
6923
+ #
6924
+ # ### Entity Handling
6925
+ #
6926
+ # ⚠ Entity handling is complicated in a SAX parser! Please read this section carefully if
6927
+ # you're not getting the behavior you expect.
6928
+ #
6929
+ # Entities will be reported to the user via callbacks to #characters, to #reference, or
6930
+ # possibly to both. The behavior is determined by a combination of _entity type_ and the value
6931
+ # of ParserContext#replace_entities. (Recall that the default value of
6932
+ # ParserContext#replace_entities is `false`.)
6420
6933
  #
6421
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#66
6934
+ # ⚠ <b>It is UNSAFE to set ParserContext#replace_entities to `true`</b> when parsing untrusted
6935
+ # documents.
6936
+ #
6937
+ # 💡 For more information on entity types, see [Wikipedia's page on
6938
+ # DTDs](https://en.wikipedia.org/wiki/Document_type_definition#Entity_declarations).
6939
+ #
6940
+ # | Entity type | #characters | #reference |
6941
+ # |--------------------------------------|------------------------------------|-------------------------------------|
6942
+ # | Char ref (e.g., <tt>&#146;</tt>) | always | never |
6943
+ # | Predefined (e.g., <tt>&amp;</tt>) | always | never |
6944
+ # | Undeclared † | never | <tt>#replace_entities == false</tt> |
6945
+ # | Internal | always | <tt>#replace_entities == false</tt> |
6946
+ # | External † | <tt>#replace_entities == true</tt> | <tt>#replace_entities == false</tt> |
6947
+ #
6948
+ # &nbsp;
6949
+ #
6950
+ # † In the case where the replacement text for the entity is unknown (e.g., an undeclared entity
6951
+ # or an external entity that could not be resolved because of network issues), then the
6952
+ # replacement text will not be reported. If ParserContext#replace_entities is `true`, this
6953
+ # means the #characters callback will not be invoked. If ParserContext#replace_entities is
6954
+ # `false`, then the #reference callback will be invoked, but with `nil` for the `content`
6955
+ # argument.
6956
+ #
6957
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#65
6422
6958
  class Nokogiri::XML::SAX::Document
6423
6959
  # Called when cdata blocks are found
6424
- # +string+ contains the cdata content
6960
+ # [Parameters]
6961
+ # - +string+ contains the cdata content
6425
6962
  #
6426
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#155
6963
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#245
6427
6964
  def cdata_block(string); end
6428
6965
 
6429
- # Characters read between a tag. This method might be called multiple
6430
- # times given one contiguous string of characters.
6966
+ # Called when character data is parsed, and for parsed entities when
6967
+ # ParserContext#replace_entities is +true+.
6968
+ #
6969
+ # [Parameters]
6970
+ # - +string+ contains the character data or entity replacement text
6971
+ #
6972
+ # ⚠ Please see Document@Entity+Handling for important information about how entities are handled.
6431
6973
  #
6432
- # +string+ contains the character data
6974
+ # This method might be called multiple times for a contiguous string of characters.
6433
6975
  #
6434
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#131
6976
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#201
6435
6977
  def characters(string); end
6436
6978
 
6437
6979
  # Called when comments are encountered
6438
- # +string+ contains the comment data
6980
+ # [Parameters]
6981
+ # - +string+ contains the comment data
6439
6982
  #
6440
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#137
6983
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#224
6441
6984
  def comment(string); end
6442
6985
 
6443
- # Called when document ends parsing
6986
+ # Called when document ends parsing.
6444
6987
  #
6445
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#79
6988
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#83
6446
6989
  def end_document; end
6447
6990
 
6448
- # Called at the end of an element
6449
- # +name+ is the tag name
6991
+ # Called at the end of an element.
6992
+ #
6993
+ # [Parameters]
6994
+ # - +name+ (String) the name of the element being closed
6450
6995
  #
6451
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#93
6996
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#122
6452
6997
  def end_element(name); end
6453
6998
 
6454
- # Called at the end of an element
6455
- # +name+ is the element's name
6456
- # +prefix+ is the namespace prefix associated with the element
6457
- # +uri+ is the associated namespace URI
6999
+ # Called at the end of an element.
7000
+ #
7001
+ # [Parameters]
7002
+ # - +name+ (String) is the name of the element
7003
+ # - +prefix+ (String, nil) is the namespace prefix for the element
7004
+ # - +uri+ (String, nil) is the associated URI for the element's namespace
6458
7005
  #
6459
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#120
7006
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#185
6460
7007
  def end_element_namespace(name, prefix = T.unsafe(nil), uri = T.unsafe(nil)); end
6461
7008
 
6462
7009
  # Called on document errors
6463
- # +string+ contains the error
7010
+ # [Parameters]
7011
+ # - +string+ contains the error
6464
7012
  #
6465
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#149
7013
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#238
6466
7014
  def error(string); end
6467
7015
 
6468
7016
  # Called when processing instructions are found
6469
- # +name+ is the target of the instruction
6470
- # +content+ is the value of the instruction
7017
+ # [Parameters]
7018
+ # - +name+ is the target of the instruction
7019
+ # - +content+ is the value of the instruction
6471
7020
  #
6472
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#162
7021
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#253
6473
7022
  def processing_instruction(name, content); end
6474
7023
 
6475
- # Called when document starts parsing
7024
+ # Called when a parsed entity is referenced and not replaced.
7025
+ #
7026
+ # [Parameters]
7027
+ # - +name+ (String) is the name of the entity
7028
+ # - +content+ (String, nil) is the replacement text for the entity, if known
7029
+ #
7030
+ # ⚠ Please see Document@Entity+Handling for important information about how entities are handled.
7031
+ #
7032
+ # ⚠ An internal entity may result in a call to both #characters and #reference.
7033
+ #
7034
+ # Since v1.17.0
7035
+ #
7036
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#217
7037
+ def reference(name, content); end
7038
+
7039
+ # Called when document starts parsing.
6476
7040
  #
6477
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#74
7041
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#78
6478
7042
  def start_document; end
6479
7043
 
6480
- # Called at the beginning of an element
6481
- # * +name+ is the name of the tag
6482
- # * +attrs+ are an assoc list of namespaces and attributes, e.g.:
7044
+ # Called at the beginning of an element.
7045
+ #
7046
+ # [Parameters]
7047
+ # - +name+ (String) the name of the element
7048
+ # - +attrs+ (Array<Array<String>>) an assoc list of namespace declarations and attributes, e.g.:
6483
7049
  # [ ["xmlns:foo", "http://sample.net"], ["size", "large"] ]
6484
7050
  #
6485
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#87
7051
+ # 💡If you're dealing with XML and need to handle namespaces, use the
7052
+ # #start_element_namespace method instead.
7053
+ #
7054
+ # Note that the element namespace and any attribute namespaces are not provided, and so any
7055
+ # namespaced elements or attributes will be returned as strings including the prefix:
7056
+ #
7057
+ # parser.parse(<<~XML)
7058
+ # <root xmlns:foo='http://foo.example.com/' xmlns='http://example.com/'>
7059
+ # <foo:bar foo:quux="xxx">hello world</foo:bar>
7060
+ # </root>
7061
+ # XML
7062
+ #
7063
+ # assert_pattern do
7064
+ # parser.document.start_elements => [
7065
+ # ["root", [["xmlns:foo", "http://foo.example.com/"], ["xmlns", "http://example.com/"]]],
7066
+ # ["foo:bar", [["foo:quux", "xxx"]]],
7067
+ # ]
7068
+ # end
7069
+ #
7070
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#113
6486
7071
  def start_element(name, attrs = T.unsafe(nil)); end
6487
7072
 
6488
- # Called at the beginning of an element
6489
- # +name+ is the element name
6490
- # +attrs+ is a list of attributes
6491
- # +prefix+ is the namespace prefix for the element
6492
- # +uri+ is the associated namespace URI
6493
- # +ns+ is a hash of namespace prefix:urls associated with the element
7073
+ # Called at the beginning of an element.
7074
+ #
7075
+ # [Parameters]
7076
+ # - +name+ (String) is the name of the element
7077
+ # - +attrs+ (Array<Attribute>) is an array of structs with the following properties:
7078
+ # - +localname+ (String) the local name of the attribute
7079
+ # - +value+ (String) the value of the attribute
7080
+ # - +prefix+ (String, nil) the namespace prefix of the attribute
7081
+ # - +uri+ (String, nil) the namespace URI of the attribute
7082
+ # - +prefix+ (String, nil) is the namespace prefix for the element
7083
+ # - +uri+ (String, nil) is the associated URI for the element's namespace
7084
+ # - +ns+ (Array<Array<String, String>>) is an assoc list of namespace declarations on the element
7085
+ #
7086
+ # 💡If you're dealing with HTML or don't care about namespaces, try #start_element instead.
7087
+ #
7088
+ # [Example]
7089
+ # it "start_elements_namespace is called with namespaced attributes" do
7090
+ # parser.parse(<<~XML)
7091
+ # <root xmlns:foo='http://foo.example.com/'>
7092
+ # <foo:a foo:bar='hello' />
7093
+ # </root>
7094
+ # XML
7095
+ #
7096
+ # assert_pattern do
7097
+ # parser.document.start_elements_namespace => [
7098
+ # [
7099
+ # "root",
7100
+ # [],
7101
+ # nil, nil,
7102
+ # [["foo", "http://foo.example.com/"]], # namespace declarations
7103
+ # ], [
7104
+ # "a",
7105
+ # [Nokogiri::XML::SAX::Parser::Attribute(localname: "bar", prefix: "foo", uri: "http://foo.example.com/", value: "hello")], # prefixed attribute
7106
+ # "foo", "http://foo.example.com/", # prefix and uri for the "a" element
7107
+ # [],
7108
+ # ]
7109
+ # ]
7110
+ # end
7111
+ # end
6494
7112
  #
6495
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#103
7113
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#166
6496
7114
  def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end
6497
7115
 
6498
7116
  # Called on document warnings
6499
- # +string+ contains the warning
7117
+ # [Parameters]
7118
+ # - +string+ contains the warning
6500
7119
  #
6501
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#143
7120
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#231
6502
7121
  def warning(string); end
6503
7122
 
6504
- # Called when an XML declaration is parsed
7123
+ # Called when an \XML declaration is parsed.
6505
7124
  #
6506
- # source://nokogiri//lib/nokogiri/xml/sax/document.rb#69
7125
+ # [Parameters]
7126
+ # - +version+ (String) the version attribute
7127
+ # - +encoding+ (String, nil) the encoding of the document if present, else +nil+
7128
+ # - +standalone+ ("yes", "no", nil) the standalone attribute if present, else +nil+
7129
+ #
7130
+ # source://nokogiri//lib/nokogiri/xml/sax/document.rb#73
6507
7131
  def xmldecl(version, encoding, standalone); end
6508
7132
  end
6509
7133
 
6510
- # This parser is a SAX style parser that reads it's input as it
6511
- # deems necessary. The parser takes a Nokogiri::XML::SAX::Document,
6512
- # an optional encoding, then given an XML input, sends messages to
6513
- # the Nokogiri::XML::SAX::Document.
7134
+ # This parser is a SAX style parser that reads its input as it deems necessary. The parser
7135
+ # takes a Nokogiri::XML::SAX::Document, an optional encoding, then given an XML input, sends
7136
+ # messages to the Nokogiri::XML::SAX::Document.
6514
7137
  #
6515
7138
  # Here is an example of using this parser:
6516
7139
  #
6517
7140
  # # Create a subclass of Nokogiri::XML::SAX::Document and implement
6518
7141
  # # the events we care about:
6519
- # class MyDoc < Nokogiri::XML::SAX::Document
7142
+ # class MyHandler < Nokogiri::XML::SAX::Document
6520
7143
  # def start_element name, attrs = []
6521
7144
  # puts "starting: #{name}"
6522
7145
  # end
@@ -6526,89 +7149,165 @@ end
6526
7149
  # end
6527
7150
  # end
6528
7151
  #
6529
- # # Create our parser
6530
- # parser = Nokogiri::XML::SAX::Parser.new(MyDoc.new)
7152
+ # parser = Nokogiri::XML::SAX::Parser.new(MyHandler.new)
6531
7153
  #
6532
- # # Send some XML to the parser
6533
- # parser.parse(File.open(ARGV[0]))
7154
+ # # Hand an IO object to the parser, which will read the XML from the IO.
7155
+ # File.open(path_to_xml) do |f|
7156
+ # parser.parse(f)
7157
+ # end
7158
+ #
7159
+ # For more information about \SAX parsers, see Nokogiri::XML::SAX.
7160
+ #
7161
+ # Also see Nokogiri::XML::SAX::Document for the available events.
6534
7162
  #
6535
- # For more information about SAX parsers, see Nokogiri::XML::SAX. Also
6536
- # see Nokogiri::XML::SAX::Document for the available events.
7163
+ # For \HTML documents, use the subclass Nokogiri::HTML4::SAX::Parser.
6537
7164
  #
6538
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#34
7165
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#38
6539
7166
  class Nokogiri::XML::SAX::Parser
6540
- # Create a new Parser with +doc+ and +encoding+
7167
+ include ::Nokogiri::ClassResolver
7168
+
7169
+ # :call-seq:
7170
+ # new ⇒ SAX::Parser
7171
+ # new(handler) ⇒ SAX::Parser
7172
+ # new(handler, encoding) ⇒ SAX::Parser
7173
+ #
7174
+ # Create a new Parser.
7175
+ #
7176
+ # [Parameters]
7177
+ # - +handler+ (optional Nokogiri::XML::SAX::Document) The document that will receive
7178
+ # events. Will create a new Nokogiri::XML::SAX::Document if not given, which is accessible
7179
+ # through the #document attribute.
7180
+ # - +encoding+ (optional Encoding, String, nil) An Encoding or encoding name to use when
7181
+ # parsing the input. (default +nil+ for auto-detection)
6541
7182
  #
6542
7183
  # @return [Parser] a new instance of Parser
6543
7184
  #
6544
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#72
7185
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#95
6545
7186
  def initialize(doc = T.unsafe(nil), encoding = T.unsafe(nil)); end
6546
7187
 
6547
7188
  # The Nokogiri::XML::SAX::Document where events will be sent.
6548
7189
  #
6549
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#66
7190
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#75
6550
7191
  def document; end
6551
7192
 
6552
7193
  # The Nokogiri::XML::SAX::Document where events will be sent.
6553
7194
  #
6554
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#66
7195
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#75
6555
7196
  def document=(_arg0); end
6556
7197
 
6557
7198
  # The encoding beings used for this document.
6558
7199
  #
6559
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#69
7200
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#78
6560
7201
  def encoding; end
6561
7202
 
6562
7203
  # The encoding beings used for this document.
6563
7204
  #
6564
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#69
7205
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#78
6565
7206
  def encoding=(_arg0); end
6566
7207
 
6567
- # Parse given +thing+ which may be a string containing xml, or an
6568
- # IO object.
7208
+ # :call-seq:
7209
+ # parse(input) { |parser_context| ... }
7210
+ #
7211
+ # Parse the input, sending events to the SAX::Document at #document.
7212
+ #
7213
+ # [Parameters]
7214
+ # - +input+ (String, IO) The input to parse.
7215
+ #
7216
+ # If +input+ quacks like a readable IO object, this method forwards to Parser.parse_io,
7217
+ # otherwise it forwards to Parser.parse_memory.
7218
+ #
7219
+ # [Yields]
7220
+ # If a block is given, the underlying ParserContext object will be yielded. This can be used
7221
+ # to set options on the parser context before parsing begins.
6569
7222
  #
6570
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#81
6571
- def parse(thing, &block); end
7223
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#119
7224
+ def parse(input, &block); end
6572
7225
 
6573
- # Parse a file with +filename+
7226
+ # :call-seq:
7227
+ # parse_file(filename) { |parser_context| ... }
7228
+ # parse_file(filename, encoding) { |parser_context| ... }
7229
+ #
7230
+ # Parse a file.
7231
+ #
7232
+ # [Parameters]
7233
+ # - +filename+ (String) The path to the file to be parsed.
7234
+ # - +encoding+ (optional Encoding, String, nil) An Encoding or encoding name to use when
7235
+ # parsing the input, or +nil+ for auto-detection. (default #encoding)
7236
+ #
7237
+ # [Yields]
7238
+ # If a block is given, the underlying ParserContext object will be yielded. This can be used
7239
+ # to set options on the parser context before parsing begins.
6574
7240
  #
6575
7241
  # @raise [ArgumentError]
6576
7242
  # @yield [ctx]
6577
7243
  #
6578
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#99
6579
- def parse_file(filename); end
7244
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#187
7245
+ def parse_file(filename, encoding = T.unsafe(nil)); end
6580
7246
 
6581
- # Parse given +io+
7247
+ # :call-seq:
7248
+ # parse_io(io) { |parser_context| ... }
7249
+ # parse_io(io, encoding) { |parser_context| ... }
7250
+ #
7251
+ # Parse an input stream.
7252
+ #
7253
+ # [Parameters]
7254
+ # - +io+ (IO) The readable IO object from which to read input
7255
+ # - +encoding+ (optional Encoding, String, nil) An Encoding or encoding name to use when
7256
+ # parsing the input, or +nil+ for auto-detection. (default #encoding)
7257
+ #
7258
+ # [Yields]
7259
+ # If a block is given, the underlying ParserContext object will be yielded. This can be used
7260
+ # to set options on the parser context before parsing begins.
6582
7261
  #
6583
7262
  # @yield [ctx]
6584
7263
  #
6585
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#91
7264
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#143
6586
7265
  def parse_io(io, encoding = T.unsafe(nil)); end
6587
7266
 
7267
+ # :call-seq:
7268
+ # parse_memory(input) { |parser_context| ... }
7269
+ # parse_memory(input, encoding) { |parser_context| ... }
7270
+ #
7271
+ # Parse an input string.
7272
+ #
7273
+ # [Parameters]
7274
+ # - +input+ (String) The input string to be parsed.
7275
+ # - +encoding+ (optional Encoding, String, nil) An Encoding or encoding name to use when
7276
+ # parsing the input, or +nil+ for auto-detection. (default #encoding)
7277
+ #
7278
+ # [Yields]
7279
+ # If a block is given, the underlying ParserContext object will be yielded. This can be used
7280
+ # to set options on the parser context before parsing begins.
7281
+ #
6588
7282
  # @yield [ctx]
6589
7283
  #
6590
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#109
6591
- def parse_memory(data); end
7284
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#165
7285
+ def parse_memory(input, encoding = T.unsafe(nil)); end
6592
7286
 
6593
7287
  private
6594
7288
 
6595
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#117
6596
- def check_encoding(encoding); end
7289
+ def initialize_native; end
6597
7290
  end
6598
7291
 
6599
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#35
7292
+ # Structure used for marshalling attributes for some callbacks in XML::SAX::Document.
7293
+ #
7294
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#43
6600
7295
  class Nokogiri::XML::SAX::Parser::Attribute < ::Struct; end
6601
7296
 
6602
- # Encodinds this parser supports
6603
- #
6604
- # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#39
7297
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#46
6605
7298
  Nokogiri::XML::SAX::Parser::ENCODINGS = T.let(T.unsafe(nil), Hash)
6606
7299
 
6607
- # Context for XML SAX parsers. This class is usually not instantiated
6608
- # by the user. Instead, you should be looking at
6609
- # Nokogiri::XML::SAX::Parser
7300
+ # pure ASCII
7301
+ #
7302
+ # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#71
7303
+ Nokogiri::XML::SAX::Parser::REVERSE_ENCODINGS = T.let(T.unsafe(nil), Hash)
7304
+
7305
+ # Context object to invoke the XML SAX parser on the SAX::Document handler.
6610
7306
  #
6611
- # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#10
7307
+ # 💡 This class is usually not instantiated by the user. Use Nokogiri::XML::SAX::Parser
7308
+ # instead.
7309
+ #
7310
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#11
6612
7311
  class Nokogiri::XML::SAX::ParserContext
6613
7312
  def column; end
6614
7313
  def line; end
@@ -6619,12 +7318,91 @@ class Nokogiri::XML::SAX::ParserContext
6619
7318
  def replace_entities=(_arg0); end
6620
7319
 
6621
7320
  class << self
6622
- def file(_arg0); end
6623
- def io(_arg0, _arg1); end
6624
- def memory(_arg0); end
7321
+ # :call-seq:
7322
+ # file(path)
7323
+ # file(path, encoding)
7324
+ #
7325
+ # Create a parser context for the file at +path+.
7326
+ #
7327
+ # [Parameters]
7328
+ # - +path+ (String) The path to the input file
7329
+ # - +encoding+ (optional) (Encoding, String) The +Encoding+ to use, or the name of an encoding to
7330
+ # use (default +nil+, encoding will be autodetected)
7331
+ #
7332
+ # [Returns] Nokogiri::XML::SAX::ParserContext
7333
+ #
7334
+ # 💡 Calling this method directly is discouraged. Use Nokogiri::XML::SAX::Parser.parse_file which
7335
+ # is more convenient for most use cases.
7336
+ #
7337
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#97
7338
+ def file(input, encoding = T.unsafe(nil)); end
7339
+
7340
+ # :call-seq:
7341
+ # io(input)
7342
+ # io(input, encoding)
7343
+ #
7344
+ # Create a parser context for an +input+ IO which will assume +encoding+
7345
+ #
7346
+ # [Parameters]
7347
+ # - +io+ (IO) The readable IO object from which to read input
7348
+ # - +encoding+ (optional) (Encoding) The +Encoding+ to use, or the name of an
7349
+ # encoding to use (default +nil+, encoding will be autodetected)
7350
+ #
7351
+ # [Returns] Nokogiri::XML::SAX::ParserContext
7352
+ #
7353
+ # 💡 Calling this method directly is discouraged. Use Nokogiri::XML::SAX::Parser parse
7354
+ # methods which are more convenient for most use cases.
7355
+ #
7356
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#56
7357
+ def io(input, encoding = T.unsafe(nil)); end
7358
+
7359
+ # :call-seq:
7360
+ # memory(input)
7361
+ # memory(input, encoding)
7362
+ #
7363
+ # Create a parser context for the +input+ String.
7364
+ #
7365
+ # [Parameters]
7366
+ # - +input+ (String) The input string to be parsed.
7367
+ # - +encoding+ (optional) (Encoding, String) The +Encoding+ to use, or the name of an encoding to
7368
+ # use (default +nil+, encoding will be autodetected)
7369
+ #
7370
+ # [Returns] Nokogiri::XML::SAX::ParserContext
7371
+ #
7372
+ # 💡 Calling this method directly is discouraged. Use Nokogiri::XML::SAX::Parser parse methods
7373
+ # which are more convenient for most use cases.
7374
+ #
7375
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#77
7376
+ def memory(input, encoding = T.unsafe(nil)); end
7377
+
7378
+ def native_file(_arg0, _arg1); end
7379
+ def native_io(_arg0, _arg1); end
7380
+ def native_memory(_arg0, _arg1); end
7381
+
7382
+ # :call-seq:
7383
+ # new(input)
7384
+ # new(input, encoding)
7385
+ #
7386
+ # Create a parser context for an IO or a String. This is a shorthand method for
7387
+ # ParserContext.io and ParserContext.memory.
7388
+ #
7389
+ # [Parameters]
7390
+ # - +input+ (IO, String) A String or a readable IO object
7391
+ # - +encoding+ (optional) (Encoding) The +Encoding+ to use, or the name of an
7392
+ # encoding to use (default +nil+, encoding will be autodetected)
7393
+ #
7394
+ # If +input+ quacks like a readable IO object, this method forwards to ParserContext.io,
7395
+ # otherwise it forwards to ParserContext.memory.
7396
+ #
7397
+ # [Returns] Nokogiri::XML::SAX::ParserContext
7398
+ #
7399
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#31
7400
+ def new(input, encoding = T.unsafe(nil)); end
7401
+
7402
+ private
6625
7403
 
6626
- # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#11
6627
- def new(thing, encoding = T.unsafe(nil)); end
7404
+ # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#101
7405
+ def resolve_encoding(encoding); end
6628
7406
  end
6629
7407
  end
6630
7408
 
@@ -6680,7 +7458,10 @@ class Nokogiri::XML::SAX::PushParser
6680
7458
  # Finish the parsing. This method is only necessary for
6681
7459
  # Nokogiri::XML::SAX::Document#end_document to be called.
6682
7460
  #
6683
- # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#55
7461
+ # ⚠ Note that empty documents are treated as an error when using the libxml2-based
7462
+ # implementation (CRuby), but are fine when using the Xerces-based implementation (JRuby).
7463
+ #
7464
+ # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#58
6684
7465
  def finish; end
6685
7466
 
6686
7467
  def options; end
@@ -6700,66 +7481,112 @@ class Nokogiri::XML::SAX::PushParser
6700
7481
  def native_write(_arg0, _arg1); end
6701
7482
  end
6702
7483
 
6703
- # Nokogiri::XML::Schema is used for validating XML against a schema
6704
- # (usually from an xsd file).
7484
+ # Nokogiri::XML::Schema is used for validating \XML against an \XSD schema definition.
6705
7485
  #
6706
- # == Synopsis
7486
+ # Since v1.11.0, Schema treats inputs as *untrusted* by default, and so external entities are
7487
+ # not resolved from the network (+http://+ or +ftp://+). When parsing a trusted document, the
7488
+ # caller may turn off the +NONET+ option via the ParseOptions to (re-)enable external entity
7489
+ # resolution over a network connection.
6707
7490
  #
6708
- # Validate an XML document against a Schema. Loop over the errors that
6709
- # are returned and print them out:
7491
+ # 🛡 Before v1.11.0, documents were "trusted" by default during schema parsing which was counter
7492
+ # to Nokogiri's "untrusted by default" security policy.
6710
7493
  #
6711
- # xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE))
6712
- # doc = Nokogiri::XML(File.read(PO_XML_FILE))
7494
+ # *Example:* Determine whether an \XML document is valid.
6713
7495
  #
6714
- # xsd.validate(doc).each do |error|
6715
- # puts error.message
6716
- # end
7496
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7497
+ # doc = Nokogiri::XML::Document.parse(File.read(XML_FILE))
7498
+ # schema.valid?(doc) # Boolean
6717
7499
  #
6718
- # The list of errors are Nokogiri::XML::SyntaxError objects.
7500
+ # *Example:* Validate an \XML document against an \XSD schema, and capture any errors that are found.
6719
7501
  #
6720
- # NOTE: As of v1.11.0, Schema treats inputs as UNTRUSTED by default, and so external entities
6721
- # are not resolved from the network (`http://` or `ftp://`). Previously, parsing treated
6722
- # documents as "trusted" by default which was counter to Nokogiri's "untrusted by default"
6723
- # security policy. If a document is trusted, then the caller may turn off the NONET option via
6724
- # the ParseOptions to re-enable external entity resolution over a network connection.
7502
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7503
+ # doc = Nokogiri::XML::Document.parse(File.read(XML_FILE))
7504
+ # errors = schema.validate(doc) # Array<SyntaxError>
6725
7505
  #
6726
- # source://nokogiri//lib/nokogiri/xml/schema.rb#37
7506
+ # *Example:* Validate an \XML document using a Document containing an \XSD schema definition.
7507
+ #
7508
+ # schema_doc = Nokogiri::XML::Document.parse(File.read(RELAX_NG_FILE))
7509
+ # schema = Nokogiri::XML::Schema.from_document(schema_doc)
7510
+ # doc = Nokogiri::XML::Document.parse(File.read(XML_FILE))
7511
+ # schema.valid?(doc) # Boolean
7512
+ #
7513
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#45
6727
7514
  class Nokogiri::XML::Schema
6728
- # Errors while parsing the schema file
7515
+ # The errors found while parsing the \XSD
6729
7516
  #
6730
- # source://nokogiri//lib/nokogiri/xml/schema.rb#39
7517
+ # [Returns] Array<Nokogiri::XML::SyntaxError>
7518
+ #
7519
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#49
6731
7520
  def errors; end
6732
7521
 
6733
- # Errors while parsing the schema file
7522
+ # The errors found while parsing the \XSD
6734
7523
  #
6735
- # source://nokogiri//lib/nokogiri/xml/schema.rb#39
7524
+ # [Returns] Array<Nokogiri::XML::SyntaxError>
7525
+ #
7526
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#49
6736
7527
  def errors=(_arg0); end
6737
7528
 
6738
- # The Nokogiri::XML::ParseOptions used to parse the schema
7529
+ # The options used to parse the schema
7530
+ #
7531
+ # [Returns] Nokogiri::XML::ParseOptions
6739
7532
  #
6740
- # source://nokogiri//lib/nokogiri/xml/schema.rb#41
7533
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#54
6741
7534
  def parse_options; end
6742
7535
 
6743
- # The Nokogiri::XML::ParseOptions used to parse the schema
7536
+ # The options used to parse the schema
6744
7537
  #
6745
- # source://nokogiri//lib/nokogiri/xml/schema.rb#41
7538
+ # [Returns] Nokogiri::XML::ParseOptions
7539
+ #
7540
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#54
6746
7541
  def parse_options=(_arg0); end
6747
7542
 
6748
- # Returns true if +thing+ is a valid Nokogiri::XML::Document or
6749
- # file.
7543
+ # :call-seq: valid?(input) Boolean
7544
+ #
7545
+ # Validate +input+ and return a Boolean indicating whether the document is valid
7546
+ #
7547
+ # [Parameters]
7548
+ # - +input+ (Nokogiri::XML::Document | String)
7549
+ # A parsed document, or a string containing a local filename.
7550
+ #
7551
+ # [Returns] Boolean
7552
+ #
7553
+ # *Example:* Validate an existing XML::Document
7554
+ #
7555
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7556
+ # return unless schema.valid?(document)
7557
+ #
7558
+ # *Example:* Validate an \XML document on disk
7559
+ #
7560
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7561
+ # return unless schema.valid?("/path/to/file.xml")
6750
7562
  #
6751
7563
  # @return [Boolean]
6752
7564
  #
6753
- # source://nokogiri//lib/nokogiri/xml/schema.rb#68
6754
- def valid?(thing); end
7565
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#135
7566
+ def valid?(input); end
6755
7567
 
6756
- # Validate +thing+ against this schema. +thing+ can be a
6757
- # Nokogiri::XML::Document object, or a filename. An Array of
6758
- # Nokogiri::XML::SyntaxError objects found while validating the
6759
- # +thing+ is returned.
7568
+ # :call-seq: validate(input) Array<SyntaxError>
6760
7569
  #
6761
- # source://nokogiri//lib/nokogiri/xml/schema.rb#55
6762
- def validate(thing); end
7570
+ # Validate +input+ and return any errors that are found.
7571
+ #
7572
+ # [Parameters]
7573
+ # - +input+ (Nokogiri::XML::Document | String)
7574
+ # A parsed document, or a string containing a local filename.
7575
+ #
7576
+ # [Returns] Array<SyntaxError>
7577
+ #
7578
+ # *Example:* Validate an existing XML::Document, and capture any errors that are found.
7579
+ #
7580
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7581
+ # errors = schema.validate(document)
7582
+ #
7583
+ # *Example:* Validate an \XML document on disk, and capture any errors that are found.
7584
+ #
7585
+ # schema = Nokogiri::XML::Schema.new(File.read(XSD_FILE))
7586
+ # errors = schema.validate("/path/to/file.xml")
7587
+ #
7588
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#104
7589
+ def validate(input); end
6763
7590
 
6764
7591
  private
6765
7592
 
@@ -6769,13 +7596,30 @@ class Nokogiri::XML::Schema
6769
7596
  class << self
6770
7597
  def from_document(*_arg0); end
6771
7598
 
6772
- # Create a new Nokogiri::XML::Schema object using a +string_or_io+
6773
- # object.
7599
+ # :call-seq:
7600
+ # new(input) → Nokogiri::XML::Schema
7601
+ # new(input, parse_options) → Nokogiri::XML::Schema
6774
7602
  #
6775
- # source://nokogiri//lib/nokogiri/xml/schema.rb#46
6776
- def new(string_or_io, options = T.unsafe(nil)); end
7603
+ # Parse an \XSD schema definition from a String or IO to create a new Nokogiri::XML::Schema
7604
+ #
7605
+ # [Parameters]
7606
+ # - +input+ (String | IO) \XSD schema definition
7607
+ # - +parse_options+ (Nokogiri::XML::ParseOptions)
7608
+ # Defaults to Nokogiri::XML::ParseOptions::DEFAULT_SCHEMA
7609
+ #
7610
+ # [Returns] Nokogiri::XML::Schema
7611
+ #
7612
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#69
7613
+ def new(input, parse_options_ = T.unsafe(nil), parse_options: T.unsafe(nil)); end
6777
7614
 
6778
- def read_memory(*_arg0); end
7615
+ # :call-seq:
7616
+ # read_memory(input) → Nokogiri::XML::Schema
7617
+ # read_memory(input, parse_options) → Nokogiri::XML::Schema
7618
+ #
7619
+ # Convenience method for Nokogiri::XML::Schema.new
7620
+ #
7621
+ # source://nokogiri//lib/nokogiri/xml/schema.rb#78
7622
+ def read_memory(*_arg0, **_arg1, &_arg2); end
6779
7623
  end
6780
7624
  end
6781
7625
 
@@ -7001,22 +7845,22 @@ module Nokogiri::XML::Searchable
7001
7845
 
7002
7846
  private
7003
7847
 
7004
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#210
7848
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#228
7005
7849
  def css_internal(node, rules, handler, ns); end
7006
7850
 
7007
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#241
7851
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#232
7008
7852
  def css_rules_to_xpath(rules, ns); end
7009
7853
 
7010
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#259
7854
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#210
7011
7855
  def extract_params(params); end
7012
7856
 
7013
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#229
7857
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#263
7014
7858
  def xpath_impl(node, path, handler, ns, binds); end
7015
7859
 
7016
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#214
7860
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#248
7017
7861
  def xpath_internal(node, paths, handler, ns, binds); end
7018
7862
 
7019
- # source://nokogiri//lib/nokogiri/xml/searchable.rb#245
7863
+ # source://nokogiri//lib/nokogiri/xml/searchable.rb#236
7020
7864
  def xpath_query_from_css_rule(rule, ns); end
7021
7865
  end
7022
7866
 
@@ -7033,97 +7877,113 @@ Nokogiri::XML::Searchable::LOOKS_LIKE_XPATH = T.let(T.unsafe(nil), Regexp)
7033
7877
  class Nokogiri::XML::SyntaxError < ::Nokogiri::SyntaxError
7034
7878
  # Returns the value of attribute code.
7035
7879
  #
7036
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#10
7880
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#23
7037
7881
  def code; end
7038
7882
 
7039
7883
  # Returns the value of attribute column.
7040
7884
  #
7041
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#18
7885
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#40
7042
7886
  def column; end
7043
7887
 
7044
7888
  # Returns the value of attribute domain.
7045
7889
  #
7046
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#9
7890
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#22
7047
7891
  def domain; end
7048
7892
 
7049
7893
  # return true if this is an error
7050
7894
  #
7051
7895
  # @return [Boolean]
7052
7896
  #
7053
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#34
7897
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#56
7054
7898
  def error?; end
7055
7899
 
7056
7900
  # return true if this error is fatal
7057
7901
  #
7058
7902
  # @return [Boolean]
7059
7903
  #
7060
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#40
7904
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#62
7061
7905
  def fatal?; end
7062
7906
 
7063
7907
  # Returns the value of attribute file.
7064
7908
  #
7065
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#12
7909
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#25
7066
7910
  def file; end
7067
7911
 
7068
7912
  # Returns the value of attribute int1.
7069
7913
  #
7070
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#17
7914
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#39
7071
7915
  def int1; end
7072
7916
 
7073
7917
  # Returns the value of attribute level.
7074
7918
  #
7075
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#11
7919
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#24
7076
7920
  def level; end
7077
7921
 
7078
7922
  # Returns the value of attribute line.
7079
7923
  #
7080
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#13
7924
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#26
7081
7925
  def line; end
7082
7926
 
7083
7927
  # return true if this is a non error
7084
7928
  #
7085
7929
  # @return [Boolean]
7086
7930
  #
7087
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#22
7931
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#44
7088
7932
  def none?; end
7089
7933
 
7934
+ # The XPath path of the node that caused the error when validating a `Nokogiri::XML::Document`.
7935
+ #
7936
+ # This attribute will only be non-nil when the error is emitted by `Schema#validate` on
7937
+ # Document objects. It will return `nil` for DOM parsing errors and for errors emitted during
7938
+ # Schema validation of files.
7939
+ #
7940
+ # ⚠ `#path` is not supported on JRuby, where it will always return `nil`.
7941
+ #
7942
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#35
7943
+ def path; end
7944
+
7090
7945
  # Returns the value of attribute str1.
7091
7946
  #
7092
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#14
7947
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#36
7093
7948
  def str1; end
7094
7949
 
7095
7950
  # Returns the value of attribute str2.
7096
7951
  #
7097
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#15
7952
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#37
7098
7953
  def str2; end
7099
7954
 
7100
7955
  # Returns the value of attribute str3.
7101
7956
  #
7102
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#16
7957
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#38
7103
7958
  def str3; end
7104
7959
 
7105
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#44
7960
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#66
7106
7961
  def to_s; end
7107
7962
 
7108
7963
  # return true if this is a warning
7109
7964
  #
7110
7965
  # @return [Boolean]
7111
7966
  #
7112
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#28
7967
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#50
7113
7968
  def warning?; end
7114
7969
 
7115
7970
  private
7116
7971
 
7117
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#53
7972
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#75
7118
7973
  def level_to_s; end
7119
7974
 
7120
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#65
7975
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#87
7121
7976
  def location_to_s; end
7122
7977
 
7123
7978
  # @return [Boolean]
7124
7979
  #
7125
- # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#61
7980
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#83
7126
7981
  def nil_or_zero?(attribute); end
7982
+
7983
+ class << self
7984
+ # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#10
7985
+ def aggregate(errors); end
7986
+ end
7127
7987
  end
7128
7988
 
7129
7989
  # source://nokogiri//lib/nokogiri/xml/text.rb#5
@@ -7138,17 +7998,17 @@ end
7138
7998
 
7139
7999
  # Original C14N 1.0 spec canonicalization
7140
8000
  #
7141
- # source://nokogiri//lib/nokogiri/xml.rb#14
8001
+ # source://nokogiri//lib/nokogiri/xml.rb#13
7142
8002
  Nokogiri::XML::XML_C14N_1_0 = T.let(T.unsafe(nil), Integer)
7143
8003
 
7144
8004
  # C14N 1.1 spec canonicalization
7145
8005
  #
7146
- # source://nokogiri//lib/nokogiri/xml.rb#18
8006
+ # source://nokogiri//lib/nokogiri/xml.rb#17
7147
8007
  Nokogiri::XML::XML_C14N_1_1 = T.let(T.unsafe(nil), Integer)
7148
8008
 
7149
8009
  # Exclusive C14N 1.0 spec canonicalization
7150
8010
  #
7151
- # source://nokogiri//lib/nokogiri/xml.rb#16
8011
+ # source://nokogiri//lib/nokogiri/xml.rb#15
7152
8012
  Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 = T.let(T.unsafe(nil), Integer)
7153
8013
 
7154
8014
  # source://nokogiri//lib/nokogiri/xml/xpath.rb#5
@@ -7183,6 +8043,7 @@ end
7183
8043
  # source://nokogiri//lib/nokogiri/xml/xpath_context.rb#5
7184
8044
  class Nokogiri::XML::XPathContext
7185
8045
  def evaluate(*_arg0); end
8046
+ def node=(_arg0); end
7186
8047
 
7187
8048
  # Register namespaces in +namespaces+
7188
8049
  #
@@ -7192,6 +8053,9 @@ class Nokogiri::XML::XPathContext
7192
8053
  def register_ns(_arg0, _arg1); end
7193
8054
  def register_variable(_arg0, _arg1); end
7194
8055
 
8056
+ # source://nokogiri//lib/nokogiri/xml/xpath_context.rb#16
8057
+ def register_variables(binds); end
8058
+
7195
8059
  class << self
7196
8060
  def new(_arg0); end
7197
8061
  end
@@ -7200,7 +8064,7 @@ end
7200
8064
  # See Nokogiri::XSLT::Stylesheet for creating and manipulating
7201
8065
  # Stylesheet object.
7202
8066
  #
7203
- # source://nokogiri//lib/nokogiri/xslt.rb#21
8067
+ # source://nokogiri//lib/nokogiri/xslt.rb#15
7204
8068
  module Nokogiri::XSLT
7205
8069
  class << self
7206
8070
  # :call-seq:
@@ -7256,7 +8120,7 @@ module Nokogiri::XSLT
7256
8120
  # # " <reverse>raB</reverse>\n" +
7257
8121
  # # "</reversed>\n"
7258
8122
  #
7259
- # source://nokogiri//lib/nokogiri/xslt.rb#76
8123
+ # source://nokogiri//lib/nokogiri/xslt.rb#70
7260
8124
  def parse(string, modules = T.unsafe(nil)); end
7261
8125
 
7262
8126
  # :call-seq:
@@ -7270,7 +8134,7 @@ module Nokogiri::XSLT
7270
8134
  #
7271
8135
  # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform
7272
8136
  #
7273
- # source://nokogiri//lib/nokogiri/xslt.rb#100
8137
+ # source://nokogiri//lib/nokogiri/xslt.rb#94
7274
8138
  def quote_params(params); end
7275
8139
 
7276
8140
  def register(_arg0, _arg1); end
@@ -7284,18 +8148,41 @@ end
7284
8148
  # doc = Nokogiri::XML(File.read('some_file.xml'))
7285
8149
  # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
7286
8150
  #
7287
- # puts xslt.transform(doc)
8151
+ # xslt.transform(doc) # => Nokogiri::XML::Document
8152
+ #
8153
+ # Many XSLT transformations include serialization behavior to emit a non-XML document. For these
8154
+ # cases, please take care to invoke the #serialize method on the result of the transformation:
8155
+ #
8156
+ # doc = Nokogiri::XML(File.read('some_file.xml'))
8157
+ # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
8158
+ # xslt.serialize(xslt.transform(doc)) # => String
8159
+ #
8160
+ # or use the #apply_to method, which is a shortcut for `serialize(transform(document))`:
8161
+ #
8162
+ # doc = Nokogiri::XML(File.read('some_file.xml'))
8163
+ # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
8164
+ # xslt.apply_to(doc) # => String
7288
8165
  #
7289
- # See Nokogiri::XSLT::Stylesheet#transform for more transformation
7290
- # information.
8166
+ # See Nokogiri::XSLT::Stylesheet#transform for more information and examples.
7291
8167
  #
7292
- # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#17
8168
+ # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#29
7293
8169
  class Nokogiri::XSLT::Stylesheet
7294
- # Apply an XSLT stylesheet to an XML::Document.
7295
- # +params+ is an array of strings used as XSLT parameters.
7296
- # returns serialized document
8170
+ # :call-seq:
8171
+ # apply_to(document, params = []) -> String
8172
+ #
8173
+ # Apply an XSLT stylesheet to an XML::Document and serialize it properly. This method is
8174
+ # equivalent to calling #serialize on the result of #transform.
8175
+ #
8176
+ # [Parameters]
8177
+ # - +document+ is an instance of XML::Document to transform
8178
+ # - +params+ is an array of strings used as XSLT parameters, passed into #transform
8179
+ #
8180
+ # [Returns]
8181
+ # A string containing the serialized result of the transformation.
8182
+ #
8183
+ # See Nokogiri::XSLT::Stylesheet#transform for more information and examples.
7297
8184
  #
7298
- # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#22
8185
+ # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#44
7299
8186
  def apply_to(document, params = T.unsafe(nil)); end
7300
8187
 
7301
8188
  def serialize(_arg0); end