# typed: true # DO NOT EDIT MANUALLY # This is an autogenerated file for types exported from the `nokogiri` gem. # Please instead update this file by running `bin/tapioca gem nokogiri`. # Nokogiri parses and searches XML/HTML very quickly, and also has # correctly implemented CSS3 selector support as well as XPath 1.0 # support. # # Parsing a document returns either a Nokogiri::XML::Document, or a # Nokogiri::HTML4::Document depending on the kind of document you parse. # # Here is an example: # # require 'nokogiri' # require 'open-uri' # # # Get a Nokogiri::HTML4::Document for the page we’re interested in... # # doc = Nokogiri::HTML4(URI.open('http://www.google.com/search?q=tenderlove')) # # # Do funky things with it using Nokogiri::XML::Node methods... # # #### # # Search for nodes by css # doc.css('h3.r a.l').each do |link| # puts link.content # end # # See also: # # - Nokogiri::XML::Searchable#css for more information about CSS searching # - Nokogiri::XML::Searchable#xpath for more information about XPath searching # # source://nokogiri//lib/nokogiri.rb#38 module Nokogiri class << self # source://nokogiri//lib/nokogiri/html4.rb#10 def HTML(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end # :call-seq: # HTML4(input, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block) → Nokogiri::HTML4::Document # # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse # # source://nokogiri//lib/nokogiri/html4.rb#10 def HTML4(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end # Since v1.12.0 # # ⚠ HTML5 functionality is not available when running JRuby. # # Parse an HTML5 document. Convenience method for {Nokogiri::HTML5::Document.parse} # # source://nokogiri//lib/nokogiri/html5.rb#30 def HTML5(input, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end # Parse a document and add the Slop decorator. The Slop decorator # implements method_missing such that methods may be used instead of CSS # or XPath. For example: # # doc = Nokogiri::Slop(<<-eohtml) # # #

first

#

second

# # # eohtml # assert_equal('second', doc.html.body.p[1].text) # # source://nokogiri//lib/nokogiri.rb#91 def Slop(*args, &block); end # Parse XML. Convenience method for Nokogiri::XML::Document.parse # # source://nokogiri//lib/nokogiri/xml.rb#7 def XML(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end # Create a Nokogiri::XSLT::Stylesheet with +stylesheet+. # # Example: # # xslt = Nokogiri::XSLT(File.read(ARGV[0])) # # source://nokogiri//lib/nokogiri/xslt.rb#13 def XSLT(stylesheet, modules = T.unsafe(nil)); end # source://nokogiri//lib/nokogiri.rb#96 def install_default_aliases; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#205 def jruby?; end # source://nokogiri//lib/nokogiri/version/info.rb#210 def libxml2_patches; end # Create a new Nokogiri::XML::DocumentFragment # # source://nokogiri//lib/nokogiri.rb#68 def make(input = T.unsafe(nil), opts = T.unsafe(nil), &blk); end # Parse an HTML or XML document. +string+ contains the document. # # source://nokogiri//lib/nokogiri.rb#42 def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#200 def uses_gumbo?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#192 def uses_libxml?(requirement = T.unsafe(nil)); end end end # Translate a CSS selector into an XPath 1.0 query # # source://nokogiri//lib/nokogiri/css.rb#6 module Nokogiri::CSS class << self # TODO: Deprecate this method ahead of 2.0 and delete it in 2.0. # It is not used by Nokogiri and shouldn't be part of the public API. # # source://nokogiri//lib/nokogiri/css.rb#10 def parse(selector); end # :call-seq: # xpath_for(selector) → String # xpath_for(selector [, prefix:] [, visitor:] [, ns:]) → String # # Translate a CSS selector to the equivalent XPath query. # # [Parameters] # - +selector+ (String) The CSS selector to be translated into XPath # # - +prefix:+ (String) # # The XPath prefix for the query, see Nokogiri::XML::XPath for some options. Default is # +XML::XPath::GLOBAL_SEARCH_PREFIX+. # # - +visitor:+ (Nokogiri::CSS::XPathVisitor) # # The visitor class to use to transform the AST into XPath. Default is # +Nokogiri::CSS::XPathVisitor.new+. # # - +ns:+ (Hash) # # The namespaces that are referenced in the query, if any. This is a hash where the keys are # the namespace prefix and the values are the namespace URIs. Default is an empty Hash. # # [Returns] (String) The equivalent XPath query for +selector+ # # 💡 Note that translated queries are cached for performance concerns. # # @raise [TypeError] # # source://nokogiri//lib/nokogiri/css.rb#42 def xpath_for(selector, options = T.unsafe(nil)); end end end # source://nokogiri//lib/nokogiri/css/node.rb#5 class Nokogiri::CSS::Node # Create a new Node with +type+ and +value+ # # @return [Node] a new instance of Node # # source://nokogiri//lib/nokogiri/css/node.rb#14 def initialize(type, value); end # Accept +visitor+ # # source://nokogiri//lib/nokogiri/css/node.rb#20 def accept(visitor); end # Find a node by type using +types+ # # source://nokogiri//lib/nokogiri/css/node.rb#32 def find_by_type(types); end # Convert to array # # source://nokogiri//lib/nokogiri/css/node.rb#49 def to_a; end # Convert to_type # # source://nokogiri//lib/nokogiri/css/node.rb#42 def to_type; end # Convert this CSS node to xpath with +prefix+ using +visitor+ # # source://nokogiri//lib/nokogiri/css/node.rb#26 def to_xpath(prefix, visitor); end # Get the type of this node # # source://nokogiri//lib/nokogiri/css/node.rb#9 def type; end # Get the type of this node # # source://nokogiri//lib/nokogiri/css/node.rb#9 def type=(_arg0); end # Get the value of this node # # source://nokogiri//lib/nokogiri/css/node.rb#11 def value; end # Get the value of this node # # source://nokogiri//lib/nokogiri/css/node.rb#11 def value=(_arg0); end end # source://nokogiri//lib/nokogiri/css/node.rb#6 Nokogiri::CSS::Node::ALLOW_COMBINATOR_ON_SELF = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/css/parser_extras.rb#7 class Nokogiri::CSS::Parser < ::Racc::Parser # Create a new CSS parser with respect to +namespaces+ # # @return [Parser] a new instance of Parser # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#60 def initialize(namespaces = T.unsafe(nil)); end # reduce 0 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#361 def _reduce_1(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#407 def _reduce_10(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#412 def _reduce_11(val, _values, result); end # reduce 12 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#424 def _reduce_13(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#429 def _reduce_14(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#434 def _reduce_15(val, _values, result); end # reduce 16 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#441 def _reduce_17(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#446 def _reduce_18(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#451 def _reduce_19(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#367 def _reduce_2(val, _values, result); end # reduce 20 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#458 def _reduce_21(val, _values, result); end # reduce 22 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#465 def _reduce_23(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#470 def _reduce_24(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#475 def _reduce_25(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#482 def _reduce_26(val, _values, result); end # reduce 27 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#489 def _reduce_28(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#495 def _reduce_29(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#372 def _reduce_3(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#501 def _reduce_30(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#507 def _reduce_31(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#512 def _reduce_32(val, _values, result); end # reduce 33 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#519 def _reduce_34(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#525 def _reduce_35(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#531 def _reduce_36(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#537 def _reduce_37(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#543 def _reduce_38(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#549 def _reduce_39(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#377 def _reduce_4(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#554 def _reduce_40(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#559 def _reduce_41(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#564 def _reduce_42(val, _values, result); end # reduce 44 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#573 def _reduce_45(val, _values, result); end # reduce 46 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#590 def _reduce_47(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#600 def _reduce_48(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#616 def _reduce_49(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#382 def _reduce_5(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#636 def _reduce_50(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#642 def _reduce_51(val, _values, result); end # reduce 53 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#651 def _reduce_54(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#657 def _reduce_55(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#663 def _reduce_56(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#669 def _reduce_57(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#675 def _reduce_58(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#387 def _reduce_6(val, _values, result); end # reduce 63 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#691 def _reduce_64(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#696 def _reduce_65(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#701 def _reduce_66(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#706 def _reduce_67(val, _values, result); end # reduce 68 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#713 def _reduce_69(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#392 def _reduce_7(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#718 def _reduce_70(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#723 def _reduce_71(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#728 def _reduce_72(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#733 def _reduce_73(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#738 def _reduce_74(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#743 def _reduce_75(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#748 def _reduce_76(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#397 def _reduce_8(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser.rb#402 def _reduce_9(val, _values, result); end # reduce 81 omitted # # source://nokogiri//lib/nokogiri/css/parser.rb#764 def _reduce_none(val, _values, result); end # source://nokogiri//lib/nokogiri/css/parser_extras.rb#89 def cache_key(query, prefix, visitor); end # source://nokogiri//lib/nokogiri/css/parser_extras.rb#71 def next_token; end # On CSS parser error, raise an exception # # @raise [SyntaxError] # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#84 def on_error(error_token_id, error_value, value_stack); end # source://nokogiri//lib/nokogiri/css/parser_extras.rb#66 def parse(string); end # source://nokogiri//lib/nokogiri/css/parser.rb#26 def unescape_css_identifier(identifier); end # source://nokogiri//lib/nokogiri/css/parser.rb#30 def unescape_css_string(str); end # Get the xpath for +string+ using +options+ # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#76 def xpath_for(string, prefix, visitor); end class << self # Get the css selector in +string+ from the cache # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#25 def [](string); end # Set the css selector in +string+ in the cache to +value+ # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#32 def []=(string, value); end # Return a thread-local boolean indicating whether the CSS-to-XPath cache is active. (Default is `true`.) # # @return [Boolean] # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#15 def cache_on?; end # Clear the cache # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#39 def clear_cache(create_new_object = T.unsafe(nil)); end # Set a thread-local boolean to turn cacheing on and off. Truthy values turn the cache on, falsey values turn the cache off. # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#20 def set_cache(value); end # Execute +block+ without cache # # source://nokogiri//lib/nokogiri/css/parser_extras.rb#50 def without_cache(&block); end end end # source://nokogiri//lib/nokogiri/css/parser_extras.rb#8 Nokogiri::CSS::Parser::CACHE_SWITCH_NAME = T.let(T.unsafe(nil), Symbol) # source://nokogiri//lib/nokogiri/css/parser.rb#279 Nokogiri::CSS::Parser::Racc_arg = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/css/parser.rb#355 Nokogiri::CSS::Parser::Racc_debug_parser = T.let(T.unsafe(nil), FalseClass) # source://nokogiri//lib/nokogiri/css/parser.rb#295 Nokogiri::CSS::Parser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/css/syntax_error.rb#6 class Nokogiri::CSS::SyntaxError < ::Nokogiri::SyntaxError; end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#11 class Nokogiri::CSS::Tokenizer # source://nokogiri//lib/nokogiri/css/tokenizer.rb#57 def _next_token; end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#26 def action; end # Returns the value of attribute filename. # # source://nokogiri//lib/nokogiri/css/tokenizer.rb#17 def filename; end # Returns the value of attribute lineno. # # source://nokogiri//lib/nokogiri/css/tokenizer.rb#16 def lineno; end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#36 def load_file(filename); end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#49 def next_token; end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#30 def scan(str); end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#43 def scan_file(filename); end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#20 def scan_setup(str); end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#30 def scan_str(str); end # Returns the value of attribute state. # # source://nokogiri//lib/nokogiri/css/tokenizer.rb#18 def state; end # Sets the attribute state # # @param value the value to set the attribute state to. # # source://nokogiri//lib/nokogiri/css/tokenizer.rb#18 def state=(_arg0); end end # source://nokogiri//lib/nokogiri/css/tokenizer.rb#14 class Nokogiri::CSS::Tokenizer::ScanError < ::StandardError; end # When translating CSS selectors to XPath queries with Nokogiri::CSS.xpath_for, the XPathVisitor # class allows for changing some of the behaviors related to builtin xpath functions and quirks # of HTML5. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#9 class Nokogiri::CSS::XPathVisitor # :call-seq: # new() → XPathVisitor # new(builtins:, doctype:) → XPathVisitor # # [Parameters] # - +builtins:+ (BuiltinsConfig) Determine when to use Nokogiri's built-in xpath functions for performance improvements. # - +doctype:+ (DoctypeConfig) Make document-type-specific accommodations for CSS queries. # # [Returns] XPathVisitor # # @return [XPathVisitor] a new instance of XPathVisitor # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#57 def initialize(builtins: T.unsafe(nil), doctype: T.unsafe(nil)); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#267 def accept(node); end # :call-seq: config() → Hash # # [Returns] # a Hash representing the configuration of the XPathVisitor, suitable for use as # part of the CSS cache key. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#74 def config; end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#263 def visit_attrib_name(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#154 def visit_attribute_condition(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234 def visit_child_selector(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#215 def visit_class_condition(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#219 def visit_combinator(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#240 def visit_conditional_selector(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234 def visit_descendant_selector(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234 def visit_direct_adjacent_selector(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#245 def visit_element_name(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#234 def visit_following_selector(node); end # :stopdoc: # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#79 def visit_function(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#149 def visit_id(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#140 def visit_not(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#190 def visit_pseudo_class(node); end private # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#328 def css_class(hay, needle); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#273 def html5_element_name_needs_namespace_handling(node); end # @return [Boolean] # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#318 def is_of_type_pseudo_class?(node); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#280 def nth(node, options = T.unsafe(nil)); end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#304 def read_a_and_positive_b(values); end end # Enum to direct XPathVisitor when to use Nokogiri builtin XPath functions. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#13 module Nokogiri::CSS::XPathVisitor::BuiltinsConfig; end # Always use Nokogiri builtin functions whenever possible. This is probably only useful for testing. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#19 Nokogiri::CSS::XPathVisitor::BuiltinsConfig::ALWAYS = T.let(T.unsafe(nil), Symbol) # Never use Nokogiri builtin functions, always generate vanilla XPath 1.0 queries. This is # the default when calling Nokogiri::CSS.xpath_for directly. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#16 Nokogiri::CSS::XPathVisitor::BuiltinsConfig::NEVER = T.let(T.unsafe(nil), Symbol) # Only use Nokogiri builtin functions when they will be faster than vanilla XPath. This is # the behavior chosen when searching for CSS selectors on a Nokogiri document, fragment, or # node. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#24 Nokogiri::CSS::XPathVisitor::BuiltinsConfig::OPTIMAL = T.let(T.unsafe(nil), Symbol) # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#27 Nokogiri::CSS::XPathVisitor::BuiltinsConfig::VALUES = T.let(T.unsafe(nil), Array) # Enum to direct XPathVisitor when to tweak the XPath query to suit the nature of the document # being searched. Note that searches for CSS selectors from a Nokogiri document, fragment, or # node will choose the correct option automatically. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#33 module Nokogiri::CSS::XPathVisitor::DoctypeConfig; end # The document being searched is an HTML4 document. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#38 Nokogiri::CSS::XPathVisitor::DoctypeConfig::HTML4 = T.let(T.unsafe(nil), Symbol) # The document being searched is an HTML5 document. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#41 Nokogiri::CSS::XPathVisitor::DoctypeConfig::HTML5 = T.let(T.unsafe(nil), Symbol) # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#44 Nokogiri::CSS::XPathVisitor::DoctypeConfig::VALUES = T.let(T.unsafe(nil), Array) # The document being searched is an XML document. This is the default. # # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#35 Nokogiri::CSS::XPathVisitor::DoctypeConfig::XML = T.let(T.unsafe(nil), Symbol) # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#10 Nokogiri::CSS::XPathVisitor::WILDCARD_NAMESPACES = T.let(T.unsafe(nil), TrueClass) # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#339 module Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins class << self # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#340 def new; end end end # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#349 module Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins class << self # source://nokogiri//lib/nokogiri/css/xpath_visitor.rb#350 def new; end end end # Some classes in Nokogiri are namespaced as a group, for example # Document, DocumentFragment, and Builder. # # It's sometimes necessary to look up the related class, e.g.: # # XML::Builder → XML::Document # HTML4::Builder → HTML4::Document # HTML5::Document → HTML5::DocumentFragment # # This module is included into those key classes who need to do this. # # source://nokogiri//lib/nokogiri/class_resolver.rb#19 module Nokogiri::ClassResolver # :call-seq: # related_class(class_name) → Class # # Find a class constant within the # # Some examples: # # Nokogiri::XML::Document.new.related_class("DocumentFragment") # # => Nokogiri::XML::DocumentFragment # Nokogiri::HTML4::Document.new.related_class("DocumentFragment") # # => Nokogiri::HTML4::DocumentFragment # # Note this will also work for subclasses that follow the same convention, e.g.: # # Loofah::HTML::Document.new.related_class("DocumentFragment") # # => Loofah::HTML::DocumentFragment # # And even if it's a subclass, this will iterate through the superclasses: # # class ThisIsATopLevelClass < Nokogiri::HTML4::Builder ; end # ThisIsATopLevelClass.new.related_class("Document") # # => Nokogiri::HTML4::Document # # source://nokogiri//lib/nokogiri/class_resolver.rb#46 def related_class(class_name); end end # #related_class restricts matching namespaces to those matching this set. # # source://nokogiri//lib/nokogiri/class_resolver.rb#21 Nokogiri::ClassResolver::VALID_NAMESPACES = T.let(T.unsafe(nil), Set) # source://nokogiri//lib/nokogiri/decorators/slop.rb#4 module Nokogiri::Decorators; end # The Slop decorator implements method missing such that a methods may be # used instead of XPath or CSS. See Nokogiri.Slop # # source://nokogiri//lib/nokogiri/decorators/slop.rb#8 module Nokogiri::Decorators::Slop # look for node with +name+. See Nokogiri.Slop # # source://nokogiri//lib/nokogiri/decorators/slop.rb#14 def method_missing(name, *args, &block); end private # @return [Boolean] # # source://nokogiri//lib/nokogiri/decorators/slop.rb#37 def respond_to_missing?(name, include_private = T.unsafe(nil)); end end # The default XPath search context for Slop # # source://nokogiri//lib/nokogiri/decorators/slop.rb#10 Nokogiri::Decorators::Slop::XPATH_PREFIX = T.let(T.unsafe(nil), String) # source://nokogiri//lib/nokogiri/encoding_handler.rb#5 class Nokogiri::EncodingHandler # Returns the value of attribute name. def name; end class << self def [](_arg0); end def alias(_arg0, _arg1); end def clear_aliases!; end def delete(_arg0); end # source://nokogiri//lib/nokogiri/encoding_handler.rb#15 def install_default_aliases; end end end # Popular encoding aliases not known by all iconv implementations that Nokogiri should support. # # source://nokogiri//lib/nokogiri/encoding_handler.rb#7 Nokogiri::EncodingHandler::USEFUL_ALIASES = T.let(T.unsafe(nil), Hash) # source://nokogiri//lib/nokogiri/gumbo.rb#4 module Nokogiri::Gumbo class << self def fragment(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end def parse(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end end end # The default maximum number of attributes per element. # # source://nokogiri//lib/nokogiri/gumbo.rb#6 Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = T.let(T.unsafe(nil), Integer) # The default maximum number of errors for parsing a document or a fragment. # # source://nokogiri//lib/nokogiri/gumbo.rb#9 Nokogiri::Gumbo::DEFAULT_MAX_ERRORS = T.let(T.unsafe(nil), Integer) # The default maximum depth of the DOM tree produced by parsing a document # or fragment. # # source://nokogiri//lib/nokogiri/gumbo.rb#13 Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = T.let(T.unsafe(nil), Integer) # 💡 This module/namespace is an alias for Nokogiri::HTML4 as of v1.12.0. Before v1.12.0, # Nokogiri::HTML4 did not exist, and this was the module/namespace for all HTML-related # classes. # # source://nokogiri//lib/nokogiri/html.rb#8 Nokogiri::HTML = Nokogiri::HTML4 # Since v1.12.0 # # 💡 Before v1.12.0, Nokogiri::HTML4 did not exist, and Nokogiri::HTML was the module/namespace # for parsing HTML. # # source://nokogiri//lib/nokogiri/html4.rb#19 module Nokogiri::HTML4 class << self # Parse a fragment from +string+ in to a NodeSet. # # source://nokogiri//lib/nokogiri/html4.rb#29 def fragment(string, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end # Parse HTML. Convenience method for Nokogiri::HTML4::Document.parse # # source://nokogiri//lib/nokogiri/html4.rb#23 def parse(input, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end end end # Nokogiri HTML builder is used for building HTML documents. It is very # similar to the Nokogiri::XML::Builder. In fact, you should go read the # documentation for Nokogiri::XML::Builder before reading this # documentation. # # == Synopsis: # # Create an HTML document with a body that has an onload attribute, and a # span tag with a class of "bold" that has content of "Hello world". # # builder = Nokogiri::HTML4::Builder.new do |doc| # doc.html { # doc.body(:onload => 'some_func();') { # doc.span.bold { # doc.text "Hello world" # } # } # } # end # puts builder.to_html # # The HTML builder inherits from the XML builder, so make sure to read the # Nokogiri::XML::Builder documentation. # # source://nokogiri//lib/nokogiri/html.rb#31 class Nokogiri::HTML4::Builder < ::Nokogiri::XML::Builder # Convert the builder to HTML # # source://nokogiri//lib/nokogiri/html4/builder.rb#32 def to_html; end end # source://nokogiri//lib/nokogiri/html4/document.rb#8 class Nokogiri::HTML4::Document < ::Nokogiri::XML::Document # Create a Nokogiri::XML::DocumentFragment from +tags+ # # source://nokogiri//lib/nokogiri/html4/document.rb#149 def fragment(tags = T.unsafe(nil)); end # Get the meta tag encoding for this document. If there is no meta tag, # then nil is returned. # # source://nokogiri//lib/nokogiri/html4/document.rb#12 def meta_encoding; end # Set the meta tag encoding for this document. # # If an meta encoding tag is already present, its content is # replaced with the given text. # # Otherwise, this method tries to create one at an appropriate # place supplying head and/or html elements as necessary, which # is inside a head element if any, and before any text node or # content element (typically ) if any. # # The result when trying to set an encoding that is different # from the document encoding is undefined. # # Beware in CRuby, that libxml2 automatically inserts a meta tag # into a head element. # # source://nokogiri//lib/nokogiri/html4/document.rb#36 def meta_encoding=(encoding); end # Serialize Node using +options+. Save options can also be set using a block. # # See also Nokogiri::XML::Node::SaveOptions and Node@Serialization+and+Generating+Output. # # These two statements are equivalent: # # node.serialize(:encoding => 'UTF-8', :save_with => FORMAT | AS_XML) # # or # # node.serialize(:encoding => 'UTF-8') do |config| # config.format.as_xml # end # # source://nokogiri//lib/nokogiri/html4/document.rb#142 def serialize(options = T.unsafe(nil)); end # Get the title string of this document. Return nil if there is # no title tag. # # source://nokogiri//lib/nokogiri/html4/document.rb#70 def title; end # Set the title string of this document. # # If a title element is already present, its content is replaced # with the given text. # # Otherwise, this method tries to create one at an appropriate # place supplying head and/or html elements as necessary, which # is inside a head element if any, right after a meta # encoding/charset tag if any, and before any text node or # content element (typically ) if any. # # source://nokogiri//lib/nokogiri/html4/document.rb#85 def title=(text); end def type; end # :call-seq: # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig # # [Returns] The document type which determines CSS-to-XPath translation. # # See XPathVisitor for more information. # # source://nokogiri//lib/nokogiri/html4/document.rb#159 def xpath_doctype; end private # source://nokogiri//lib/nokogiri/html4/document.rb#60 def meta_content_type; end # source://nokogiri//lib/nokogiri/html4/document.rb#103 def set_metadata_element(element); end class << self def new(*_arg0); end # Parse HTML. +string_or_io+ may be a String, or any object that # responds to _read_ and _close_ such as an IO, or StringIO. # +url+ is resource where this document is located. +encoding+ is the # encoding that should be used when processing the document. +options+ # is a number that sets options in the parser, such as # Nokogiri::XML::ParseOptions::RECOVER. See the constants in # Nokogiri::XML::ParseOptions. # # @yield [options] # # source://nokogiri//lib/nokogiri/html4/document.rb#172 def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end def read_io(_arg0, _arg1, _arg2, _arg3); end def read_memory(_arg0, _arg1, _arg2, _arg3); end end end # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#5 class Nokogiri::HTML4::DocumentFragment < ::Nokogiri::XML::DocumentFragment # @return [DocumentFragment] a new instance of DocumentFragment # @yield [options] # # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#27 def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end class << self # Create a Nokogiri::XML::DocumentFragment from +tags+, using +encoding+ # # source://nokogiri//lib/nokogiri/html4/document_fragment.rb#8 def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end end end # source://nokogiri//lib/nokogiri/html4/element_description.rb#5 class Nokogiri::HTML4::ElementDescription # Is this element a block element? # # @return [Boolean] # # source://nokogiri//lib/nokogiri/html4/element_description.rb#8 def block?; end def default_sub_element; end # @return [Boolean] def deprecated?; end def deprecated_attributes; end def description; end def empty?; end # @return [Boolean] def implied_end_tag?; end # @return [Boolean] def implied_start_tag?; end def inline?; end # Inspection information # # source://nokogiri//lib/nokogiri/html4/element_description.rb#20 def inspect; end def name; end def optional_attributes; end def required_attributes; end # @return [Boolean] def save_end_tag?; end def sub_elements; end # Convert this description to a string # # source://nokogiri//lib/nokogiri/html4/element_description.rb#14 def to_s; end private # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#32 def default_desc; end class << self def [](_arg0); end end end # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#436 Nokogiri::HTML4::ElementDescription::ACTION_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#423 Nokogiri::HTML4::ElementDescription::ALIGN_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#239 Nokogiri::HTML4::ElementDescription::ALT_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#246 Nokogiri::HTML4::ElementDescription::APPLET_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#258 Nokogiri::HTML4::ElementDescription::AREA_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#212 Nokogiri::HTML4::ElementDescription::ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#221 Nokogiri::HTML4::ElementDescription::A_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#268 Nokogiri::HTML4::ElementDescription::BASEFONT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#546 Nokogiri::HTML4::ElementDescription::BGCOLOR_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#171 Nokogiri::HTML4::ElementDescription::BLOCK = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#437 Nokogiri::HTML4::ElementDescription::BLOCKLI_ELT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#271 Nokogiri::HTML4::ElementDescription::BODY_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#270 Nokogiri::HTML4::ElementDescription::BODY_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#272 Nokogiri::HTML4::ElementDescription::BODY_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#280 Nokogiri::HTML4::ElementDescription::BUTTON_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#213 Nokogiri::HTML4::ElementDescription::CELLHALIGN = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#214 Nokogiri::HTML4::ElementDescription::CELLVALIGN = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#242 Nokogiri::HTML4::ElementDescription::CLEAR_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#292 Nokogiri::HTML4::ElementDescription::COL_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#293 Nokogiri::HTML4::ElementDescription::COL_ELT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#297 Nokogiri::HTML4::ElementDescription::COMPACT_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#295 Nokogiri::HTML4::ElementDescription::COMPACT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#439 Nokogiri::HTML4::ElementDescription::CONTENT_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#199 Nokogiri::HTML4::ElementDescription::COREATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#218 Nokogiri::HTML4::ElementDescription::CORE_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#217 Nokogiri::HTML4::ElementDescription::CORE_I18N_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#549 Nokogiri::HTML4::ElementDescription::DIR_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#296 Nokogiri::HTML4::ElementDescription::DL_CONTENTS = T.let(T.unsafe(nil), Array) # This is filled in down below. # # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#30 Nokogiri::HTML4::ElementDescription::DefaultDescriptions = T.let(T.unsafe(nil), Hash) # Methods are defined protected by method_defined? because at # this point the C-library or Java library is already loaded, # and we don't want to clobber any methods that have been # defined there. # # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#11 Nokogiri::HTML4::ElementDescription::Desc = Struct # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#294 Nokogiri::HTML4::ElementDescription::EDIT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#377 Nokogiri::HTML4::ElementDescription::EMBED_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#192 Nokogiri::HTML4::ElementDescription::EMPTY = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#201 Nokogiri::HTML4::ElementDescription::EVENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#299 Nokogiri::HTML4::ElementDescription::FIELDSET_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#190 Nokogiri::HTML4::ElementDescription::FLOW = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#245 Nokogiri::HTML4::ElementDescription::FLOW_PARAM = T.let(T.unsafe(nil), Array) # Attributes defined and categorized # # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#136 Nokogiri::HTML4::ElementDescription::FONTSTYLE = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#300 Nokogiri::HTML4::ElementDescription::FONT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#170 Nokogiri::HTML4::ElementDescription::FORMCTRL = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#318 Nokogiri::HTML4::ElementDescription::FORM_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#301 Nokogiri::HTML4::ElementDescription::FORM_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#339 Nokogiri::HTML4::ElementDescription::FRAMESET_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#340 Nokogiri::HTML4::ElementDescription::FRAMESET_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#328 Nokogiri::HTML4::ElementDescription::FRAME_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#168 Nokogiri::HTML4::ElementDescription::HEADING = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#341 Nokogiri::HTML4::ElementDescription::HEAD_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#342 Nokogiri::HTML4::ElementDescription::HEAD_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#241 Nokogiri::HTML4::ElementDescription::HREF_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#352 Nokogiri::HTML4::ElementDescription::HR_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#216 Nokogiri::HTML4::ElementDescription::HTML_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#197 Nokogiri::HTML4::ElementDescription::HTML_CDATA = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#354 Nokogiri::HTML4::ElementDescription::HTML_CONTENT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#194 Nokogiri::HTML4::ElementDescription::HTML_FLOW = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#195 Nokogiri::HTML4::ElementDescription::HTML_INLINE = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#196 Nokogiri::HTML4::ElementDescription::HTML_PCDATA = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#200 Nokogiri::HTML4::ElementDescription::I18N = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#219 Nokogiri::HTML4::ElementDescription::I18N_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#355 Nokogiri::HTML4::ElementDescription::IFRAME_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#368 Nokogiri::HTML4::ElementDescription::IMG_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#189 Nokogiri::HTML4::ElementDescription::INLINE = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#243 Nokogiri::HTML4::ElementDescription::INLINE_P = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#398 Nokogiri::HTML4::ElementDescription::INPUT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#298 Nokogiri::HTML4::ElementDescription::LABEL_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#421 Nokogiri::HTML4::ElementDescription::LABEL_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#484 Nokogiri::HTML4::ElementDescription::LANGUAGE_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#422 Nokogiri::HTML4::ElementDescription::LEGEND_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#424 Nokogiri::HTML4::ElementDescription::LINK_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#169 Nokogiri::HTML4::ElementDescription::LIST = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#547 Nokogiri::HTML4::ElementDescription::LI_ELT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#434 Nokogiri::HTML4::ElementDescription::MAP_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#438 Nokogiri::HTML4::ElementDescription::META_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#191 Nokogiri::HTML4::ElementDescription::MODIFIER = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#435 Nokogiri::HTML4::ElementDescription::NAME_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#441 Nokogiri::HTML4::ElementDescription::NOFRAMES_CONTENT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#443 Nokogiri::HTML4::ElementDescription::OBJECT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#442 Nokogiri::HTML4::ElementDescription::OBJECT_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#459 Nokogiri::HTML4::ElementDescription::OBJECT_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#460 Nokogiri::HTML4::ElementDescription::OL_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#462 Nokogiri::HTML4::ElementDescription::OPTGROUP_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#463 Nokogiri::HTML4::ElementDescription::OPTION_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#461 Nokogiri::HTML4::ElementDescription::OPTION_ELT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#464 Nokogiri::HTML4::ElementDescription::PARAM_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#167 Nokogiri::HTML4::ElementDescription::PCDATA = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#137 Nokogiri::HTML4::ElementDescription::PHRASE = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#466 Nokogiri::HTML4::ElementDescription::PRE_CONTENT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#420 Nokogiri::HTML4::ElementDescription::PROMPT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#269 Nokogiri::HTML4::ElementDescription::QUOTE_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#238 Nokogiri::HTML4::ElementDescription::ROWS_COLS_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#483 Nokogiri::HTML4::ElementDescription::SCRIPT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#486 Nokogiri::HTML4::ElementDescription::SELECT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#485 Nokogiri::HTML4::ElementDescription::SELECT_CONTENT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#149 Nokogiri::HTML4::ElementDescription::SPECIAL = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#240 Nokogiri::HTML4::ElementDescription::SRC_ALT_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#497 Nokogiri::HTML4::ElementDescription::STYLE_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#498 Nokogiri::HTML4::ElementDescription::TABLE_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#510 Nokogiri::HTML4::ElementDescription::TABLE_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#509 Nokogiri::HTML4::ElementDescription::TABLE_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#520 Nokogiri::HTML4::ElementDescription::TALIGN_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#237 Nokogiri::HTML4::ElementDescription::TARGET_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#533 Nokogiri::HTML4::ElementDescription::TEXTAREA_ATTRS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#522 Nokogiri::HTML4::ElementDescription::TH_TD_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#521 Nokogiri::HTML4::ElementDescription::TH_TD_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#545 Nokogiri::HTML4::ElementDescription::TR_CONTENTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#519 Nokogiri::HTML4::ElementDescription::TR_ELT = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#440 Nokogiri::HTML4::ElementDescription::TYPE_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#548 Nokogiri::HTML4::ElementDescription::UL_DEPR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#353 Nokogiri::HTML4::ElementDescription::VERSION_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/element_description_defaults.rb#465 Nokogiri::HTML4::ElementDescription::WIDTH_ATTR = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#14 class Nokogiri::HTML4::EncodingReader # @return [EncodingReader] a new instance of EncodingReader # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#82 def initialize(io); end # This method is used by the C extension so that # Nokogiri::HTML4::Document#read_io() does not leak memory when # EncodingFound is raised. # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#91 def encoding_found; end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#93 def read(len); end class << self # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#59 def detect_encoding(chunk); end end end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#15 class Nokogiri::HTML4::EncodingReader::EncodingFound < ::StandardError # @return [EncodingFound] a new instance of EncodingFound # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#18 def initialize(encoding); end # Returns the value of attribute found_encoding. # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#16 def found_encoding; end end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#46 class Nokogiri::HTML4::EncodingReader::JumpSAXHandler < ::Nokogiri::HTML4::EncodingReader::SAXHandler # @return [JumpSAXHandler] a new instance of JumpSAXHandler # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#47 def initialize(jumptag); end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#52 def start_element(name, attrs = T.unsafe(nil)); end end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#24 class Nokogiri::HTML4::EncodingReader::SAXHandler < ::Nokogiri::XML::SAX::Document # @return [SAXHandler] a new instance of SAXHandler # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#27 def initialize; end # Returns the value of attribute encoding. # # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#25 def encoding; end # source://nokogiri//lib/nokogiri/html4/encoding_reader.rb#32 def start_element(name, attrs = T.unsafe(nil)); end end # source://nokogiri//lib/nokogiri/html4/entity_lookup.rb#5 class Nokogiri::HTML4::EntityDescription < ::Struct; end # source://nokogiri//lib/nokogiri/html4/entity_lookup.rb#7 class Nokogiri::HTML4::EntityLookup # Look up entity with +name+ # # source://nokogiri//lib/nokogiri/html4/entity_lookup.rb#10 def [](name); end def get(_arg0); end end # Instance of Nokogiri::HTML4::EntityLookup # # source://nokogiri//lib/nokogiri/html4.rb#35 Nokogiri::HTML4::NamedCharacters = T.let(T.unsafe(nil), Nokogiri::HTML4::EntityLookup) # Nokogiri lets you write a SAX parser to process HTML but get HTML correction features. # # See Nokogiri::HTML4::SAX::Parser for a basic example of using a SAX parser with HTML. # # For more information on SAX parsers, see Nokogiri::XML::SAX # # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#5 module Nokogiri::HTML4::SAX; end # This class lets you perform SAX style parsing on HTML with HTML error correction. # # Here is a basic usage example: # # class MyDoc < Nokogiri::XML::SAX::Document # def start_element name, attributes = [] # puts "found a #{name}" # end # end # # parser = Nokogiri::HTML4::SAX::Parser.new(MyDoc.new) # parser.parse(File.read(ARGV[0], mode: 'rb')) # # For more information on SAX parsers, see Nokogiri::XML::SAX # # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#27 class Nokogiri::HTML4::SAX::Parser < ::Nokogiri::XML::SAX::Parser # Parse a file with +filename+ # # @raise [ArgumentError] # @yield [ctx] # # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#51 def parse_file(filename, encoding = T.unsafe(nil)); end # Parse given +io+ # # @yield [ctx] # # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#41 def parse_io(io, encoding = T.unsafe(nil)); end # Parse html stored in +data+ using +encoding+ # # @raise [TypeError] # @yield [ctx] # # source://nokogiri//lib/nokogiri/html4/sax/parser.rb#30 def parse_memory(data, encoding = T.unsafe(nil)); end end # Context for HTML SAX parsers. This class is usually not instantiated by the user. Instead, # you should be looking at Nokogiri::HTML4::SAX::Parser # # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#9 class Nokogiri::HTML4::SAX::ParserContext < ::Nokogiri::XML::SAX::ParserContext def parse_with(_arg0); end class << self def file(_arg0, _arg1); end def memory(_arg0, _arg1); end # source://nokogiri//lib/nokogiri/html4/sax/parser_context.rb#10 def new(thing, encoding = T.unsafe(nil)); end end end # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#6 class Nokogiri::HTML4::SAX::PushParser < ::Nokogiri::XML::SAX::PushParser # @return [PushParser] a new instance of PushParser # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#11 def initialize(doc = T.unsafe(nil), file_name = T.unsafe(nil), encoding = T.unsafe(nil)); end # Write a +chunk+ of HTML to the PushParser. Any callback methods # that can be called will be called immediately. # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#23 def <<(chunk, last_chunk = T.unsafe(nil)); end # The Nokogiri::HTML4::SAX::Document on which the PushParser will be # operating # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#9 def document; end # The Nokogiri::HTML4::SAX::Document on which the PushParser will be # operating # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#9 def document=(_arg0); end # Finish the parsing. This method is only necessary for # Nokogiri::HTML4::SAX::Document#end_document to be called. # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#31 def finish; end # Write a +chunk+ of HTML to the PushParser. Any callback methods # that can be called will be called immediately. # # source://nokogiri//lib/nokogiri/html4/sax/push_parser.rb#23 def write(chunk, last_chunk = T.unsafe(nil)); end private def initialize_native(_arg0, _arg1, _arg2); end def native_write(_arg0, _arg1); end end # == Usage # # ⚠ HTML5 functionality is not available when running JRuby. # # Parse an HTML5 document: # # doc = Nokogiri.HTML5(string) # # Parse an HTML5 fragment: # # fragment = Nokogiri::HTML5.fragment(string) # # == Parsing options # # The document and fragment parsing methods support options that are different from Nokogiri's. # # - Nokogiri.HTML5(html, url = nil, encoding = nil, options = {}) # - Nokogiri::HTML5.parse(html, url = nil, encoding = nil, options = {}) # - Nokogiri::HTML5::Document.parse(html, url = nil, encoding = nil, options = {}) # - Nokogiri::HTML5.fragment(html, encoding = nil, options = {}) # - Nokogiri::HTML5::DocumentFragment.parse(html, encoding = nil, options = {}) # # The three currently supported options are +:max_errors+, +:max_tree_depth+ and # +:max_attributes+, described below. # # === Error reporting # # Nokogiri contains an experimental HTML5 parse error reporting facility. By default, no parse # errors are reported but this can be configured by passing the +:max_errors+ option to # {HTML5.parse} or {HTML5.fragment}. # # For example, this script: # # doc = Nokogiri::HTML5.parse('Hi there!', max_errors: 10) # doc.errors.each do |err| # puts(err) # end # # Emits: # # 1:1: ERROR: Expected a doctype token # Hi there! # ^ # 1:1: ERROR: Start tag of nonvoid HTML element ends with '/>', use '>'. # Hi there! # ^ # 1:17: ERROR: End tag ends with '/>', use '>'. # Hi there! # ^ # 1:17: ERROR: End tag contains attributes. # Hi there! # ^ # # Using max_errors: -1 results in an unlimited number of errors being returned. # # The errors returned by {HTML5::Document#errors} are instances of {Nokogiri::XML::SyntaxError}. # # The {https://html.spec.whatwg.org/multipage/parsing.html#parse-errors HTML standard} defines a # number of standard parse error codes. These error codes only cover the "tokenization" stage of # parsing HTML. The parse errors in the "tree construction" stage do not have standardized error # codes (yet). # # As a convenience to Nokogiri users, the defined error codes are available via # {Nokogiri::XML::SyntaxError#str1} method. # # doc = Nokogiri::HTML5.parse('Hi there!', max_errors: 10) # doc.errors.each do |err| # puts("#{err.line}:#{err.column}: #{err.str1}") # end # # => 1:1: generic-parser # # 1:1: non-void-html-element-start-tag-with-trailing-solidus # # 1:17: end-tag-with-trailing-solidus # # 1:17: end-tag-with-attributes # # Note that the first error is +generic-parser+ because it's an error from the tree construction # stage and doesn't have a standardized error code. # # For the purposes of semantic versioning, the error messages, error locations, and error codes # are not part of Nokogiri's public API. That is, these are subject to change without Nokogiri's # major version number changing. These may be stabilized in the future. # # === Maximum tree depth # # The maximum depth of the DOM tree parsed by the various parsing methods is configurable by the # +:max_tree_depth+ option. If the depth of the tree would exceed this limit, then an # {::ArgumentError} is thrown. # # This limit (which defaults to Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = 400) can be # removed by giving the option max_tree_depth: -1. # # html = '' + '
' * 1000 # doc = Nokogiri.HTML5(html) # # raises ArgumentError: Document tree depth limit exceeded # doc = Nokogiri.HTML5(html, max_tree_depth: -1) # # === Attribute limit per element # # The maximum number of attributes per DOM element is configurable by the +:max_attributes+ # option. If a given element would exceed this limit, then an {::ArgumentError} is thrown. # # This limit (which defaults to Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = 400) can be # removed by giving the option max_attributes: -1. # # html = '
' # # "
" # doc = Nokogiri.HTML5(html) # # raises ArgumentError: Attributes per element limit exceeded # doc = Nokogiri.HTML5(html, max_attributes: -1) # # == HTML Serialization # # After parsing HTML, it may be serialized using any of the {Nokogiri::XML::Node} serialization # methods. In particular, {XML::Node#serialize}, {XML::Node#to_html}, and {XML::Node#to_s} will # serialize a given node and its children. (This is the equivalent of JavaScript's # +Element.outerHTML+.) Similarly, {XML::Node#inner_html} will serialize the children of a given # node. (This is the equivalent of JavaScript's +Element.innerHTML+.) # # doc = Nokogiri::HTML5("Hello world!") # puts doc.serialize # # => Hello world! # # Due to quirks in how HTML is parsed and serialized, it's possible for a DOM tree to be # serialized and then re-parsed, resulting in a different DOM. Mostly, this happens with DOMs # produced from invalid HTML. Unfortunately, even valid HTML may not survive serialization and # re-parsing. # # In particular, a newline at the start of +pre+, +listing+, and +textarea+ elements is ignored by # the parser. # # doc = Nokogiri::HTML5(<<-EOF) # #
#   Content
# EOF # puts doc.at('/html/body/pre').serialize # # =>
Content
# # In this case, the original HTML is semantically equivalent to the serialized version. If the # +pre+, +listing+, or +textarea+ content starts with two newlines, the first newline will be # stripped on the first parse and the second newline will be stripped on the second, leading to # semantically different DOMs. Passing the parameter preserve_newline: true will cause # two or more newlines to be preserved. (A single leading newline will still be removed.) # # doc = Nokogiri::HTML5(<<-EOF) # # # # Content # EOF # puts doc.at('/html/body/listing').serialize(preserve_newline: true) # # => # # # # Content # # == Encodings # # Nokogiri always parses HTML5 using {https://en.wikipedia.org/wiki/UTF-8 UTF-8}; however, the # encoding of the input can be explicitly selected via the optional +encoding+ parameter. This is # most useful when the input comes not from a string but from an IO object. # # When serializing a document or node, the encoding of the output string can be specified via the # +:encoding+ options. Characters that cannot be encoded in the selected encoding will be encoded # as {https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references HTML numeric # entities}. # # frag = Nokogiri::HTML5.fragment('아는 길도 물어가라') # puts html # # => 아는 길도 물어가라 # frag = Nokogiri::HTML5.fragment(html) # puts frag.serialize # # => 아는 길도 물어가라 # # (There's a {https://bugs.ruby-lang.org/issues/15033 bug} in all current versions of Ruby that # can cause the entity encoding to fail. Of the mandated supported encodings for HTML, the only # encoding I'm aware of that has this bug is 'ISO-2022-JP'. We recommend avoiding this # encoding.) # # == Notes # # * The {Nokogiri::HTML5.fragment} function takes a string and parses it # as a HTML5 document. The ++, ++, and ++ elements are # removed from this document, and any children of these elements that remain # are returned as a {Nokogiri::HTML5::DocumentFragment}. # # * The {Nokogiri::HTML5.parse} function takes a string and passes it to the # gumbo_parse_with_options method, using the default options. # The resulting Gumbo parse tree is then walked. # # * Instead of uppercase element names, lowercase element names are produced. # # * Instead of returning +unknown+ as the element name for unknown tags, the # original tag name is returned verbatim. # # Since v1.12.0 # # source://nokogiri//lib/nokogiri/html5/document.rb#23 module Nokogiri::HTML5 class << self # Parse a fragment from +string+. Convenience method for # {Nokogiri::HTML5::DocumentFragment.parse}. # # source://nokogiri//lib/nokogiri/html5.rb#238 def fragment(string, encoding = T.unsafe(nil), **options); end # Fetch and parse a HTML document from the web, following redirects, # handling https, and determining the character encoding using HTML5 # rules. +uri+ may be a +String+ or a +URI+. +options+ contains # http headers and special options. Everything which is not a # special option is considered a header. Special options include: # * :follow_limit => number of redirects which are followed # * :basic_auth => [username, password] # # source://nokogiri//lib/nokogiri/html5.rb#249 def get(uri, options = T.unsafe(nil)); end # Parse an HTML 5 document. Convenience method for {Nokogiri::HTML5::Document.parse} # # source://nokogiri//lib/nokogiri/html5.rb#232 def parse(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end # source://nokogiri//lib/nokogiri/html5.rb#260 def read_and_encode(string, encoding); end private # source://nokogiri//lib/nokogiri/html5.rb#286 def get_impl(uri, options = T.unsafe(nil)); end # Charset sniffing is a complex and controversial topic that understandably isn't done _by # default_ by the Ruby Net::HTTP library. This being said, it is a very real problem for # consumers of HTML as the default for HTML is iso-8859-1, most "good" producers use utf-8, and # the Gumbo parser *only* supports utf-8. # # Accordingly, Nokogiri::HTML4::Document.parse provides limited encoding detection. Following # this lead, Nokogiri::HTML5 attempts to do likewise, while attempting to more closely follow # the HTML5 standard. # # http://bugs.ruby-lang.org/issues/2567 # http://www.w3.org/TR/html5/syntax.html#determining-the-character-encoding # # source://nokogiri//lib/nokogiri/html5.rb#347 def reencode(body, content_type = T.unsafe(nil)); end end end # Since v1.12.0 # # 💡 HTML5 functionality is not available when running JRuby. # # source://nokogiri//lib/nokogiri/html5/document.rb#39 class Nokogiri::HTML5::Document < ::Nokogiri::HTML4::Document # @return [Document] a new instance of Document # # source://nokogiri//lib/nokogiri/html5/document.rb#129 def initialize(*args); end # :call-seq: # fragment() → Nokogiri::HTML5::DocumentFragment # fragment(markup) → Nokogiri::HTML5::DocumentFragment # # Parse a HTML5 document fragment from +markup+, returning a Nokogiri::HTML5::DocumentFragment. # # [Properties] # - +markup+ (String) The HTML5 markup fragment to be parsed # # [Returns] # Nokogiri::HTML5::DocumentFragment. This object's children will be empty if `markup` is not passed, is empty, or is `nil`. # # source://nokogiri//lib/nokogiri/html5/document.rb#147 def fragment(markup = T.unsafe(nil)); end # Get the parser's quirks mode value. See HTML5::QuirksMode. # # This method returns `nil` if the parser was not invoked (e.g., `Nokogiri::HTML5::Document.new`). # # Since v1.14.0 # # source://nokogiri//lib/nokogiri/html5/document.rb#49 def quirks_mode; end # source://nokogiri//lib/nokogiri/html5/document.rb#151 def to_xml(options = T.unsafe(nil), &block); end # Get the url name for this document, as passed into Document.parse, Document.read_io, or # Document.read_memory # # source://nokogiri//lib/nokogiri/html5/document.rb#42 def url; end # :call-seq: # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig # # [Returns] The document type which determines CSS-to-XPath translation. # # See CSS::XPathVisitor for more information. # # source://nokogiri//lib/nokogiri/html5/document.rb#163 def xpath_doctype; end class << self # :call-seq: # parse(input) # parse(input, url=nil, encoding=nil, **options) # parse(input, url=nil, encoding=nil) { |options| ... } # # Parse HTML5 input. # # [Parameters] # - +input+ may be a String, or any object that responds to _read_ and _close_ such as an # IO, or StringIO. # # - +url+ (optional) is a String indicating the canonical URI where this document is located. # # - +encoding+ (optional) is the encoding that should be used when processing # the document. # # - +options+ (optional) is a configuration Hash (or keyword arguments) to set options # during parsing. The three currently supported options are +:max_errors+, # +:max_tree_depth+ and +:max_attributes+, described at Nokogiri::HTML5. # # ⚠ Note that these options are different than those made available by # Nokogiri::XML::Document and Nokogiri::HTML4::Document. # # - +block+ (optional) is passed a configuration Hash on which parse options may be set. See # Nokogiri::HTML5 for more information and usage. # # [Returns] Nokogiri::HTML5::Document # # @yield [options] # # source://nokogiri//lib/nokogiri/html5/document.rb#80 def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options, &block); end # Create a new document from an IO object. # # 💡 Most users should prefer Document.parse to this method. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/html5/document.rb#101 def read_io(io, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end # Create a new document from a String. # # 💡 Most users should prefer Document.parse to this method. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/html5/document.rb#110 def read_memory(string, url = T.unsafe(nil), encoding = T.unsafe(nil), **options); end private # source://nokogiri//lib/nokogiri/html5/document.rb#118 def do_parse(string_or_io, url, encoding, options); end end end # Since v1.12.0 # # 💡 HTML5 functionality is not available when running JRuby. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#27 class Nokogiri::HTML5::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment # Create a document fragment. # # @return [DocumentFragment] a new instance of DocumentFragment # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#39 def initialize(doc, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end # Returns the value of attribute document. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#28 def document; end # Sets the attribute document # # @param value the value to set the attribute document to. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#28 def document=(_arg0); end # Returns the value of attribute errors. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#29 def errors; end # Sets the attribute errors # # @param value the value to set the attribute errors to. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#29 def errors=(_arg0); end # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#65 def extract_params(params); end # Get the parser's quirks mode value. See HTML5::QuirksMode. # # This method returns `nil` if the parser was not invoked (e.g., `Nokogiri::HTML5::DocumentFragment.new(doc)`). # # Since v1.14.0 # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#36 def quirks_mode; end # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#51 def serialize(options = T.unsafe(nil), &block); end class << self # Parse a document fragment from +tags+, returning a Nodeset. # # source://nokogiri//lib/nokogiri/html5/document_fragment.rb#58 def parse(tags, encoding = T.unsafe(nil), options = T.unsafe(nil)); end end end # Since v1.12.0 # # 💡 HTML5 functionality is not available when running JRuby. # # source://nokogiri//lib/nokogiri/html5/node.rb#30 module Nokogiri::HTML5::Node # source://nokogiri//lib/nokogiri/html5/node.rb#70 def fragment(tags); end # source://nokogiri//lib/nokogiri/html5/node.rb#31 def inner_html(options = T.unsafe(nil)); end # @yield [config] # # source://nokogiri//lib/nokogiri/html5/node.rb#39 def write_to(io, *options); end private # HTML elements can have attributes that contain colons. # Nokogiri::XML::Node#[]= treats names with colons as a prefixed QName # and tries to create an attribute in a namespace. This is especially # annoying with attribute names like xml:lang since libxml2 will # actually create the xml namespace if it doesn't exist already. # # source://nokogiri//lib/nokogiri/html5/node.rb#83 def add_child_node_and_reparent_attrs(node); end end # Enum for the HTML5 parser quirks mode values. Values returned by HTML5::Document#quirks_mode # # See https://dom.spec.whatwg.org/#concept-document-quirks for more information on HTML5 quirks # mode. # # Since v1.14.0 # # source://nokogiri//lib/nokogiri/html5/document.rb#30 module Nokogiri::HTML5::QuirksMode; end # The document was parsed in "limited-quirks" mode # # source://nokogiri//lib/nokogiri/html5/document.rb#33 Nokogiri::HTML5::QuirksMode::LIMITED_QUIRKS = T.let(T.unsafe(nil), Integer) # The document was parsed in "no-quirks" mode # # source://nokogiri//lib/nokogiri/html5/document.rb#31 Nokogiri::HTML5::QuirksMode::NO_QUIRKS = T.let(T.unsafe(nil), Integer) # The document was parsed in "quirks" mode # # source://nokogiri//lib/nokogiri/html5/document.rb#32 Nokogiri::HTML5::QuirksMode::QUIRKS = T.let(T.unsafe(nil), Integer) Nokogiri::LIBXML2_PATCHES = T.let(T.unsafe(nil), Array) Nokogiri::LIBXML_COMPILED_VERSION = T.let(T.unsafe(nil), String) Nokogiri::LIBXML_ICONV_ENABLED = T.let(T.unsafe(nil), TrueClass) Nokogiri::LIBXML_LOADED_VERSION = T.let(T.unsafe(nil), String) Nokogiri::LIBXML_MEMORY_MANAGEMENT = T.let(T.unsafe(nil), String) Nokogiri::LIBXSLT_COMPILED_VERSION = T.let(T.unsafe(nil), String) Nokogiri::LIBXSLT_DATETIME_ENABLED = T.let(T.unsafe(nil), TrueClass) Nokogiri::LIBXSLT_LOADED_VERSION = T.let(T.unsafe(nil), String) Nokogiri::LIBXSLT_PATCHES = T.let(T.unsafe(nil), Array) Nokogiri::OTHER_LIBRARY_VERSIONS = T.let(T.unsafe(nil), String) Nokogiri::PACKAGED_LIBRARIES = T.let(T.unsafe(nil), TrueClass) Nokogiri::PRECOMPILED_LIBRARIES = T.let(T.unsafe(nil), TrueClass) # source://nokogiri//lib/nokogiri/syntax_error.rb#4 class Nokogiri::SyntaxError < ::StandardError; end module Nokogiri::Test class << self def __foreign_error_handler; end end end # The version of Nokogiri you are using # # source://nokogiri//lib/nokogiri/version/constant.rb#5 Nokogiri::VERSION = T.let(T.unsafe(nil), String) # Detailed version info about Nokogiri and the installed extension dependencies. # # source://nokogiri//lib/nokogiri/version/info.rb#222 Nokogiri::VERSION_INFO = T.let(T.unsafe(nil), Hash) # source://nokogiri//lib/nokogiri/version/info.rb#7 class Nokogiri::VersionInfo include ::Singleton extend ::Singleton::SingletonClassMethods # source://nokogiri//lib/nokogiri/version/info.rb#33 def compiled_libxml_version; end # source://nokogiri//lib/nokogiri/version/info.rb#44 def compiled_libxslt_version; end # source://nokogiri//lib/nokogiri/version/info.rb#22 def engine; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#10 def jruby?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#48 def libxml2?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#52 def libxml2_has_iconv?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#68 def libxml2_precompiled?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#60 def libxml2_using_packaged?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#64 def libxml2_using_system?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#56 def libxslt_has_datetime?; end # source://nokogiri//lib/nokogiri/version/info.rb#26 def loaded_libxml_version; end # source://nokogiri//lib/nokogiri/version/info.rb#37 def loaded_libxslt_version; end # source://nokogiri//lib/nokogiri/version/info.rb#18 def ruby_minor; end # source://nokogiri//lib/nokogiri/version/info.rb#88 def to_hash; end # source://nokogiri//lib/nokogiri/version/info.rb#180 def to_markdown; end # source://nokogiri//lib/nokogiri/version/info.rb#72 def warnings; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/version/info.rb#14 def windows?; end class << self private def allocate; end def new(*_arg0); end end end # source://nokogiri//lib/nokogiri/xml.rb#12 module Nokogiri::XML class << self # Parse an XML document using the Nokogiri::XML::Reader API. See # Nokogiri::XML::Reader for mor information # # @yield [options] # # source://nokogiri//lib/nokogiri/xml.rb#23 def Reader(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end # Create a new Nokogiri::XML::RelaxNG document from +string_or_io+. # See Nokogiri::XML::RelaxNG for an example. # # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#9 def RelaxNG(string_or_io, options = T.unsafe(nil)); end # Create a new Nokogiri::XML::Schema object using a +string_or_io+ # object. # # source://nokogiri//lib/nokogiri/xml/schema.rb#9 def Schema(string_or_io, options = T.unsafe(nil)); end # Parse a fragment from +string+ in to a NodeSet. # # source://nokogiri//lib/nokogiri/xml.rb#42 def fragment(string, options = T.unsafe(nil), &block); end # Parse XML. Convenience method for Nokogiri::XML::Document.parse # # source://nokogiri//lib/nokogiri/xml.rb#36 def parse(thing, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil), &block); end end end # source://nokogiri//lib/nokogiri/xml/attr.rb#6 class Nokogiri::XML::Attr < ::Nokogiri::XML::Node def content=(_arg0); end # :call-seq: deconstruct_keys(array_of_names) → Hash # # Returns a hash describing the Attr, to use in pattern matching. # # Valid keys and their values: # - +name+ → (String) The name of the attribute. # - +value+ → (String) The value of the attribute. # - +namespace+ → (Namespace, nil) The Namespace of the attribute, or +nil+ if there is no namespace. # # ⚡ This is an experimental feature, available since v1.14.0 # # *Example* # # doc = Nokogiri::XML.parse(<<~XML) # # # # # XML # # attributes = doc.root.elements.first.attribute_nodes # # => [#(Attr:0x35c { name = "foo", value = "abc" }), # # #(Attr:0x370 { # # name = "bar", # # namespace = #(Namespace:0x384 { # # prefix = "noko", # # href = "http://nokogiri.org/ns/noko" # # }), # # value = "def" # # })] # # attributes.first.deconstruct_keys([:name, :value, :namespace]) # # => {:name=>"foo", :value=>"abc", :namespace=>nil} # # attributes.last.deconstruct_keys([:name, :value, :namespace]) # # => {:name=>"bar", # # :value=>"def", # # :namespace=> # # #(Namespace:0x384 { # # prefix = "noko", # # href = "http://nokogiri.org/ns/noko" # # })} # # source://nokogiri//lib/nokogiri/xml/attr.rb#55 def deconstruct_keys(keys); end def to_s; end def value; end def value=(_arg0); end private # source://nokogiri//lib/nokogiri/xml/attr.rb#61 def inspect_attributes; end class << self def new(*_arg0); end end end # Represents an attribute declaration in a DTD # # source://nokogiri//lib/nokogiri/xml/attribute_decl.rb#7 class Nokogiri::XML::AttributeDecl < ::Nokogiri::XML::Node def attribute_type; end def default; end def enumeration; end private # source://nokogiri//lib/nokogiri/xml/attribute_decl.rb#17 def inspect_attributes; end end # Nokogiri builder can be used for building XML and HTML documents. # # == Synopsis: # # builder = Nokogiri::XML::Builder.new do |xml| # xml.root { # xml.products { # xml.widget { # xml.id_ "10" # xml.name "Awesome widget" # } # } # } # end # puts builder.to_xml # # Will output: # # # # # # 10 # Awesome widget # # # # # # === Builder scope # # The builder allows two forms. When the builder is supplied with a block # that has a parameter, the outside scope is maintained. This means you # can access variables that are outside your builder. If you don't need # outside scope, you can use the builder without the "xml" prefix like # this: # # builder = Nokogiri::XML::Builder.new do # root { # products { # widget { # id_ "10" # name "Awesome widget" # } # } # } # end # # == Special Tags # # The builder works by taking advantage of method_missing. Unfortunately # some methods are defined in ruby that are difficult or dangerous to # remove. You may want to create tags with the name "type", "class", and # "id" for example. In that case, you can use an underscore to # disambiguate your tag name from the method call. # # Here is an example of using the underscore to disambiguate tag names from # ruby methods: # # @objects = [Object.new, Object.new, Object.new] # # builder = Nokogiri::XML::Builder.new do |xml| # xml.root { # xml.objects { # @objects.each do |o| # xml.object { # xml.type_ o.type # xml.class_ o.class.name # xml.id_ o.id # } # end # } # } # end # puts builder.to_xml # # The underscore may be used with any tag name, and the last underscore # will just be removed. This code will output the following XML: # # # # # # Object # Object # 48390 # # # Object # Object # 48380 # # # Object # Object # 48370 # # # # # == Tag Attributes # # Tag attributes may be supplied as method arguments. Here is our # previous example, but using attributes rather than tags: # # @objects = [Object.new, Object.new, Object.new] # # builder = Nokogiri::XML::Builder.new do |xml| # xml.root { # xml.objects { # @objects.each do |o| # xml.object(:type => o.type, :class => o.class, :id => o.id) # end # } # } # end # puts builder.to_xml # # === Tag Attribute Short Cuts # # A couple attribute short cuts are available when building tags. The # short cuts are available by special method calls when building a tag. # # This example builds an "object" tag with the class attribute "classy" # and the id of "thing": # # builder = Nokogiri::XML::Builder.new do |xml| # xml.root { # xml.objects { # xml.object.classy.thing! # } # } # end # puts builder.to_xml # # Which will output: # # # # # # # # # All other options are still supported with this syntax, including # blocks and extra tag attributes. # # == Namespaces # # Namespaces are added similarly to attributes. Nokogiri::XML::Builder # assumes that when an attribute starts with "xmlns", it is meant to be # a namespace: # # builder = Nokogiri::XML::Builder.new { |xml| # xml.root('xmlns' => 'default', 'xmlns:foo' => 'bar') do # xml.tenderlove # end # } # puts builder.to_xml # # Will output XML like this: # # # # # # # === Referencing declared namespaces # # Tags that reference non-default namespaces (i.e. a tag "foo:bar") can be # built by using the Nokogiri::XML::Builder#[] method. # # For example: # # builder = Nokogiri::XML::Builder.new do |xml| # xml.root('xmlns:foo' => 'bar') { # xml.objects { # xml['foo'].object.classy.thing! # } # } # end # puts builder.to_xml # # Will output this XML: # # # # # # # # # Note the "foo:object" tag. # # === Namespace inheritance # # In the Builder context, children will inherit their parent's namespace. This is the same # behavior as if the underlying {XML::Document} set +namespace_inheritance+ to +true+: # # result = Nokogiri::XML::Builder.new do |xml| # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do # xml.Header # end # end # result.doc.to_xml # # => # # # # # # # # Users may turn this behavior off by passing a keyword argument +namespace_inheritance:false+ # to the initializer: # # result = Nokogiri::XML::Builder.new(namespace_inheritance: false) do |xml| # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do # xml.Header # xml["soapenv"].Body # users may explicitly opt into the namespace # end # end # result.doc.to_xml # # => # # # #
# # # # # # For more information on namespace inheritance, please see {XML::Document#namespace_inheritance} # # # == Document Types # # To create a document type (DTD), use the Builder#doc method to get # the current context document. Then call Node#create_internal_subset to # create the DTD node. # # For example, this Ruby: # # builder = Nokogiri::XML::Builder.new do |xml| # xml.doc.create_internal_subset( # 'html', # "-//W3C//DTD HTML 4.01 Transitional//EN", # "http://www.w3.org/TR/html4/loose.dtd" # ) # xml.root do # xml.foo # end # end # # puts builder.to_xml # # Will output this xml: # # # # # # # # source://nokogiri//lib/nokogiri/xml/builder.rb#264 class Nokogiri::XML::Builder include ::Nokogiri::ClassResolver # Create a new Builder object. +options+ are sent to the top level # Document that is being built. # # Building a document with a particular encoding for example: # # Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| # ... # end # # @return [Builder] a new instance of Builder # # source://nokogiri//lib/nokogiri/xml/builder.rb#307 def initialize(options = T.unsafe(nil), root = T.unsafe(nil), &block); end # Append the given raw XML +string+ to the document # # source://nokogiri//lib/nokogiri/xml/builder.rb#390 def <<(string); end # Build a tag that is associated with namespace +ns+. Raises an # ArgumentError if +ns+ has not been defined higher in the tree. # # source://nokogiri//lib/nokogiri/xml/builder.rb#358 def [](ns); end # source://nokogiri//lib/nokogiri/xml/builder.rb#278 def arity; end # source://nokogiri//lib/nokogiri/xml/builder.rb#278 def arity=(_arg0); end # Create a CDATA Node with content of +string+ # # source://nokogiri//lib/nokogiri/xml/builder.rb#345 def cdata(string); end # Create a Comment Node with content of +string+ # # source://nokogiri//lib/nokogiri/xml/builder.rb#351 def comment(string); end # A context object for use when the block has no arguments # # source://nokogiri//lib/nokogiri/xml/builder.rb#276 def context; end # A context object for use when the block has no arguments # # source://nokogiri//lib/nokogiri/xml/builder.rb#276 def context=(_arg0); end # The current Document object being built # # source://nokogiri//lib/nokogiri/xml/builder.rb#270 def doc; end # The current Document object being built # # source://nokogiri//lib/nokogiri/xml/builder.rb#270 def doc=(_arg0); end # source://nokogiri//lib/nokogiri/xml/builder.rb#394 def method_missing(method, *args, &block); end # The parent of the current node being built # # source://nokogiri//lib/nokogiri/xml/builder.rb#273 def parent; end # The parent of the current node being built # # source://nokogiri//lib/nokogiri/xml/builder.rb#273 def parent=(_arg0); end # Create a Text Node with content of +string+ # # source://nokogiri//lib/nokogiri/xml/builder.rb#339 def text(string); end # Convert this Builder object to XML # # source://nokogiri//lib/nokogiri/xml/builder.rb#377 def to_xml(*args); end private # Insert +node+ as a child of the current Node # # source://nokogiri//lib/nokogiri/xml/builder.rb#423 def insert(node, &block); end class << self # Create a builder with an existing root object. This is for use when # you have an existing document that you would like to augment with # builder methods. The builder context created will start with the # given +root+ node. # # For example: # # doc = Nokogiri::XML(File.read('somedoc.xml')) # Nokogiri::XML::Builder.with(doc.at_css('some_tag')) do |xml| # # ... Use normal builder methods here ... # xml.awesome # add the "awesome" tag below "some_tag" # end # # source://nokogiri//lib/nokogiri/xml/builder.rb#294 def with(root, &block); end end end # source://nokogiri//lib/nokogiri/xml/builder.rb#267 Nokogiri::XML::Builder::DEFAULT_DOCUMENT_OPTIONS = T.let(T.unsafe(nil), Hash) # source://nokogiri//lib/nokogiri/xml/builder.rb#442 class Nokogiri::XML::Builder::NodeBuilder # @return [NodeBuilder] a new instance of NodeBuilder # # source://nokogiri//lib/nokogiri/xml/builder.rb#443 def initialize(node, doc_builder); end # source://nokogiri//lib/nokogiri/xml/builder.rb#452 def [](k); end # source://nokogiri//lib/nokogiri/xml/builder.rb#448 def []=(k, v); end # source://nokogiri//lib/nokogiri/xml/builder.rb#456 def method_missing(method, *args, &block); end end # source://nokogiri//lib/nokogiri/xml/cdata.rb#5 class Nokogiri::XML::CDATA < ::Nokogiri::XML::Text # Get the name of this CDATA node # # source://nokogiri//lib/nokogiri/xml/cdata.rb#8 def name; end class << self def new(*_arg0); end end end # source://nokogiri//lib/nokogiri/xml/character_data.rb#5 class Nokogiri::XML::CharacterData < ::Nokogiri::XML::Node include ::Nokogiri::XML::PP::CharacterData end class Nokogiri::XML::Comment < ::Nokogiri::XML::CharacterData class << self def new(*_arg0); end end end # source://nokogiri//lib/nokogiri/xml/dtd.rb#5 class Nokogiri::XML::DTD < ::Nokogiri::XML::Node def attributes; end # source://nokogiri//lib/nokogiri/xml/dtd.rb#17 def each; end def elements; end def entities; end def external_id; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/dtd.rb#27 def html5_dtd?; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/dtd.rb#23 def html_dtd?; end # source://nokogiri//lib/nokogiri/xml/dtd.rb#13 def keys; end def notations; end def system_id; end def validate(_arg0); end end # Nokogiri::XML::Document is the main entry point for dealing with XML documents. The Document # is created by parsing an XML document. See Nokogiri::XML::Document.parse for more information # on parsing. # # For searching a Document, see Nokogiri::XML::Searchable#css and # Nokogiri::XML::Searchable#xpath # # source://nokogiri//lib/nokogiri/xml/document.rb#14 class Nokogiri::XML::Document < ::Nokogiri::XML::Node # @return [Document] a new instance of Document # # source://nokogiri//lib/nokogiri/xml/document.rb#178 def initialize(*args); end # source://nokogiri//lib/nokogiri/xml/document.rb#394 def <<(node_or_tags); end # source://nokogiri//lib/nokogiri/xml/document.rb#394 def add_child(node_or_tags); end def canonicalize(*_arg0); end def clone(*_arg0); end # :call-seq: # collect_namespaces() → Hash # # Recursively get all namespaces from this node and its subtree and return them as a # hash. # # ⚠ This method will not handle duplicate namespace prefixes, since the return value is a hash. # # Note that this method does an xpath lookup for nodes with namespaces, and as a result the # order (and which duplicate prefix "wins") may be dependent on the implementation of the # underlying XML library. # # *Example:* Basic usage # # Given this document: # # # # # # This method will return: # # {"xmlns:foo"=>"bar", "xmlns"=>"default", "xmlns:hello"=>"world"} # # *Example:* Duplicate prefixes # # Given this document: # # # # # # The hash returned will be something like: # # {"xmlns:foo" => "baz"} # # source://nokogiri//lib/nokogiri/xml/document.rb#317 def collect_namespaces; end # Create a CDATA Node containing +string+ # # source://nokogiri//lib/nokogiri/xml/document.rb#262 def create_cdata(string, &block); end # Create a Comment Node containing +string+ # # source://nokogiri//lib/nokogiri/xml/document.rb#267 def create_comment(string, &block); end # :call-seq: # create_element(name, *contents_or_attrs, &block) → Nokogiri::XML::Element # # Create a new Element with `name` belonging to this document, optionally setting contents or # attributes. # # This method is _not_ the most user-friendly option if your intention is to add a node to the # document tree. Prefer one of the Nokogiri::XML::Node methods like Node#add_child, # Node#add_next_sibling, Node#replace, etc. which will both create an element (or subtree) and # place it in the document tree. # # Arguments may be passed to initialize the element: # # - a Hash argument will be used to set attributes # - a non-Hash object that responds to \#to_s will be used to set the new node's contents # # A block may be passed to mutate the node. # # [Parameters] # - `name` (String) # - `contents_or_attrs` (\#to_s, Hash) # [Yields] `node` (Nokogiri::XML::Element) # [Returns] Nokogiri::XML::Element # # *Example:* An empty element without attributes # # doc.create_element("div") # # =>
# # *Example:* An element with contents # # doc.create_element("div", "contents") # # =>
contents
# # *Example:* An element with attributes # # doc.create_element("div", {"class" => "container"}) # # =>
# # *Example:* An element with contents and attributes # # doc.create_element("div", "contents", {"class" => "container"}) # # =>
contents
# # *Example:* Passing a block to mutate the element # # doc.create_element("div") { |node| node["class"] = "blue" if before_noon? } # # source://nokogiri//lib/nokogiri/xml/document.rb#232 def create_element(name, *contents_or_attrs, &block); end def create_entity(*_arg0); end # Create a Text Node with +string+ # # source://nokogiri//lib/nokogiri/xml/document.rb#257 def create_text_node(string, &block); end # :call-seq: deconstruct_keys(array_of_names) → Hash # # Returns a hash describing the Document, to use in pattern matching. # # Valid keys and their values: # - +root+ → (Node, nil) The root node of the Document, or +nil+ if the document is empty. # # In the future, other keys may allow accessing things like doctype and processing # instructions. If you have a use case and would like this functionality, please let us know # by opening an issue or a discussion on the github project. # # ⚡ This is an experimental feature, available since v1.14.0 # # *Example* # # doc = Nokogiri::XML.parse(<<~XML) # # # # # XML # # doc.deconstruct_keys([:root]) # # => {:root=> # # #(Element:0x35c { # # name = "root", # # children = [ # # #(Text "\n" + " "), # # #(Element:0x370 { name = "child", children = [ #(Text "\n")] }), # # #(Text "\n")] # # })} # # *Example* of an empty document # # doc = Nokogiri::XML::Document.new # # doc.deconstruct_keys([:root]) # # => {:root=>nil} # # source://nokogiri//lib/nokogiri/xml/document.rb#458 def deconstruct_keys(keys); end # Apply any decorators to +node+ # # source://nokogiri//lib/nokogiri/xml/document.rb#365 def decorate(node); end # Get the list of decorators given +key+ # # source://nokogiri//lib/nokogiri/xml/document.rb#324 def decorators(key); end # A reference to +self+ # # source://nokogiri//lib/nokogiri/xml/document.rb#277 def document; end def dup(*_arg0); end def encoding; end def encoding=(_arg0); end # The errors found while parsing a document. # # [Returns] Array # # source://nokogiri//lib/nokogiri/xml/document.rb#128 def errors; end # The errors found while parsing a document. # # [Returns] Array # # source://nokogiri//lib/nokogiri/xml/document.rb#128 def errors=(_arg0); end # Create a Nokogiri::XML::DocumentFragment from +tags+ # Returns an empty fragment if +tags+ is nil. # # source://nokogiri//lib/nokogiri/xml/document.rb#386 def fragment(tags = T.unsafe(nil)); end # The name of this document. Always returns "document" # # source://nokogiri//lib/nokogiri/xml/document.rb#272 def name; end # When `true`, reparented elements without a namespace will inherit their new parent's # namespace (if one exists). Defaults to `false`. # # [Returns] Boolean # # *Example:* Default behavior of namespace inheritance # # xml = <<~EOF # # # # # EOF # doc = Nokogiri::XML(xml) # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo") # parent.add_child("") # doc.to_xml # # => # # # # # # # # # # # # *Example:* Setting namespace inheritance to `true` # # xml = <<~EOF # # # # # EOF # doc = Nokogiri::XML(xml) # doc.namespace_inheritance = true # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo") # parent.add_child("") # doc.to_xml # # => # # # # # # # # # # # # Since v1.12.4 # # source://nokogiri//lib/nokogiri/xml/document.rb#175 def namespace_inheritance; end # When `true`, reparented elements without a namespace will inherit their new parent's # namespace (if one exists). Defaults to `false`. # # [Returns] Boolean # # *Example:* Default behavior of namespace inheritance # # xml = <<~EOF # # # # # EOF # doc = Nokogiri::XML(xml) # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo") # parent.add_child("") # doc.to_xml # # => # # # # # # # # # # # # *Example:* Setting namespace inheritance to `true` # # xml = <<~EOF # # # # # EOF # doc = Nokogiri::XML(xml) # doc.namespace_inheritance = true # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo") # parent.add_child("") # doc.to_xml # # => # # # # # # # # # # # # Since v1.12.4 # # source://nokogiri//lib/nokogiri/xml/document.rb#175 def namespace_inheritance=(_arg0); end # Get the hash of namespaces on the root Nokogiri::XML::Node # # source://nokogiri//lib/nokogiri/xml/document.rb#379 def namespaces; end def remove_namespaces!; end def root; end def root=(_arg0); end # Explore a document with shortcut methods. See Nokogiri::Slop for details. # # Note that any nodes that have been instantiated before #slop! # is called will not be decorated with sloppy behavior. So, if you're in # irb, the preferred idiom is: # # irb> doc = Nokogiri::Slop my_markup # # and not # # irb> doc = Nokogiri::HTML my_markup # ... followed by irb's implicit inspect (and therefore instantiation of every node) ... # irb> doc.slop! # ... which does absolutely nothing. # # source://nokogiri//lib/nokogiri/xml/document.rb#354 def slop!; end # source://nokogiri//lib/nokogiri/xml/node.rb#1280 def to_xml(*args, &block); end def url; end # Validate this Document against it's DTD. Returns a list of errors on # the document or +nil+ when there is no DTD. # # source://nokogiri//lib/nokogiri/xml/document.rb#332 def validate; end def version; end # :call-seq: # xpath_doctype() → Nokogiri::CSS::XPathVisitor::DoctypeConfig # # [Returns] The document type which determines CSS-to-XPath translation. # # See XPathVisitor for more information. # # source://nokogiri//lib/nokogiri/xml/document.rb#414 def xpath_doctype; end private # source://nokogiri//lib/nokogiri/xml/document.rb#466 def inspect_attributes; end class << self def new(*_arg0); end # Parse an XML file. # # +string_or_io+ may be a String, or any object that responds to # _read_ and _close_ such as an IO, or StringIO. # # +url+ (optional) is the URI where this document is located. # # +encoding+ (optional) is the encoding that should be used when processing # the document. # # +options+ (optional) is a configuration object that sets options during # parsing, such as Nokogiri::XML::ParseOptions::RECOVER. See the # Nokogiri::XML::ParseOptions for more information. # # +block+ (optional) is passed a configuration object on which # parse options may be set. # # By default, Nokogiri treats documents as untrusted, and so # does not attempt to load DTDs or access the network. See # Nokogiri::XML::ParseOptions for a complete list of options; # and that module's DEFAULT_XML constant for what's set (and not # set) by default. # # Nokogiri.XML() is a convenience method which will call this method. # # @yield [options] # # source://nokogiri//lib/nokogiri/xml/document.rb#48 def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end def read_io(_arg0, _arg1, _arg2, _arg3); end def read_memory(_arg0, _arg1, _arg2, _arg3); end private # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/document.rb#83 def empty_doc?(string_or_io); end end end # source://nokogiri//lib/nokogiri/xml/document.rb#464 Nokogiri::XML::Document::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/xml/document.rb#19 Nokogiri::XML::Document::NCNAME_CHAR = T.let(T.unsafe(nil), String) # source://nokogiri//lib/nokogiri/xml/document.rb#20 Nokogiri::XML::Document::NCNAME_RE = T.let(T.unsafe(nil), Regexp) # See http://www.w3.org/TR/REC-xml-names/#ns-decl for more details. Note that we're not # attempting to handle unicode characters partly because libxml2 doesn't handle unicode # characters in NCNAMEs. # # source://nokogiri//lib/nokogiri/xml/document.rb#18 Nokogiri::XML::Document::NCNAME_START_CHAR = T.let(T.unsafe(nil), String) # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#6 class Nokogiri::XML::DocumentFragment < ::Nokogiri::XML::Node # Create a new DocumentFragment from +tags+. # # If +ctx+ is present, it is used as a context node for the # subtree created, e.g., namespaces will be resolved relative # to +ctx+. # # @return [DocumentFragment] a new instance of DocumentFragment # @yield [options] # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#19 def initialize(document, tags = T.unsafe(nil), ctx = T.unsafe(nil), options = T.unsafe(nil)); end # call-seq: css *rules, [namespace-bindings, custom-pseudo-class] # # Search this fragment for CSS +rules+. +rules+ must be one or more CSS # selectors. For example: # # For more information see Nokogiri::XML::Searchable#css # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#102 def css(*args); end # :call-seq: deconstruct() → Array # # Returns the root nodes of this document fragment as an array, to use in pattern matching. # # 💡 Note that text nodes are returned as well as elements. If you wish to operate only on # root elements, you should deconstruct the array returned by # DocumentFragment#elements. # # ⚡ This is an experimental feature, available since v1.14.0 # # *Example* # # frag = Nokogiri::HTML5.fragment(<<~HTML) #
Start
# This is a shortcut for you. #
End
# HTML # # frag.deconstruct # # => [#(Element:0x35c { name = "div", children = [ #(Text "Start")] }), # # #(Text "\n" + "This is a "), # # #(Element:0x370 { # # name = "a", # # attributes = [ #(Attr:0x384 { name = "href", value = "#jump" })], # # children = [ #(Text "shortcut")] # # }), # # #(Text " for you.\n"), # # #(Element:0x398 { name = "div", children = [ #(Text "End")] }), # # #(Text "\n")] # # *Example* only the elements, not the text nodes. # # frag.elements.deconstruct # # => [#(Element:0x35c { name = "div", children = [ #(Text "Start")] }), # # #(Element:0x370 { # # name = "a", # # attributes = [ #(Attr:0x384 { name = "href", value = "#jump" })], # # children = [ #(Text "shortcut")] # # }), # # #(Element:0x398 { name = "div", children = [ #(Text "End")] })] # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#190 def deconstruct; end # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#42 def dup; end # A list of Nokogiri::XML::SyntaxError found when parsing a document # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#136 def errors; end # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#140 def errors=(things); end # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#144 def fragment(data); end # return the name for DocumentFragment # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#54 def name; end # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class] # # Search this fragment for +paths+. +paths+ must be one or more XPath or CSS queries. # # For more information see Nokogiri::XML::Searchable#search # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#121 def search(*rules); end # Convert this DocumentFragment to a string # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#60 def serialize; end # Convert this DocumentFragment to html # See Nokogiri::XML::NodeSet#to_html # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#67 def to_html(*args); end # Convert this DocumentFragment to a string # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#60 def to_s; end # Convert this DocumentFragment to xhtml # See Nokogiri::XML::NodeSet#to_xhtml # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#79 def to_xhtml(*args); end # Convert this DocumentFragment to xml # See Nokogiri::XML::NodeSet#to_xml # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#91 def to_xml(*args); end private # fix for issue 770 # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#197 def namespace_declarations(ctx); end class << self def new(*_arg0); end # Create a Nokogiri::XML::DocumentFragment from +tags+ # # source://nokogiri//lib/nokogiri/xml/document_fragment.rb#9 def parse(tags, options = T.unsafe(nil), &block); end end end class Nokogiri::XML::Element < ::Nokogiri::XML::Node; end # Represents the allowed content in an Element Declaration inside a DTD: # # # # ]> # # # ElementContent represents the binary tree inside the tag shown above that lists the # possible content for the div1 tag. # # source://nokogiri//lib/nokogiri/xml/element_content.rb#16 class Nokogiri::XML::ElementContent include ::Nokogiri::XML::PP::Node # Get the children of this ElementContent node # # source://nokogiri//lib/nokogiri/xml/element_content.rb#35 def children; end # Returns the value of attribute document. # # source://nokogiri//lib/nokogiri/xml/element_content.rb#31 def document; end def name; end def occur; end def prefix; end def type; end private def c1; end def c2; end # source://nokogiri//lib/nokogiri/xml/element_content.rb#41 def inspect_attributes; end end # source://nokogiri//lib/nokogiri/xml/element_content.rb#21 Nokogiri::XML::ElementContent::ELEMENT = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_content.rb#28 Nokogiri::XML::ElementContent::MULT = T.let(T.unsafe(nil), Integer) # Possible content occurrences # # source://nokogiri//lib/nokogiri/xml/element_content.rb#26 Nokogiri::XML::ElementContent::ONCE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_content.rb#27 Nokogiri::XML::ElementContent::OPT = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_content.rb#23 Nokogiri::XML::ElementContent::OR = T.let(T.unsafe(nil), Integer) # Possible definitions of type # # source://nokogiri//lib/nokogiri/xml/element_content.rb#20 Nokogiri::XML::ElementContent::PCDATA = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_content.rb#29 Nokogiri::XML::ElementContent::PLUS = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_content.rb#22 Nokogiri::XML::ElementContent::SEQ = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/element_decl.rb#5 class Nokogiri::XML::ElementDecl < ::Nokogiri::XML::Node def content; end def element_type; end def prefix; end private # source://nokogiri//lib/nokogiri/xml/element_decl.rb#12 def inspect_attributes; end end # source://nokogiri//lib/nokogiri/xml/entity_decl.rb#5 class Nokogiri::XML::EntityDecl < ::Nokogiri::XML::Node def content; end def entity_type; end def external_id; end def original_content; end def system_id; end private # source://nokogiri//lib/nokogiri/xml/entity_decl.rb#18 def inspect_attributes; end class << self # source://nokogiri//lib/nokogiri/xml/entity_decl.rb#12 def new(name, doc, *args); end end end Nokogiri::XML::EntityDecl::EXTERNAL_GENERAL_PARSED = T.let(T.unsafe(nil), Integer) Nokogiri::XML::EntityDecl::EXTERNAL_GENERAL_UNPARSED = T.let(T.unsafe(nil), Integer) Nokogiri::XML::EntityDecl::EXTERNAL_PARAMETER = T.let(T.unsafe(nil), Integer) Nokogiri::XML::EntityDecl::INTERNAL_GENERAL = T.let(T.unsafe(nil), Integer) Nokogiri::XML::EntityDecl::INTERNAL_PARAMETER = T.let(T.unsafe(nil), Integer) Nokogiri::XML::EntityDecl::INTERNAL_PREDEFINED = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/entity_reference.rb#5 class Nokogiri::XML::EntityReference < ::Nokogiri::XML::Node # source://nokogiri//lib/nokogiri/xml/entity_reference.rb#6 def children; end # source://nokogiri//lib/nokogiri/xml/entity_reference.rb#15 def inspect_attributes; end class << self def new(*_arg0); end end end # source://nokogiri//lib/nokogiri/xml/namespace.rb#6 class Nokogiri::XML::Namespace include ::Nokogiri::XML::PP::Node # :call-seq: deconstruct_keys(array_of_names) → Hash # # Returns a hash describing the Namespace, to use in pattern matching. # # Valid keys and their values: # - +prefix+ → (String, nil) The namespace's prefix, or +nil+ if there is no prefix (e.g., default namespace). # - +href+ → (String) The namespace's URI # # ⚡ This is an experimental feature, available since v1.14.0 # # *Example* # # doc = Nokogiri::XML.parse(<<~XML) # # # # # # XML # # doc.root.elements.first.namespace # # => #(Namespace:0x35c { href = "http://nokogiri.org/ns/default" }) # # doc.root.elements.first.namespace.deconstruct_keys([:prefix, :href]) # # => {:prefix=>nil, :href=>"http://nokogiri.org/ns/default"} # # doc.root.elements.last.namespace # # => #(Namespace:0x370 { # # prefix = "noko", # # href = "http://nokogiri.org/ns/noko" # # }) # # doc.root.elements.last.namespace.deconstruct_keys([:prefix, :href]) # # => {:prefix=>"noko", :href=>"http://nokogiri.org/ns/noko"} # # source://nokogiri//lib/nokogiri/xml/namespace.rb#47 def deconstruct_keys(keys); end # Returns the value of attribute document. # # source://nokogiri//lib/nokogiri/xml/namespace.rb#8 def document; end def href; end def prefix; end private # source://nokogiri//lib/nokogiri/xml/namespace.rb#53 def inspect_attributes; end end # Nokogiri::XML::Node is the primary API you'll use to interact with your Document. # # == Attributes # # A Nokogiri::XML::Node may be treated similarly to a hash with regard to attributes. For # example: # # node = Nokogiri::XML::DocumentFragment.parse("link").at_css("a") # node.to_html # => "link" # node['href'] # => "#foo" # node.keys # => ["href", "id"] # node.values # => ["#foo", "link"] # node['class'] = 'green' # => "green" # node.to_html # => "link" # # See the method group entitled Node@Working+With+Node+Attributes for the full set of methods. # # == Navigation # # Nokogiri::XML::Node also has methods that let you move around your tree: # # [#parent, #children, #next, #previous] # Navigate up, down, or through siblings. # # See the method group entitled Node@Traversing+Document+Structure for the full set of methods. # # == Serialization # # When printing or otherwise emitting a document or a node (and its subtree), there are a few # methods you might want to use: # # [#content, #text, #inner_text, #to_str] # These methods will all **emit plaintext**, # meaning that entities will be replaced (e.g., +<+ will be replaced with +<+), meaning # that any sanitizing will likely be un-done in the output. # # [#to_s, #to_xml, #to_html, #inner_html] # These methods will all **emit properly-escaped markup**, meaning that it's suitable for # consumption by browsers, parsers, etc. # # See the method group entitled Node@Serialization+and+Generating+Output for the full set of methods. # # == Searching # # You may search this node's subtree using methods like #xpath and #css. # # See the method group entitled Node@Searching+via+XPath+or+CSS+Queries for the full set of methods. # # source://nokogiri//lib/nokogiri/xml/node.rb#56 class Nokogiri::XML::Node include ::Nokogiri::HTML5::Node include ::Nokogiri::XML::PP::Node include ::Nokogiri::XML::Searchable include ::Nokogiri::ClassResolver include ::Enumerable # :call-seq: # new(name, document) -> Nokogiri::XML::Node # new(name, document) { |node| ... } -> Nokogiri::XML::Node # # Create a new node with +name+ that belongs to +document+. # # If you intend to add a node to a document tree, it's likely that you will prefer one of the # Nokogiri::XML::Node methods like #add_child, #add_next_sibling, #replace, etc. which will # both create an element (or subtree) and place it in the document tree. # # Another alternative, if you are concerned about performance, is # Nokogiri::XML::Document#create_element which accepts additional arguments for contents or # attributes but (like this method) avoids parsing markup. # # [Parameters] # - +name+ (String) # - +document+ (Nokogiri::XML::Document) The document to which the the returned node will belong. # [Yields] Nokogiri::XML::Node # [Returns] Nokogiri::XML::Node # # @return [Node] a new instance of Node # # source://nokogiri//lib/nokogiri/xml/node.rb#126 def initialize(name, document); end # Add +node_or_tags+ as a child of this Node. # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns +self+, to support chaining of calls (e.g., root << child1 << child2) # # Also see related method +add_child+. # # source://nokogiri//lib/nokogiri/xml/node.rb#256 def <<(node_or_tags); end # Compare two Node objects with respect to their Document. Nodes from # different documents cannot be compared. # # source://nokogiri//lib/nokogiri/xml/node.rb#1256 def <=>(other); end # Test to see if this Node is equal to +other+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1246 def ==(other); end # :call-seq: [](name) → (String, nil) # # Fetch an attribute from this node. # # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access # namespaced attributes, use #attribute_with_ns. # # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists # # *Example* # # doc = Nokogiri::XML("") # child = doc.at_css("child") # child["size"] # => "large" # child["class"] # => "big wide tall" # # *Example:* Namespaced attributes will not be returned. # # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # doc.at_css("child")["size"] # => nil # doc.at_css("child").attribute("size").value # => "broad" # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value # # => "broad" # # source://nokogiri//lib/nokogiri/xml/node.rb#512 def [](name); end # :call-seq: []=(name, value) → value # # Update the attribute +name+ to +value+, or create the attribute if it does not exist. # # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access # namespaced attributes for update, use #attribute_with_ns. To add a namespaced attribute, # see the example below. # # [Returns] +value+ # # *Example* # # doc = Nokogiri::XML("") # child = doc.at_css("child") # child["size"] = "broad" # child.to_html # # => "" # # *Example:* Add a namespaced attribute. # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # child = doc.at_css("child") # child["size"] = "broad" # ns = doc.root.namespace_definitions.find { |ns| ns.prefix == "width" } # child.attribute("size").namespace = ns # doc.to_html # # => "\n" + # # " \n" + # # "\n" # # source://nokogiri//lib/nokogiri/xml/node.rb#550 def []=(name, value); end # Accept a visitor. This method calls "visit" on +visitor+ with self. # # source://nokogiri//lib/nokogiri/xml/node.rb#1240 def accept(visitor); end # Add +node_or_tags+ as a child of this Node. # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +<<+. # # source://nokogiri//lib/nokogiri/xml/node.rb#148 def add_child(node_or_tags); end # :call-seq: add_class(names) → self # # Ensure HTML CSS classes are present on +self+. Any CSS classes in +names+ that already exist # in the "class" attribute are _not_ added. Note that any existing duplicates in the # "class" attribute are not removed. Compare with #append_class. # # This is a convenience function and is equivalent to: # # node.kwattr_add("class", names) # # See related: #kwattr_add, #classes, #append_class, #remove_class # # [Parameters] # - +names+ (String, Array) # # CSS class names to be added to the Node's "class" attribute. May be a string containing # whitespace-delimited names, or an Array of String names. Any class names already present # will not be added. Any class names not present will be added. If no "class" attribute # exists, one is created. # # [Returns] +self+ (Node) for ease of chaining method calls. # # *Example:* Ensure that the node has CSS class "section" # # node # =>
# node.add_class("section") # =>
# node.add_class("section") # =>
# duplicate not added # # *Example:* Ensure that the node has CSS classes "section" and "header", via a String argument # # Note that the CSS class "section" is not added because it is already present. # Note also that the pre-existing duplicate CSS class "section" is not removed. # # node # =>
# node.add_class("section header") # =>
# # *Example:* Ensure that the node has CSS classes "section" and "header", via an Array argument # # node # =>
# node.add_class(["section", "header"]) # =>
# # source://nokogiri//lib/nokogiri/xml/node.rb#715 def add_class(names); end def add_namespace(_arg0, _arg1); end def add_namespace_definition(_arg0, _arg1); end # Insert +node_or_tags+ after this Node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +after+. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/xml/node.rb#288 def add_next_sibling(node_or_tags); end # Insert +node_or_tags+ before this Node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +before+. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/xml/node.rb#271 def add_previous_sibling(node_or_tags); end # Insert +node_or_tags+ after this node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a String # containing markup. # # Returns +self+, to support chaining of calls. # # Also see related method +add_next_sibling+. # # source://nokogiri//lib/nokogiri/xml/node.rb#318 def after(node_or_tags); end # Get a list of ancestor Node for this Node. If +selector+ is given, # the ancestors must match +selector+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1209 def ancestors(selector = T.unsafe(nil)); end # :call-seq: append_class(names) → self # # Add HTML CSS classes to +self+, regardless of duplication. Compare with #add_class. # # This is a convenience function and is equivalent to: # # node.kwattr_append("class", names) # # See related: #kwattr_append, #classes, #add_class, #remove_class # # [Parameters] # - +names+ (String, Array) # # CSS class names to be appended to the Node's "class" attribute. May be a string containing # whitespace-delimited names, or an Array of String names. All class names passed in will be # appended to the "class" attribute even if they are already present in the attribute # value. If no "class" attribute exists, one is created. # # [Returns] +self+ (Node) for ease of chaining method calls. # # *Example:* Append "section" to the node's CSS "class" attribute # # node # =>
# node.append_class("section") # =>
# node.append_class("section") # =>
# duplicate added! # # *Example:* Append "section" and "header" to the noded's CSS "class" attribute, via a String argument # # Note that the CSS class "section" is appended even though it is already present # # node # =>
# node.append_class("section header") # =>
# # *Example:* Append "section" and "header" to the node's CSS "class" attribute, via an Array argument # # node # =>
# node.append_class(["section", "header"]) # =>
# node.append_class(["section", "header"]) # =>
# # source://nokogiri//lib/nokogiri/xml/node.rb#759 def append_class(names); end # :call-seq: [](name) → (String, nil) # # Fetch an attribute from this node. # # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access # namespaced attributes, use #attribute_with_ns. # # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists # # *Example* # # doc = Nokogiri::XML("") # child = doc.at_css("child") # child["size"] # => "large" # child["class"] # => "big wide tall" # # *Example:* Namespaced attributes will not be returned. # # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # doc.at_css("child")["size"] # => nil # doc.at_css("child").attribute("size").value # => "broad" # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value # # => "broad" # # source://nokogiri//lib/nokogiri/xml/node.rb#512 def attr(name); end def attribute(_arg0); end def attribute_nodes; end def attribute_with_ns(_arg0, _arg1); end # :call-seq: attributes() → Hash # # Fetch this node's attributes. # # ⚠ Because the keys do not include any namespace information for the attribute, in case of a # simple name collision, not all attributes will be returned. In this case, you will need to # use #attribute_nodes. # # [Returns] # Hash containing attributes belonging to +self+. The hash keys are String attribute # names (without the namespace), and the hash values are Nokogiri::XML::Attr. # # *Example* with no namespaces: # # doc = Nokogiri::XML("") # doc.at_css("child").attributes # # => {"size"=>#(Attr:0x550 { name = "size", value = "large" }), # # "class"=>#(Attr:0x564 { name = "class", value = "big wide tall" })} # # *Example* with a namespace: # # doc = Nokogiri::XML("") # doc.at_css("child").attributes # # => {"size"=> # # #(Attr:0x550 { # # name = "size", # # namespace = #(Namespace:0x564 { # # prefix = "desc", # # href = "http://example.com/sizes" # # }), # # value = "large" # # })} # # *Example* with an attribute name collision: # # ⚠ Note that only one of the attributes is returned in the Hash. # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # doc.at_css("child").attributes # # => {"size"=> # # #(Attr:0x550 { # # name = "size", # # namespace = #(Namespace:0x564 { # # prefix = "height", # # href = "http://example.com/heights" # # }), # # value = "tall" # # })} # # source://nokogiri//lib/nokogiri/xml/node.rb#609 def attributes; end # Insert +node_or_tags+ before this node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns +self+, to support chaining of calls. # # Also see related method +add_previous_sibling+. # # source://nokogiri//lib/nokogiri/xml/node.rb#304 def before(node_or_tags); end def blank?; end # source://nokogiri//lib/nokogiri/xml/node.rb#1407 def canonicalize(mode = T.unsafe(nil), inclusive_namespaces = T.unsafe(nil), with_comments = T.unsafe(nil)); end # Returns true if this is a CDATA # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1130 def cdata?; end def child; end def children; end # Set the content for this Node +node_or_tags+ # # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a String # containing markup. # # Also see related method +inner_html=+ # # source://nokogiri//lib/nokogiri/xml/node.rb#349 def children=(node_or_tags); end # :call-seq: classes() → Array # # Fetch CSS class names of a Node. # # This is a convenience function and is equivalent to: # # node.kwattr_values("class") # # See related: #kwattr_values, #add_class, #append_class, #remove_class # # [Returns] # The CSS classes (Array of String) present in the Node's "class" attribute. If the # attribute is empty or non-existent, the return value is an empty array. # # *Example* # # node # =>
# node.classes # => ["section", "title", "header"] # # source://nokogiri//lib/nokogiri/xml/node.rb#669 def classes; end def clone(*_arg0); end # Returns true if this is a Comment # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1125 def comment?; end def content; end # Set the Node's content to a Text node containing +string+. The string gets XML escaped, not # interpreted as markup. # # source://nokogiri//lib/nokogiri/xml/node.rb#411 def content=(string); end def create_external_subset(_arg0, _arg1, _arg2); end def create_internal_subset(_arg0, _arg1, _arg2); end # Get the path to this node as a CSS expression # # source://nokogiri//lib/nokogiri/xml/node.rb#1200 def css_path; end # :call-seq: deconstruct_keys(array_of_names) → Hash # # Returns a hash describing the Node, to use in pattern matching. # # Valid keys and their values: # - +name+ → (String) The name of this node, or "text" if it is a Text node. # - +namespace+ → (Namespace, nil) The namespace of this node, or nil if there is no namespace. # - +attributes+ → (Array) The attributes of this node. # - +children+ → (Array) The children of this node. 💡 Note this includes text nodes. # - +elements+ → (Array) The child elements of this node. 💡 Note this does not include text nodes. # - +content+ → (String) The contents of all the text nodes in this node's subtree. See #content. # - +inner_html+ → (String) The inner markup for the children of this node. See #inner_html. # # ⚡ This is an experimental feature, available since v1.14.0 # # *Example* # # doc = Nokogiri::XML.parse(<<~XML) # # # First # Second # # XML # # doc.root.deconstruct_keys([:name, :namespace]) # # => {:name=>"parent", # # :namespace=> # # #(Namespace:0x35c { href = "http://nokogiri.org/ns/default" })} # # doc.root.deconstruct_keys([:inner_html, :content]) # # => {:content=>"\n" + " First\n" + " Second\n", # # :inner_html=> # # "\n" + # # " First\n" + # # " Second\n"} # # doc.root.elements.first.deconstruct_keys([:attributes]) # # => {:attributes=> # # [#(Attr:0x370 { name = "foo", value = "abc" }), # # #(Attr:0x384 { # # name = "bar", # # namespace = #(Namespace:0x398 { # # prefix = "noko", # # href = "http://nokogiri.org/ns/noko" # # }), # # value = "def" # # })]} # # source://nokogiri//lib/nokogiri/xml/node.rb#1468 def deconstruct_keys(keys); end # Decorate this node with the decorators set up in this node's Document # # source://nokogiri//lib/nokogiri/xml/node.rb#132 def decorate!; end # Adds a default namespace supplied as a string +url+ href, to self. # The consequence is as an xmlns attribute with supplied argument were # present in parsed XML. A default namespace set with this method will # now show up in #attributes, but when this node is serialized to XML an # "xmlns" attribute will appear. See also #namespace and #namespace= # # source://nokogiri//lib/nokogiri/xml/node.rb#427 def default_namespace=(url); end # Remove the attribute named +name+ # # source://nokogiri//lib/nokogiri/xml/node.rb#643 def delete(name); end # Fetch the Nokogiri::HTML4::ElementDescription for this node. Returns # nil on XML documents and on unknown tags. # # source://nokogiri//lib/nokogiri/xml/node.rb#1167 def description; end # Do xinclude substitution on the subtree below node. If given a block, a # Nokogiri::XML::ParseOptions object initialized from +options+, will be # passed to it, allowing more convenient modification of the parser options. # # @yield [options] # # source://nokogiri//lib/nokogiri/xml/node.rb#454 def do_xinclude(options = T.unsafe(nil)); end def document; end # Returns true if this is a Document # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1145 def document?; end def dup(*_arg0); end # Iterate over each attribute name and value pair for this Node. # # source://nokogiri//lib/nokogiri/xml/node.rb#635 def each; end # Returns true if this is an Element node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1181 def elem?; end # Returns true if this is an Element node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1181 def element?; end def element_children; end def elements; end def encode_special_chars(_arg0); end def external_subset; end def first_element_child; end # Create a DocumentFragment containing +tags+ that is relative to _this_ # context node. # # source://nokogiri//lib/nokogiri/html5/node.rb#70 def fragment(tags); end # Returns true if this is a DocumentFragment # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1160 def fragment?; end # :call-seq: [](name) → (String, nil) # # Fetch an attribute from this node. # # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access # namespaced attributes, use #attribute_with_ns. # # [Returns] (String, nil) value of the attribute +name+, or +nil+ if no matching attribute exists # # *Example* # # doc = Nokogiri::XML("") # child = doc.at_css("child") # child["size"] # => "large" # child["class"] # => "big wide tall" # # *Example:* Namespaced attributes will not be returned. # # ⚠ Note namespaced attributes may be accessed with #attribute or #attribute_with_ns # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # doc.at_css("child")["size"] # => nil # doc.at_css("child").attribute("size").value # => "broad" # doc.at_css("child").attribute_with_ns("size", "http://example.com/widths").value # # => "broad" # # source://nokogiri//lib/nokogiri/xml/node.rb#512 def get_attribute(name); end def has_attribute?(_arg0); end # Returns true if this is an HTML4::Document or HTML5::Document node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1140 def html?; end # Get the inner_html for this node's Node#children # # source://nokogiri//lib/nokogiri/html5/node.rb#31 def inner_html(options = T.unsafe(nil)); end # Set the content for this Node to +node_or_tags+. # # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a String # containing markup. # # ⚠ Please note that despite the name, this method will *not* always parse a String argument # as HTML. A String argument will be parsed with the +DocumentFragment+ parser related to this # node's document. # # For example, if the document is an HTML4::Document then the string will be parsed as HTML4 # using HTML4::DocumentFragment; but if the document is an XML::Document then it will # parse the string as XML using XML::DocumentFragment. # # Also see related method +children=+ # # source://nokogiri//lib/nokogiri/xml/node.rb#338 def inner_html=(node_or_tags); end # :section: def inner_text; end def internal_subset; end def key?(_arg0); end # Get the attribute names for this Node. # # source://nokogiri//lib/nokogiri/xml/node.rb#629 def keys; end # :call-seq: # kwattr_add(attribute_name, keywords) → self # # Ensure that values are present in a keyword attribute. # # Any values in +keywords+ that already exist in the Node's attribute values are _not_ # added. Note that any existing duplicates in the attribute values are not removed. Compare # with #kwattr_append. # # A "keyword attribute" is a node attribute that contains a set of space-delimited # values. Perhaps the most familiar example of this is the HTML "class" attribute used to # contain CSS classes. But other keyword attributes exist, for instance # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel]. # # See also #add_class, #kwattr_values, #kwattr_append, #kwattr_remove # # [Parameters] # - +attribute_name+ (String) The name of the keyword attribute to be modified. # - +keywords+ (String, Array) # Keywords to be added to the attribute named +attribute_name+. May be a string containing # whitespace-delimited values, or an Array of String values. Any values already present will # not be added. Any values not present will be added. If the named attribute does not exist, # it is created. # # [Returns] +self+ (Nokogiri::XML::Node) for ease of chaining method calls. # # *Example:* Ensure that a +Node+ has "nofollow" in its +rel+ attribute. # # Note that duplicates are not added. # # node # => # node.kwattr_add("rel", "nofollow") # => # node.kwattr_add("rel", "nofollow") # => # # *Example:* Ensure that a +Node+ has "nofollow" and "noreferrer" in its +rel+ attribute, via a # String argument. # # Note that "nofollow" is not added because it is already present. Note also that the # pre-existing duplicate "nofollow" is not removed. # # node # => # node.kwattr_add("rel", "nofollow noreferrer") # => # # *Example:* Ensure that a +Node+ has "nofollow" and "noreferrer" in its +rel+ attribute, via # an Array argument. # # node # => # node.kwattr_add("rel", ["nofollow", "noreferrer"]) # => # # Since v1.11.0 # # source://nokogiri//lib/nokogiri/xml/node.rb#892 def kwattr_add(attribute_name, keywords); end # :call-seq: # kwattr_append(attribute_name, keywords) → self # # Add keywords to a Node's keyword attribute, regardless of duplication. Compare with # #kwattr_add. # # A "keyword attribute" is a node attribute that contains a set of space-delimited # values. Perhaps the most familiar example of this is the HTML "class" attribute used to # contain CSS classes. But other keyword attributes exist, for instance # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel]. # # See also #append_class, #kwattr_values, #kwattr_add, #kwattr_remove # # [Parameters] # - +attribute_name+ (String) The name of the keyword attribute to be modified. # - +keywords+ (String, Array) # Keywords to be added to the attribute named +attribute_name+. May be a string containing # whitespace-delimited values, or an Array of String values. All values passed in will be # appended to the named attribute even if they are already present in the attribute. If the # named attribute does not exist, it is created. # # [Returns] +self+ (Node) for ease of chaining method calls. # # *Example:* Append "nofollow" to the +rel+ attribute. # # Note that duplicates are added. # # node # => # node.kwattr_append("rel", "nofollow") # => # node.kwattr_append("rel", "nofollow") # => # # *Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via a String argument. # # Note that "nofollow" is appended even though it is already present. # # node # => # node.kwattr_append("rel", "nofollow noreferrer") # => # # # *Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via an Array argument. # # node # => # node.kwattr_append("rel", ["nofollow", "noreferrer"]) # => # # Since v1.11.0 # # source://nokogiri//lib/nokogiri/xml/node.rb#945 def kwattr_append(attribute_name, keywords); end # :call-seq: # kwattr_remove(attribute_name, keywords) → self # # Remove keywords from a keyword attribute. Any matching keywords that exist in the named # attribute are removed, including any multiple entries. # # If no keywords remain after this operation, or if +keywords+ is +nil+, the attribute is # deleted from the node. # # A "keyword attribute" is a node attribute that contains a set of space-delimited # values. Perhaps the most familiar example of this is the HTML "class" attribute used to # contain CSS classes. But other keyword attributes exist, for instance # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel]. # # See also #remove_class, #kwattr_values, #kwattr_add, #kwattr_append # # [Parameters] # - +attribute_name+ (String) The name of the keyword attribute to be modified. # - +keywords+ (String, Array) # Keywords to be removed from the attribute named +attribute_name+. May be a string # containing whitespace-delimited values, or an Array of String values. Any keywords present # in the named attribute will be removed. If no keywords remain, or if +keywords+ is nil, # the attribute is deleted. # # [Returns] +self+ (Node) for ease of chaining method calls. # # *Example:* # # Note that the +rel+ attribute is deleted when empty. # # node # => link # node.kwattr_remove("rel", "nofollow") # => link # node.kwattr_remove("rel", "noreferrer") # => link # # Since v1.11.0 # # source://nokogiri//lib/nokogiri/xml/node.rb#988 def kwattr_remove(attribute_name, keywords); end # :call-seq: # kwattr_values(attribute_name) → Array # # Fetch values from a keyword attribute of a Node. # # A "keyword attribute" is a node attribute that contains a set of space-delimited # values. Perhaps the most familiar example of this is the HTML "class" attribute used to # contain CSS classes. But other keyword attributes exist, for instance # {the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel]. # # See also #classes, #kwattr_add, #kwattr_append, #kwattr_remove # # [Parameters] # - +attribute_name+ (String) The name of the keyword attribute to be inspected. # # [Returns] # (Array) The values present in the Node's +attribute_name+ attribute. If the # attribute is empty or non-existent, the return value is an empty array. # # *Example:* # # node # => link # node.kwattr_values("rel") # => ["nofollow", "noopener", "external"] # # Since v1.11.0 # # source://nokogiri//lib/nokogiri/xml/node.rb#838 def kwattr_values(attribute_name); end def lang; end def lang=(_arg0); end def last_element_child; end def line; end def line=(_arg0); end # Returns true if this Node matches +selector+ # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1015 def matches?(selector); end def name; end def name=(_arg0); end def namespace; end # Set the default namespace on this node (as would be defined with an # "xmlns=" attribute in XML source), as a Namespace object +ns+. Note that # a Namespace added this way will NOT be serialized as an xmlns attribute # for this node. You probably want #default_namespace= instead, or perhaps # #add_namespace_definition with a nil prefix argument. # # source://nokogiri//lib/nokogiri/xml/node.rb#437 def namespace=(ns); end def namespace_definitions; end def namespace_scopes; end def namespaced_key?(_arg0, _arg1); end # :call-seq: # namespaces() → Hash # # Fetch all the namespaces on this node and its ancestors. # # Note that the keys in this hash XML attributes that would be used to define this namespace, # such as "xmlns:prefix", not just the prefix. # # The default namespace for this node will be included with key "xmlns". # # See also #namespace_scopes # # [Returns] # Hash containing all the namespaces on this node and its ancestors. The hash keys are the # namespace prefix, and the hash value for each key is the namespace URI. # # *Example:* # # doc = Nokogiri::XML(<<~EOF) # # # # # # EOF # doc.at_xpath("//root:first", "root" => "http://example.com/root").namespaces # # => {"xmlns"=>"http://example.com/root", # # "xmlns:in_scope"=>"http://example.com/in_scope"} # doc.at_xpath("//child:second", "child" => "http://example.com/child").namespaces # # => {"xmlns"=>"http://example.com/child", # # "xmlns:in_scope"=>"http://example.com/in_scope"} # doc.at_xpath("//root:third", "root" => "http://example.com/root").namespaces # # => {"xmlns:foo"=>"http://example.com/foo", # # "xmlns"=>"http://example.com/root", # # "xmlns:in_scope"=>"http://example.com/in_scope"} # # source://nokogiri//lib/nokogiri/xml/node.rb#1116 def namespaces; end def native_content=(_arg0); end def next; end # Insert +node_or_tags+ after this Node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +after+. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/xml/node.rb#288 def next=(node_or_tags); end def next_element; end def next_sibling; end def node_name; end def node_name=(_arg0); end def node_type; end def parent; end # Set the parent Node for this Node # # source://nokogiri//lib/nokogiri/xml/node.rb#417 def parent=(parent_node); end # Parse +string_or_io+ as a document fragment within the context of # *this* node. Returns a XML::NodeSet containing the nodes parsed from # +string_or_io+. # # @yield [options] # # source://nokogiri//lib/nokogiri/xml/node.rb#1030 def parse(string_or_io, options = T.unsafe(nil)); end def path; end def pointer_id; end # Add +node_or_tags+ as the first child of this Node. # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +add_child+. # # source://nokogiri//lib/nokogiri/xml/node.rb#168 def prepend_child(node_or_tags); end def previous; end # Insert +node_or_tags+ before this Node (as a sibling). # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +before+. # # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/xml/node.rb#271 def previous=(node_or_tags); end def previous_element; end def previous_sibling; end # Returns true if this is a ProcessingInstruction node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1150 def processing_instruction?; end # Is this a read only node? # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1175 def read_only?; end def remove; end # Remove the attribute named +name+ # # source://nokogiri//lib/nokogiri/xml/node.rb#643 def remove_attribute(name); end # :call-seq: # remove_class(css_classes) → self # # Remove HTML CSS classes from this node. Any CSS class names in +css_classes+ that exist in # this node's "class" attribute are removed, including any multiple entries. # # If no CSS classes remain after this operation, or if +css_classes+ is +nil+, the "class" # attribute is deleted from the node. # # This is a convenience function and is equivalent to: # # node.kwattr_remove("class", css_classes) # # Also see #kwattr_remove, #classes, #add_class, #append_class # # [Parameters] # - +css_classes+ (String, Array) # # CSS class names to be removed from the Node's # "class" attribute. May be a string containing whitespace-delimited names, or an Array of # String names. Any class names already present will be removed. If no CSS classes remain, # the "class" attribute is deleted. # # [Returns] +self+ (Nokogiri::XML::Node) for ease of chaining method calls. # # *Example*: Deleting a CSS class # # Note that all instances of the class "section" are removed from the "class" attribute. # # node # =>
# node.remove_class("section") # =>
# # *Example*: Deleting the only remaining CSS class # # Note that the attribute is removed once there are no remaining classes. # # node # =>
# node.remove_class("section") # =>
# # *Example*: Deleting multiple CSS classes # # Note that the "class" attribute is deleted once it's empty. # # node # =>
# node.remove_class(["section", "float"]) # =>
# # source://nokogiri//lib/nokogiri/xml/node.rb#809 def remove_class(names = T.unsafe(nil)); end # Replace this Node with +node_or_tags+. # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # containing markup. # # Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is # a DocumentFragment, NodeSet, or String). # # Also see related method +swap+. # # source://nokogiri//lib/nokogiri/xml/node.rb#369 def replace(node_or_tags); end # Serialize Node using +options+. Save options can also be set using a block. # # See also Nokogiri::XML::Node::SaveOptions and Node@Serialization+and+Generating+Output. # # These two statements are equivalent: # # # or # # config.format.as_xml # end # # source://nokogiri//lib/nokogiri/xml/node.rb#1280 def serialize(*args, &block); end # :call-seq: []=(name, value) → value # # Update the attribute +name+ to +value+, or create the attribute if it does not exist. # # ⚠ Note that attributes with namespaces cannot be accessed with this method. To access # namespaced attributes for update, use #attribute_with_ns. To add a namespaced attribute, # see the example below. # # [Returns] +value+ # # *Example* # # doc = Nokogiri::XML("") # child = doc.at_css("child") # child["size"] = "broad" # child.to_html # # => "" # # *Example:* Add a namespaced attribute. # # doc = Nokogiri::XML(<<~EOF) # # # # EOF # child = doc.at_css("child") # child["size"] = "broad" # ns = doc.root.namespace_definitions.find { |ns| ns.prefix == "width" } # child.attribute("size").namespace = ns # doc.to_html # # => "\n" + # # " \n" + # # "\n" # # source://nokogiri//lib/nokogiri/xml/node.rb#550 def set_attribute(name, value); end # Swap this Node for +node_or_tags+ # # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a String # Containing markup. # # Returns self, to support chaining of calls. # # Also see related method +replace+. # # source://nokogiri//lib/nokogiri/xml/node.rb#403 def swap(node_or_tags); end def text; end # Returns true if this is a Text node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1155 def text?; end # Serialize this Node to HTML # # doc.to_html # # See Node#write_to for a list of +options+. For formatted output, # use Node#to_xhtml instead. # # source://nokogiri//lib/nokogiri/xml/node.rb#1306 def to_html(options = T.unsafe(nil)); end # Turn this node in to a string. If the document is HTML, this method # returns html. If the document is XML, this method returns XML. # # source://nokogiri//lib/nokogiri/xml/node.rb#1190 def to_s; end def to_str; end # Serialize this Node to XHTML using +options+ # # # See Node#write_to for a list of +options+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1327 def to_xhtml(options = T.unsafe(nil)); end # Serialize this Node to XML using +options+ # # # See Node#write_to for a list of +options+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1316 def to_xml(options = T.unsafe(nil)); end # Yields self and all children to +block+ recursively. # # @yield [_self] # @yieldparam _self [Nokogiri::XML::Node] the object that the method was called on # # source://nokogiri//lib/nokogiri/xml/node.rb#1233 def traverse(&block); end def type; end def unlink; end # Does this Node's attributes include # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#623 def value?(value); end # Get the attribute values for this Node. # # source://nokogiri//lib/nokogiri/xml/node.rb#617 def values; end # :call-seq: # wrap(markup) -> self # wrap(node) -> self # # Wrap this Node with the node parsed from +markup+ or a dup of the +node+. # # [Parameters] # - *markup* (String) # Markup that is parsed and used as the wrapper. This node's parent, if it exists, is used # as the context node for parsing; otherwise the associated document is used. If the parsed # fragment has multiple roots, the first root node is used as the wrapper. # - *node* (Nokogiri::XML::Node) # An element that is `#dup`ed and used as the wrapper. # # [Returns] +self+, to support chaining. # # Also see NodeSet#wrap # # *Example* with a +String+ argument: # # doc = Nokogiri::HTML5(<<~HTML) # # asdf # # HTML # doc.at_css("a").wrap("
") # doc.to_html # # => # # # # # # *Example* with a +Node+ argument: # # doc = Nokogiri::HTML5(<<~HTML) # # asdf # # HTML # doc.at_css("a").wrap(doc.create_element("div")) # doc.to_html # # # # # # # # source://nokogiri//lib/nokogiri/xml/node.rb#223 def wrap(node_or_tags); end # Write Node as HTML to +io+ with +options+ # # See Node#write_to for a list of +options+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1384 def write_html_to(io, options = T.unsafe(nil)); end # :call-seq: # write_to(io, *options) # # Serialize this node or document to +io+. # # [Parameters] # - +io+ (IO) An IO-like object to which the serialized content will be written. # - +options+ (Hash) See below # # [Options] # * +:encoding+ (String or Encoding) specify the encoding of the output (defaults to document encoding) # * +:indent_text+ (String) the indentation text (defaults to " ") # * +:indent+ (Integer) the number of +:indent_text+ to use (defaults to +2+) # * +:save_with+ (Integer) a combination of SaveOptions constants # # To save with UTF-8 indented twice: # # # To save indented with two dashes: # # node.write_to(io, indent_text: '-', indent: 2) # # @yield [config] # # source://nokogiri//lib/nokogiri/html5/node.rb#39 def write_to(io, *options); end # Write Node as XHTML to +io+ with +options+ # # See Node#write_to for a list of +options+ # # source://nokogiri//lib/nokogiri/xml/node.rb#1392 def write_xhtml_to(io, options = T.unsafe(nil)); end # Write Node as XML to +io+ with +options+ # # doc.write_xml_to io, :encoding => 'UTF-8' # # See Node#write_to for a list of options # # source://nokogiri//lib/nokogiri/xml/node.rb#1402 def write_xml_to(io, options = T.unsafe(nil)); end # Returns true if this is an XML::Document node # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node.rb#1135 def xml?; end protected # @raise [ArgumentError] # # source://nokogiri//lib/nokogiri/xml/node.rb#1482 def coerce(data); end private def add_child_node(_arg0); end # source://nokogiri//lib/nokogiri/html5/node.rb#83 def add_child_node_and_reparent_attrs(node); end def add_next_sibling_node(_arg0); end def add_previous_sibling_node(_arg0); end # source://nokogiri//lib/nokogiri/xml/node.rb#1516 def add_sibling(next_or_previous, node_or_tags); end def compare(_arg0); end def dump_html; end def get(_arg0); end def html_standard_serialize(_arg0); end def in_context(_arg0, _arg1); end # source://nokogiri//lib/nokogiri/xml/node.rb#1555 def inspect_attributes; end # source://nokogiri//lib/nokogiri/xml/node.rb#1504 def keywordify(keywords); end def native_write_to(_arg0, _arg1, _arg2, _arg3); end def prepend_newline?; end def process_xincludes(_arg0); end def replace_node(_arg0); end def set(_arg0, _arg1); end def set_namespace(_arg0); end # source://nokogiri//lib/nokogiri/xml/node.rb#1541 def to_format(save_option, options); end # source://nokogiri//lib/nokogiri/xml/node.rb#1548 def write_format_to(save_option, io, options); end class << self def new(*_arg0); end end end # Attribute declaration type # # source://nokogiri//lib/nokogiri/xml/node.rb#93 Nokogiri::XML::Node::ATTRIBUTE_DECL = T.let(T.unsafe(nil), Integer) # Attribute node type # # source://nokogiri//lib/nokogiri/xml/node.rb#65 Nokogiri::XML::Node::ATTRIBUTE_NODE = T.let(T.unsafe(nil), Integer) # CDATA node type, see Nokogiri::XML::Node#cdata? # # source://nokogiri//lib/nokogiri/xml/node.rb#69 Nokogiri::XML::Node::CDATA_SECTION_NODE = T.let(T.unsafe(nil), Integer) # Comment node type, see Nokogiri::XML::Node#comment? # # source://nokogiri//lib/nokogiri/xml/node.rb#77 Nokogiri::XML::Node::COMMENT_NODE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/node.rb#1415 Nokogiri::XML::Node::DECONSTRUCT_KEYS = T.let(T.unsafe(nil), Array) # source://nokogiri//lib/nokogiri/xml/node.rb#1416 Nokogiri::XML::Node::DECONSTRUCT_METHODS = T.let(T.unsafe(nil), Hash) # DOCB document node type # # source://nokogiri//lib/nokogiri/xml/node.rb#103 Nokogiri::XML::Node::DOCB_DOCUMENT_NODE = T.let(T.unsafe(nil), Integer) # Document fragment node type # # source://nokogiri//lib/nokogiri/xml/node.rb#83 Nokogiri::XML::Node::DOCUMENT_FRAG_NODE = T.let(T.unsafe(nil), Integer) # Document node type, see Nokogiri::XML::Node#xml? # # source://nokogiri//lib/nokogiri/xml/node.rb#79 Nokogiri::XML::Node::DOCUMENT_NODE = T.let(T.unsafe(nil), Integer) # Document type node type # # source://nokogiri//lib/nokogiri/xml/node.rb#81 Nokogiri::XML::Node::DOCUMENT_TYPE_NODE = T.let(T.unsafe(nil), Integer) # DTD node type # # source://nokogiri//lib/nokogiri/xml/node.rb#89 Nokogiri::XML::Node::DTD_NODE = T.let(T.unsafe(nil), Integer) # Element declaration type # # source://nokogiri//lib/nokogiri/xml/node.rb#91 Nokogiri::XML::Node::ELEMENT_DECL = T.let(T.unsafe(nil), Integer) # Element node type, see Nokogiri::XML::Node#element? # # source://nokogiri//lib/nokogiri/xml/node.rb#63 Nokogiri::XML::Node::ELEMENT_NODE = T.let(T.unsafe(nil), Integer) # Entity declaration type # # source://nokogiri//lib/nokogiri/xml/node.rb#95 Nokogiri::XML::Node::ENTITY_DECL = T.let(T.unsafe(nil), Integer) # Entity node type # # source://nokogiri//lib/nokogiri/xml/node.rb#73 Nokogiri::XML::Node::ENTITY_NODE = T.let(T.unsafe(nil), Integer) # Entity reference node type # # source://nokogiri//lib/nokogiri/xml/node.rb#71 Nokogiri::XML::Node::ENTITY_REF_NODE = T.let(T.unsafe(nil), Integer) # HTML document node type, see Nokogiri::XML::Node#html? # # source://nokogiri//lib/nokogiri/xml/node.rb#87 Nokogiri::XML::Node::HTML_DOCUMENT_NODE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/node.rb#1559 Nokogiri::XML::Node::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array) # Namespace declaration type # # source://nokogiri//lib/nokogiri/xml/node.rb#97 Nokogiri::XML::Node::NAMESPACE_DECL = T.let(T.unsafe(nil), Integer) # Notation node type # # source://nokogiri//lib/nokogiri/xml/node.rb#85 Nokogiri::XML::Node::NOTATION_NODE = T.let(T.unsafe(nil), Integer) # PI node type # # source://nokogiri//lib/nokogiri/xml/node.rb#75 Nokogiri::XML::Node::PI_NODE = T.let(T.unsafe(nil), Integer) # Save options for serializing nodes. # See the method group entitled Node@Serialization+and+Generating+Output for usage. # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#9 class Nokogiri::XML::Node::SaveOptions # Create a new SaveOptions object with +options+ # # @return [SaveOptions] a new instance of SaveOptions # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#47 def initialize(options = T.unsafe(nil)); end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def as_html; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def as_html?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def as_xhtml; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def as_xhtml?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def as_xml; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def as_xml?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def default_html; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def default_html?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def default_xhtml; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def default_xhtml?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def default_xml; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def default_xml?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def format; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def format?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#66 def inspect; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def no_declaration; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def no_declaration?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def no_empty_tags; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def no_empty_tags?; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#53 def no_xhtml; end # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#58 def no_xhtml?; end # Integer representation of the SaveOptions # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#44 def options; end # Integer representation of the SaveOptions # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#44 def to_i; end end # Save as HTML # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#23 Nokogiri::XML::Node::SaveOptions::AS_HTML = T.let(T.unsafe(nil), Integer) # Save as XHTML # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#19 Nokogiri::XML::Node::SaveOptions::AS_XHTML = T.let(T.unsafe(nil), Integer) # Save as XML # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#21 Nokogiri::XML::Node::SaveOptions::AS_XML = T.let(T.unsafe(nil), Integer) # the default for HTML document # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#38 Nokogiri::XML::Node::SaveOptions::DEFAULT_HTML = T.let(T.unsafe(nil), Integer) # the default for XHTML document # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#40 Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML = T.let(T.unsafe(nil), Integer) # the default for XML documents # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#36 Nokogiri::XML::Node::SaveOptions::DEFAULT_XML = T.let(T.unsafe(nil), Integer) # Format serialized xml # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#11 Nokogiri::XML::Node::SaveOptions::FORMAT = T.let(T.unsafe(nil), Integer) # Do not include declarations # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#13 Nokogiri::XML::Node::SaveOptions::NO_DECLARATION = T.let(T.unsafe(nil), Integer) # Do not include empty tags # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#15 Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS = T.let(T.unsafe(nil), Integer) # Do not save XHTML # # source://nokogiri//lib/nokogiri/xml/node/save_options.rb#17 Nokogiri::XML::Node::SaveOptions::NO_XHTML = T.let(T.unsafe(nil), Integer) # Text node type, see Nokogiri::XML::Node#text? # # source://nokogiri//lib/nokogiri/xml/node.rb#67 Nokogiri::XML::Node::TEXT_NODE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/node.rb#1538 Nokogiri::XML::Node::USING_LIBXML_WITH_BROKEN_SERIALIZATION = T.let(T.unsafe(nil), FalseClass) # XInclude end type # # source://nokogiri//lib/nokogiri/xml/node.rb#101 Nokogiri::XML::Node::XINCLUDE_END = T.let(T.unsafe(nil), Integer) # XInclude start type # # source://nokogiri//lib/nokogiri/xml/node.rb#99 Nokogiri::XML::Node::XINCLUDE_START = T.let(T.unsafe(nil), Integer) # A NodeSet contains a list of Nokogiri::XML::Node objects. Typically # a NodeSet is return as a result of searching a Document via # Nokogiri::XML::Searchable#css or Nokogiri::XML::Searchable#xpath # # source://nokogiri//lib/nokogiri/xml/node_set.rb#10 class Nokogiri::XML::NodeSet include ::Nokogiri::XML::Searchable include ::Enumerable # Create a NodeSet with +document+ defaulting to +list+ # # @return [NodeSet] a new instance of NodeSet # @yield [_self] # @yieldparam _self [Nokogiri::XML::NodeSet] the object that the method was called on # # source://nokogiri//lib/nokogiri/xml/node_set.rb#20 def initialize(document, list = T.unsafe(nil)); end # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class] # # Search this object for +paths+, and return only the first # result. +paths+ must be one or more XPath or CSS queries. # # See Searchable#search for more information. # # Or, if passed an integer, index into the NodeSet: # # node_set.at(3) # same as node_set[3] # # source://nokogiri//lib/nokogiri/xml/node_set.rb#119 def %(*args); end def &(_arg0); end def +(_arg0); end def -(_arg0); end def <<(_arg0); end # Equality -- Two NodeSets are equal if the contain the same number # of elements and if each element is equal to the corresponding # element in the other NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#393 def ==(other); end def [](*_arg0); end # Add the class attribute +name+ to all Node objects in the # NodeSet. # # See Nokogiri::XML::Node#add_class for more information. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#139 def add_class(name); end # Insert +datum+ after the last Node in this NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#69 def after(datum); end # Append the class attribute +name+ to all Node objects in the # NodeSet. # # See Nokogiri::XML::Node#append_class for more information. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#151 def append_class(name); end # call-seq: search *paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class] # # Search this object for +paths+, and return only the first # result. +paths+ must be one or more XPath or CSS queries. # # See Searchable#search for more information. # # Or, if passed an integer, index into the NodeSet: # # node_set.at(3) # same as node_set[3] # # source://nokogiri//lib/nokogiri/xml/node_set.rb#119 def at(*args); end # Set attributes on each Node in the NodeSet, or get an # attribute from the first Node in the NodeSet. # # To get an attribute from the first Node in a NodeSet: # # node_set.attr("href") # => "https://www.nokogiri.org" # # Note that an empty NodeSet will return nil when +#attr+ is called as a getter. # # To set an attribute on each node, +key+ can either be an # attribute name, or a Hash of attribute names and values. When # called as a setter, +#attr+ returns the NodeSet. # # If +key+ is an attribute name, then either +value+ or +block+ # must be passed. # # If +key+ is a Hash then attributes will be set for each # key/value pair: # # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member") # # If +value+ is passed, it will be used as the attribute value # for all nodes: # # node_set.attr("href", "https://www.nokogiri.org") # # If +block+ is passed, it will be called on each Node object in # the NodeSet and the return value used as the attribute value # for that node: # # node_set.attr("class") { |node| node.name } # # source://nokogiri//lib/nokogiri/xml/node_set.rb#203 def attr(key, value = T.unsafe(nil), &block); end # Set attributes on each Node in the NodeSet, or get an # attribute from the first Node in the NodeSet. # # To get an attribute from the first Node in a NodeSet: # # node_set.attr("href") # => "https://www.nokogiri.org" # # Note that an empty NodeSet will return nil when +#attr+ is called as a getter. # # To set an attribute on each node, +key+ can either be an # attribute name, or a Hash of attribute names and values. When # called as a setter, +#attr+ returns the NodeSet. # # If +key+ is an attribute name, then either +value+ or +block+ # must be passed. # # If +key+ is a Hash then attributes will be set for each # key/value pair: # # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member") # # If +value+ is passed, it will be used as the attribute value # for all nodes: # # node_set.attr("href", "https://www.nokogiri.org") # # If +block+ is passed, it will be called on each Node object in # the NodeSet and the return value used as the attribute value # for that node: # # node_set.attr("class") { |node| node.name } # # source://nokogiri//lib/nokogiri/xml/node_set.rb#203 def attribute(key, value = T.unsafe(nil), &block); end # Insert +datum+ before the first Node in this NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#63 def before(datum); end # Returns a new NodeSet containing all the children of all the nodes in # the NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#406 def children; end def clone; end # call-seq: css *rules, [namespace-bindings, custom-pseudo-class] # # Search this node set for CSS +rules+. +rules+ must be one or more CSS # selectors. For example: # # For more information see Nokogiri::XML::Searchable#css # # source://nokogiri//lib/nokogiri/xml/node_set.rb#83 def css(*args); end # :call-seq: deconstruct() → Array # # Returns the members of this NodeSet as an array, to use in pattern matching. # # ⚡ This is an experimental feature, available since v1.14.0 # # source://nokogiri//lib/nokogiri/xml/node_set.rb#440 def deconstruct; end def delete(_arg0); end # The Document this NodeSet is associated with # # source://nokogiri//lib/nokogiri/xml/node_set.rb#15 def document; end # The Document this NodeSet is associated with # # source://nokogiri//lib/nokogiri/xml/node_set.rb#15 def document=(_arg0); end def dup; end # Iterate over each node, yielding to +block+ # # source://nokogiri//lib/nokogiri/xml/node_set.rb#231 def each; end # Is this NodeSet empty? # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/node_set.rb#45 def empty?; end # Filter this list for nodes that match +expr+ # # source://nokogiri//lib/nokogiri/xml/node_set.rb#130 def filter(expr); end # Get the first element of the NodeSet. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#29 def first(n = T.unsafe(nil)); end def include?(_arg0); end # 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. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#51 def index(node = T.unsafe(nil)); end # Get the inner html of all contained Node objects # # source://nokogiri//lib/nokogiri/xml/node_set.rb#260 def inner_html(*args); end # Get the inner text of all contained Node objects # # Note: This joins the text of all Node objects in the NodeSet: # # doc = Nokogiri::XML('foobar') # doc.css('d').text # => "foobar" # # Instead, if you want to return the text of all nodes in the NodeSet: # # doc.css('d').map(&:text) # => ["foo", "bar"] # # See Nokogiri::XML::Node#content for more information. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#253 def inner_text; end # Return a nicely formated string representation # # source://nokogiri//lib/nokogiri/xml/node_set.rb#427 def inspect; end # Get the last element of the NodeSet. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#39 def last; end def length; end # Removes the last element from set and returns it, or +nil+ if # the set is empty # # source://nokogiri//lib/nokogiri/xml/node_set.rb#374 def pop; end def push(_arg0); end def remove; end # Remove the attributed named +name+ from all Node objects in the NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#223 def remove_attr(name); end # Remove the attributed named +name+ from all Node objects in the NodeSet # # source://nokogiri//lib/nokogiri/xml/node_set.rb#223 def remove_attribute(name); end # Remove the class attribute +name+ from all Node objects in the # NodeSet. # # See Nokogiri::XML::Node#remove_class for more information. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#163 def remove_class(name = T.unsafe(nil)); end # Returns a new NodeSet containing all the nodes in the NodeSet # in reverse order # # source://nokogiri//lib/nokogiri/xml/node_set.rb#417 def reverse; end # Set attributes on each Node in the NodeSet, or get an # attribute from the first Node in the NodeSet. # # To get an attribute from the first Node in a NodeSet: # # node_set.attr("href") # => "https://www.nokogiri.org" # # Note that an empty NodeSet will return nil when +#attr+ is called as a getter. # # To set an attribute on each node, +key+ can either be an # attribute name, or a Hash of attribute names and values. When # called as a setter, +#attr+ returns the NodeSet. # # If +key+ is an attribute name, then either +value+ or +block+ # must be passed. # # If +key+ is a Hash then attributes will be set for each # key/value pair: # # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member") # # If +value+ is passed, it will be used as the attribute value # for all nodes: # # node_set.attr("href", "https://www.nokogiri.org") # # If +block+ is passed, it will be called on each Node object in # the NodeSet and the return value used as the attribute value # for that node: # # node_set.attr("class") { |node| node.name } # # source://nokogiri//lib/nokogiri/xml/node_set.rb#203 def set(key, value = T.unsafe(nil), &block); end # Returns the first element of the NodeSet and removes it. Returns # +nil+ if the set is empty. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#383 def shift; end def size; end def slice(*_arg0); end # Get the inner text of all contained Node objects # # Note: This joins the text of all Node objects in the NodeSet: # # doc = Nokogiri::XML('foobar') # doc.css('d').text # => "foobar" # # Instead, if you want to return the text of all nodes in the NodeSet: # # doc.css('d').map(&:text) # => ["foo", "bar"] # # See Nokogiri::XML::Node#content for more information. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#253 def text; end def to_a; end def to_ary; end # Convert this NodeSet to HTML # # source://nokogiri//lib/nokogiri/xml/node_set.rb#341 def to_html(*args); end # Convert this NodeSet to a string. # # source://nokogiri//lib/nokogiri/xml/node_set.rb#335 def to_s; end # Convert this NodeSet to XHTML # # source://nokogiri//lib/nokogiri/xml/node_set.rb#358 def to_xhtml(*args); end # Convert this NodeSet to XML # # source://nokogiri//lib/nokogiri/xml/node_set.rb#364 def to_xml(*args); end def unlink; end # :call-seq: # wrap(markup) -> self # wrap(node) -> self # # Wrap each member of this NodeSet with the node parsed from +markup+ or a dup of the +node+. # # [Parameters] # - *markup* (String) # Markup that is parsed, once per member of the NodeSet, and used as the wrapper. Each # node's parent, if it exists, is used as the context node for parsing; otherwise the # associated document is used. If the parsed fragment has multiple roots, the first root # node is used as the wrapper. # - *node* (Nokogiri::XML::Node) # An element that is `#dup`ed and used as the wrapper. # # [Returns] +self+, to support chaining. # # ⚠ Note that if a +String+ is passed, the markup will be parsed once per node in the # NodeSet. You can avoid this overhead in cases where you know exactly the wrapper you wish to # use by passing a +Node+ instead. # # Also see Node#wrap # # *Example* with a +String+ argument: # # doc = Nokogiri::HTML5(<<~HTML) # # a # b # c # d # # HTML # doc.css("a").wrap("
") # doc.to_html # # => # # # # # # # # # # # # *Example* with a +Node+ argument # # 💡 Note that this is faster than the equivalent call passing a +String+ because it avoids # having to reparse the wrapper markup for each node. # # doc = Nokogiri::HTML5(<<~HTML) # # a # b # c # d # # HTML # doc.css("a").wrap(doc.create_element("div")) # doc.to_html # # => # # # # # # # # # # # # source://nokogiri//lib/nokogiri/xml/node_set.rb#328 def wrap(node_or_tags); end # call-seq: xpath *paths, [namespace-bindings, variable-bindings, custom-handler-class] # # Search this node set for XPath +paths+. +paths+ must be one or more XPath # queries. # # For more information see Nokogiri::XML::Searchable#xpath # # source://nokogiri//lib/nokogiri/xml/node_set.rb#99 def xpath(*args); end def |(_arg0); end end # source://nokogiri//lib/nokogiri/xml/node_set.rb#444 Nokogiri::XML::NodeSet::IMPLIED_XPATH_CONTEXTS = T.let(T.unsafe(nil), Array) # Struct representing an {XML Schema Notation}[https://www.w3.org/TR/xml/#Notations] # # source://nokogiri//lib/nokogiri/xml/notation.rb#6 class Nokogiri::XML::Notation < ::Struct; end # source://nokogiri//lib/nokogiri/xml/pp/node.rb#6 module Nokogiri::XML::PP; end # source://nokogiri//lib/nokogiri/xml/pp/character_data.rb#7 module Nokogiri::XML::PP::CharacterData # source://nokogiri//lib/nokogiri/xml/pp/character_data.rb#15 def inspect; end # source://nokogiri//lib/nokogiri/xml/pp/character_data.rb#8 def pretty_print(pp); end end # source://nokogiri//lib/nokogiri/xml/pp/node.rb#7 module Nokogiri::XML::PP::Node # source://nokogiri//lib/nokogiri/xml/pp/node.rb#10 def inspect; end # source://nokogiri//lib/nokogiri/xml/pp/node.rb#27 def pretty_print(pp); end end # source://nokogiri//lib/nokogiri/xml/pp/node.rb#8 Nokogiri::XML::PP::Node::COLLECTIONS = T.let(T.unsafe(nil), Array) # Options that control the parsing behavior for XML::Document, XML::DocumentFragment, # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema. # # These options directly expose libxml2's parse options, which are all boolean in the sense that # an option is "on" or "off". # # 💡 Note that HTML5 parsing has a separate, orthogonal set of options due to the nature of the # HTML5 specification. See Nokogiri::HTML5. # # ⚠ Not all parse options are supported on JRuby. Nokogiri will attempt to invoke the equivalent # behavior in Xerces/NekoHTML on JRuby when it's possible. # # == Setting and unsetting parse options # # You can build your own combinations of parse options by using any of the following methods: # # [ParseOptions method chaining] # # Every option has an equivalent method in lowercase. You can chain these methods together to # set various combinations. # # # Set the HUGE & PEDANTIC options # po = Nokogiri::XML::ParseOptions.new.huge.pedantic # doc = Nokogiri::XML::Document.parse(xml, nil, nil, po) # # Every option has an equivalent no{option} method in lowercase. You can call these # methods on an instance of ParseOptions to unset the option. # # # Set the HUGE & PEDANTIC options # po = Nokogiri::XML::ParseOptions.new.huge.pedantic # # # later we want to modify the options # po.nohuge # Unset the HUGE option # po.nopedantic # Unset the PEDANTIC option # # 💡 Note that some options begin with "no" leading to the logical but perhaps unintuitive # double negative: # # po.nocdata # Set the NOCDATA parse option # po.nonocdata # Unset the NOCDATA parse option # # 💡 Note that negation is not available for STRICT, which is itself a negation of all other # features. # # # [Using Ruby Blocks] # # Most parsing methods will accept a block for configuration of parse options, and we # recommend chaining the setter methods: # # doc = Nokogiri::XML::Document.parse(xml) { |config| config.huge.pedantic } # # # [ParseOptions constants] # # You can also use the constants declared under Nokogiri::XML::ParseOptions to set various # combinations. They are bits in a bitmask, and so can be combined with bitwise operators: # # po = Nokogiri::XML::ParseOptions.new(Nokogiri::XML::ParseOptions::HUGE | Nokogiri::XML::ParseOptions::PEDANTIC) # doc = Nokogiri::XML::Document.parse(xml, nil, nil, po) # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#67 class Nokogiri::XML::ParseOptions # @return [ParseOptions] a new instance of ParseOptions # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#165 def initialize(options = T.unsafe(nil)); end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#198 def ==(other); end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def big_lines; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def big_lines?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def compact; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def compact?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def default_html; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def default_html?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def default_schema; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def default_schema?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def default_xml; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def default_xml?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def default_xslt; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def default_xslt?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def dtdattr; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def dtdattr?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def dtdload; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def dtdload?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def dtdvalid; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def dtdvalid?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def huge; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def huge?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#204 def inspect; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nobasefix; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nobasefix?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nobig_lines; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def noblanks; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def noblanks?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nocdata; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nocdata?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nocompact; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodefault_html; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodefault_schema; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodefault_xml; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodefault_xslt; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nodict; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nodict?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodtdattr; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodtdload; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nodtdvalid; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def noent; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def noent?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def noerror; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def noerror?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nohuge; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nonet; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nonet?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonobasefix; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonoblanks; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonocdata; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonodict; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonoent; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonoerror; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nononet; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonowarning; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonoxincnode; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nonsclean; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def noold10; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nopedantic; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def norecover; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def nosax1; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nowarning; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nowarning?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#178 def noxinclude; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def noxincnode; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def noxincnode?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def nsclean; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def nsclean?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def old10; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def old10?; end # Returns the value of attribute options. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#163 def options; end # Sets the attribute options # # @param value the value to set the attribute options to. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#163 def options=(_arg0); end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def pedantic; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def pedantic?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def recover; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def recover?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def sax1; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def sax1?; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#189 def strict; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#194 def strict?; end # Returns the value of attribute options. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#163 def to_i; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#173 def xinclude; end # source://nokogiri//lib/nokogiri/xml/parse_options.rb#183 def xinclude?; end end # Support line numbers up to long int (default is a short int). On # by default for for XML::Document, XML::DocumentFragment, HTML4::Document, # HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#149 Nokogiri::XML::ParseOptions::BIG_LINES = T.let(T.unsafe(nil), Integer) # Compact small text nodes. Off by default. # # ⚠ No modification of the DOM tree is allowed after parsing. libxml2 may crash if you try to # modify the tree. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#133 Nokogiri::XML::ParseOptions::COMPACT = T.let(T.unsafe(nil), Integer) # The options mask used by default used for parsing HTML4::Document and HTML4::DocumentFragment # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#158 Nokogiri::XML::ParseOptions::DEFAULT_HTML = T.let(T.unsafe(nil), Integer) # The options mask used by default used for parsing XML::Schema # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#161 Nokogiri::XML::ParseOptions::DEFAULT_SCHEMA = T.let(T.unsafe(nil), Integer) # The options mask used by default for parsing XML::Document and XML::DocumentFragment # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#152 Nokogiri::XML::ParseOptions::DEFAULT_XML = T.let(T.unsafe(nil), Integer) # The options mask used by default used for parsing XSLT::Stylesheet # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#155 Nokogiri::XML::ParseOptions::DEFAULT_XSLT = T.let(T.unsafe(nil), Integer) # Default DTD attributes. On by default for XSLT::Stylesheet. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#88 Nokogiri::XML::ParseOptions::DTDATTR = T.let(T.unsafe(nil), Integer) # Load external subsets. On by default for XSLT::Stylesheet. # # ⚠ It is UNSAFE to set this option when parsing untrusted documents. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#85 Nokogiri::XML::ParseOptions::DTDLOAD = T.let(T.unsafe(nil), Integer) # Validate with the DTD. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#91 Nokogiri::XML::ParseOptions::DTDVALID = T.let(T.unsafe(nil), Integer) # Relax any hardcoded limit from the parser. Off by default. # # ⚠ There may be a performance penalty when this option is set. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#144 Nokogiri::XML::ParseOptions::HUGE = T.let(T.unsafe(nil), Integer) # Do not fixup XInclude xml:base uris. Off by default # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#139 Nokogiri::XML::ParseOptions::NOBASEFIX = T.let(T.unsafe(nil), Integer) # Remove blank nodes. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#103 Nokogiri::XML::ParseOptions::NOBLANKS = T.let(T.unsafe(nil), Integer) # Merge CDATA as text nodes. On by default for XSLT::Stylesheet. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#124 Nokogiri::XML::ParseOptions::NOCDATA = T.let(T.unsafe(nil), Integer) # Do not reuse the context dictionary. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#118 Nokogiri::XML::ParseOptions::NODICT = T.let(T.unsafe(nil), Integer) # Substitute entities. Off by default. # # ⚠ This option enables entity substitution, contrary to what the name implies. # # ⚠ It is UNSAFE to set this option when parsing untrusted documents. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#80 Nokogiri::XML::ParseOptions::NOENT = T.let(T.unsafe(nil), Integer) # Suppress error reports. On by default for HTML4::Document and HTML4::DocumentFragment # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#94 Nokogiri::XML::ParseOptions::NOERROR = T.let(T.unsafe(nil), Integer) # Forbid network access. On by default for XML::Document, XML::DocumentFragment, # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema. # # ⚠ It is UNSAFE to unset this option when parsing untrusted documents. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#115 Nokogiri::XML::ParseOptions::NONET = T.let(T.unsafe(nil), Integer) # Suppress warning reports. On by default for HTML4::Document and HTML4::DocumentFragment # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#97 Nokogiri::XML::ParseOptions::NOWARNING = T.let(T.unsafe(nil), Integer) # Do not generate XInclude START/END nodes. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#127 Nokogiri::XML::ParseOptions::NOXINCNODE = T.let(T.unsafe(nil), Integer) # Remove redundant namespaces declarations. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#121 Nokogiri::XML::ParseOptions::NSCLEAN = T.let(T.unsafe(nil), Integer) # Parse using XML-1.0 before update 5. Off by default # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#136 Nokogiri::XML::ParseOptions::OLD10 = T.let(T.unsafe(nil), Integer) # Enable pedantic error reporting. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#100 Nokogiri::XML::ParseOptions::PEDANTIC = T.let(T.unsafe(nil), Integer) # Recover from errors. On by default for XML::Document, XML::DocumentFragment, # HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#73 Nokogiri::XML::ParseOptions::RECOVER = T.let(T.unsafe(nil), Integer) # Use the SAX1 interface internally. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#106 Nokogiri::XML::ParseOptions::SAX1 = T.let(T.unsafe(nil), Integer) # Strict parsing # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#69 Nokogiri::XML::ParseOptions::STRICT = T.let(T.unsafe(nil), Integer) # Implement XInclude substitution. Off by default. # # source://nokogiri//lib/nokogiri/xml/parse_options.rb#109 Nokogiri::XML::ParseOptions::XINCLUDE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/processing_instruction.rb#5 class Nokogiri::XML::ProcessingInstruction < ::Nokogiri::XML::Node # @return [ProcessingInstruction] a new instance of ProcessingInstruction # # source://nokogiri//lib/nokogiri/xml/processing_instruction.rb#6 def initialize(document, name, content); end class << self def new(*_arg0); end end end # Nokogiri::XML::Reader parses an XML document similar to the way a cursor # would move. The Reader is given an XML document, and yields nodes # to an each block. # # Here is an example of usage: # # reader = Nokogiri::XML::Reader(<<-eoxml) # # snuggles! # # eoxml # # reader.each do |node| # # # node is an instance of Nokogiri::XML::Reader # puts node.name # # end # # Note that Nokogiri::XML::Reader#each can only be called once!! Once # the cursor moves through the entire document, you must parse the # document again. So make sure that you capture any information you # need during the first iteration. # # The Reader parser is good for when you need the speed of a SAX parser, # but do not want to write a Document handler. # # source://nokogiri//lib/nokogiri/xml/reader.rb#32 class Nokogiri::XML::Reader include ::Enumerable # @return [Reader] a new instance of Reader # # source://nokogiri//lib/nokogiri/xml/reader.rb#79 def initialize(source, url = T.unsafe(nil), encoding = T.unsafe(nil)); end def attribute(_arg0); end def attribute_at(_arg0); end def attribute_count; end def attribute_hash; end def attribute_nodes; end # Get the attributes and namespaces of the current node as a Hash. # # This is the union of Reader#attribute_hash and Reader#namespaces # # [Returns] # (Hash) Attribute names and values, and namespace prefixes and hrefs. # # source://nokogiri//lib/nokogiri/xml/reader.rb#92 def attributes; end def attributes?; end def base_uri; end def default?; end def depth; end # Move the cursor through the document yielding the cursor to the block # # source://nokogiri//lib/nokogiri/xml/reader.rb#98 def each; end def empty_element?; end def encoding; end # A list of errors encountered while parsing # # source://nokogiri//lib/nokogiri/xml/reader.rb#72 def errors; end # A list of errors encountered while parsing # # source://nokogiri//lib/nokogiri/xml/reader.rb#72 def errors=(_arg0); end def inner_xml; end def lang; end def local_name; end def name; end def namespace_uri; end def namespaces; end def node_type; end def outer_xml; end def prefix; end def read; end def self_closing?; end # The XML source # # source://nokogiri//lib/nokogiri/xml/reader.rb#75 def source; end def state; end def value; end def value?; end def xml_version; end class << self def from_io(*_arg0); end def from_memory(*_arg0); end end end # Attribute node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#39 Nokogiri::XML::Reader::TYPE_ATTRIBUTE = T.let(T.unsafe(nil), Integer) # CDATA node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#43 Nokogiri::XML::Reader::TYPE_CDATA = T.let(T.unsafe(nil), Integer) # Comment node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#51 Nokogiri::XML::Reader::TYPE_COMMENT = T.let(T.unsafe(nil), Integer) # Document node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#53 Nokogiri::XML::Reader::TYPE_DOCUMENT = T.let(T.unsafe(nil), Integer) # Document Fragment node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#57 Nokogiri::XML::Reader::TYPE_DOCUMENT_FRAGMENT = T.let(T.unsafe(nil), Integer) # Document Type node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#55 Nokogiri::XML::Reader::TYPE_DOCUMENT_TYPE = T.let(T.unsafe(nil), Integer) # Element node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#37 Nokogiri::XML::Reader::TYPE_ELEMENT = T.let(T.unsafe(nil), Integer) # Element end node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#65 Nokogiri::XML::Reader::TYPE_END_ELEMENT = T.let(T.unsafe(nil), Integer) # Entity end node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#67 Nokogiri::XML::Reader::TYPE_END_ENTITY = T.let(T.unsafe(nil), Integer) # Entity node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#47 Nokogiri::XML::Reader::TYPE_ENTITY = T.let(T.unsafe(nil), Integer) # Entity Reference node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#45 Nokogiri::XML::Reader::TYPE_ENTITY_REFERENCE = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/reader.rb#35 Nokogiri::XML::Reader::TYPE_NONE = T.let(T.unsafe(nil), Integer) # Notation node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#59 Nokogiri::XML::Reader::TYPE_NOTATION = T.let(T.unsafe(nil), Integer) # PI node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#49 Nokogiri::XML::Reader::TYPE_PROCESSING_INSTRUCTION = T.let(T.unsafe(nil), Integer) # Significant Whitespace node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#63 Nokogiri::XML::Reader::TYPE_SIGNIFICANT_WHITESPACE = T.let(T.unsafe(nil), Integer) # Text node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#41 Nokogiri::XML::Reader::TYPE_TEXT = T.let(T.unsafe(nil), Integer) # Whitespace node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#61 Nokogiri::XML::Reader::TYPE_WHITESPACE = T.let(T.unsafe(nil), Integer) # XML Declaration node type # # source://nokogiri//lib/nokogiri/xml/reader.rb#69 Nokogiri::XML::Reader::TYPE_XML_DECLARATION = T.let(T.unsafe(nil), Integer) # Nokogiri::XML::RelaxNG is used for validating XML against a # RelaxNG schema. # # == Synopsis # # Validate an XML document against a RelaxNG schema. Loop over the errors # that are returned and print them out: # # schema = Nokogiri::XML::RelaxNG(File.open(ADDRESS_SCHEMA_FILE)) # doc = Nokogiri::XML(File.open(ADDRESS_XML_FILE)) # # schema.validate(doc).each do |error| # puts error.message # end # # The list of errors are Nokogiri::XML::SyntaxError objects. # # NOTE: RelaxNG input is always treated as TRUSTED documents, meaning that they will cause the # underlying parsing libraries to access network resources. This is counter to Nokogiri's # "untrusted by default" security policy, but is a limitation of the underlying libraries. # # source://nokogiri//lib/nokogiri/xml/relax_ng.rb#35 class Nokogiri::XML::RelaxNG < ::Nokogiri::XML::Schema private def validate_document(_arg0); end class << self def from_document(*_arg0); end def read_memory(*_arg0); end end end # SAX Parsers are event driven parsers. Nokogiri provides two different event based parsers when # dealing with XML. If you want to do SAX style parsing using HTML, check out # Nokogiri::HTML4::SAX. # # The basic way a SAX style parser works is by creating a parser, telling the parser about the # events we're interested in, then giving the parser some XML to process. The parser will notify # you when it encounters events you said you would like to know about. # # To register for events, you simply subclass Nokogiri::XML::SAX::Document, and implement the # methods for which you would like notification. # # For example, if I want to be notified when a document ends, and when an element starts, I # would write a class like this: # # class MyDocument < Nokogiri::XML::SAX::Document # def end_document # puts "the document has ended" # end # # def start_element name, attributes = [] # puts "#{name} started" # end # end # # Then I would instantiate a SAX parser with this document, and feed the parser some XML # # # Create a new parser # parser = Nokogiri::XML::SAX::Parser.new(MyDocument.new) # # # Feed the parser some XML # parser.parse(File.open(ARGV[0])) # # Now my document handler will be called when each node starts, and when then document ends. To # see what kinds of events are available, take a look at Nokogiri::XML::SAX::Document. # # Two SAX parsers for XML are available, a parser that reads from a string or IO object as it # feels necessary, and a parser that lets you spoon feed it XML. If you want to let Nokogiri # deal with reading your XML, use the Nokogiri::XML::SAX::Parser. If you want to have fine grain # control over the XML input, use the Nokogiri::XML::SAX::PushParser. # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#45 module Nokogiri::XML::SAX; end # This class is used for registering types of events you are interested in handling. All of # the methods on this class are available as possible events while parsing an XML document. To # register for any particular event, just subclass this class and implement the methods you # are interested in knowing about. # # To only be notified about start and end element events, write a class like this: # # class MyDocument < Nokogiri::XML::SAX::Document # def start_element name, attrs = [] # puts "#{name} started!" # end # # def end_element name # puts "#{name} ended" # end # end # # You can use this event handler for any SAX style parser included with Nokogiri. See # Nokogiri::XML::SAX, and Nokogiri::HTML4::SAX. # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#66 class Nokogiri::XML::SAX::Document # Called when cdata blocks are found # +string+ contains the cdata content # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#155 def cdata_block(string); end # Characters read between a tag. This method might be called multiple # times given one contiguous string of characters. # # +string+ contains the character data # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#131 def characters(string); end # Called when comments are encountered # +string+ contains the comment data # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#137 def comment(string); end # Called when document ends parsing # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#79 def end_document; end # Called at the end of an element # +name+ is the tag name # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#93 def end_element(name); end # Called at the end of an element # +name+ is the element's name # +prefix+ is the namespace prefix associated with the element # +uri+ is the associated namespace URI # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#120 def end_element_namespace(name, prefix = T.unsafe(nil), uri = T.unsafe(nil)); end # Called on document errors # +string+ contains the error # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#149 def error(string); end # Called when processing instructions are found # +name+ is the target of the instruction # +content+ is the value of the instruction # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#162 def processing_instruction(name, content); end # Called when document starts parsing # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#74 def start_document; end # Called at the beginning of an element # * +name+ is the name of the tag # * +attrs+ are an assoc list of namespaces and attributes, e.g.: # [ ["xmlns:foo", "http://sample.net"], ["size", "large"] ] # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#87 def start_element(name, attrs = T.unsafe(nil)); end # Called at the beginning of an element # +name+ is the element name # +attrs+ is a list of attributes # +prefix+ is the namespace prefix for the element # +uri+ is the associated namespace URI # +ns+ is a hash of namespace prefix:urls associated with the element # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#103 def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end # Called on document warnings # +string+ contains the warning # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#143 def warning(string); end # Called when an XML declaration is parsed # # source://nokogiri//lib/nokogiri/xml/sax/document.rb#69 def xmldecl(version, encoding, standalone); end end # This parser is a SAX style parser that reads it's input as it # deems necessary. The parser takes a Nokogiri::XML::SAX::Document, # an optional encoding, then given an XML input, sends messages to # the Nokogiri::XML::SAX::Document. # # Here is an example of using this parser: # # # Create a subclass of Nokogiri::XML::SAX::Document and implement # # the events we care about: # class MyDoc < Nokogiri::XML::SAX::Document # def start_element name, attrs = [] # puts "starting: #{name}" # end # # def end_element name # puts "ending: #{name}" # end # end # # # Create our parser # parser = Nokogiri::XML::SAX::Parser.new(MyDoc.new) # # # Send some XML to the parser # parser.parse(File.open(ARGV[0])) # # For more information about SAX parsers, see Nokogiri::XML::SAX. Also # see Nokogiri::XML::SAX::Document for the available events. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#34 class Nokogiri::XML::SAX::Parser # Create a new Parser with +doc+ and +encoding+ # # @return [Parser] a new instance of Parser # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#72 def initialize(doc = T.unsafe(nil), encoding = T.unsafe(nil)); end # The Nokogiri::XML::SAX::Document where events will be sent. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#66 def document; end # The Nokogiri::XML::SAX::Document where events will be sent. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#66 def document=(_arg0); end # The encoding beings used for this document. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#69 def encoding; end # The encoding beings used for this document. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#69 def encoding=(_arg0); end # Parse given +thing+ which may be a string containing xml, or an # IO object. # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#81 def parse(thing, &block); end # Parse a file with +filename+ # # @raise [ArgumentError] # @yield [ctx] # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#99 def parse_file(filename); end # Parse given +io+ # # @yield [ctx] # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#91 def parse_io(io, encoding = T.unsafe(nil)); end # @yield [ctx] # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#109 def parse_memory(data); end private # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#117 def check_encoding(encoding); end end # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#35 class Nokogiri::XML::SAX::Parser::Attribute < ::Struct; end # Encodinds this parser supports # # source://nokogiri//lib/nokogiri/xml/sax/parser.rb#39 Nokogiri::XML::SAX::Parser::ENCODINGS = T.let(T.unsafe(nil), Hash) # Context for XML SAX parsers. This class is usually not instantiated # by the user. Instead, you should be looking at # Nokogiri::XML::SAX::Parser # # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#10 class Nokogiri::XML::SAX::ParserContext def column; end def line; end def parse_with(_arg0); end def recovery; end def recovery=(_arg0); end def replace_entities; end def replace_entities=(_arg0); end class << self def file(_arg0); end def io(_arg0, _arg1); end def memory(_arg0); end # source://nokogiri//lib/nokogiri/xml/sax/parser_context.rb#11 def new(thing, encoding = T.unsafe(nil)); end end end # PushParser can parse a document that is fed to it manually. It # must be given a SAX::Document object which will be called with # SAX events as the document is being parsed. # # Calling PushParser#<< writes XML to the parser, calling any SAX # callbacks it can. # # PushParser#finish tells the parser that the document is finished # and calls the end_document SAX method. # # Example: # # parser = PushParser.new(Class.new(XML::SAX::Document) { # def start_document # puts "start document called" # end # }.new) # parser << "
hello<" # parser << "/div>" # parser.finish # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#27 class Nokogiri::XML::SAX::PushParser # Create a new PushParser with +doc+ as the SAX Document, providing # an optional +file_name+ and +encoding+ # # @return [PushParser] a new instance of PushParser # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#35 def initialize(doc = T.unsafe(nil), file_name = T.unsafe(nil), encoding = T.unsafe(nil)); end # Write a +chunk+ of XML to the PushParser. Any callback methods # that can be called will be called immediately. # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#47 def <<(chunk, last_chunk = T.unsafe(nil)); end # The Nokogiri::XML::SAX::Document on which the PushParser will be # operating # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#30 def document; end # The Nokogiri::XML::SAX::Document on which the PushParser will be # operating # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#30 def document=(_arg0); end # Finish the parsing. This method is only necessary for # Nokogiri::XML::SAX::Document#end_document to be called. # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#55 def finish; end def options; end def options=(_arg0); end def replace_entities; end def replace_entities=(_arg0); end # Write a +chunk+ of XML to the PushParser. Any callback methods # that can be called will be called immediately. # # source://nokogiri//lib/nokogiri/xml/sax/push_parser.rb#47 def write(chunk, last_chunk = T.unsafe(nil)); end private def initialize_native(_arg0, _arg1); end def native_write(_arg0, _arg1); end end # Nokogiri::XML::Schema is used for validating XML against a schema # (usually from an xsd file). # # == Synopsis # # Validate an XML document against a Schema. Loop over the errors that # are returned and print them out: # # xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE)) # doc = Nokogiri::XML(File.read(PO_XML_FILE)) # # xsd.validate(doc).each do |error| # puts error.message # end # # The list of errors are Nokogiri::XML::SyntaxError objects. # # NOTE: As of v1.11.0, Schema treats inputs as UNTRUSTED by default, and so external entities # are not resolved from the network (`http://` or `ftp://`). Previously, parsing treated # documents as "trusted" by default which was counter to Nokogiri's "untrusted by default" # security policy. If a document is trusted, then the caller may turn off the NONET option via # the ParseOptions to re-enable external entity resolution over a network connection. # # source://nokogiri//lib/nokogiri/xml/schema.rb#37 class Nokogiri::XML::Schema # Errors while parsing the schema file # # source://nokogiri//lib/nokogiri/xml/schema.rb#39 def errors; end # Errors while parsing the schema file # # source://nokogiri//lib/nokogiri/xml/schema.rb#39 def errors=(_arg0); end # The Nokogiri::XML::ParseOptions used to parse the schema # # source://nokogiri//lib/nokogiri/xml/schema.rb#41 def parse_options; end # The Nokogiri::XML::ParseOptions used to parse the schema # # source://nokogiri//lib/nokogiri/xml/schema.rb#41 def parse_options=(_arg0); end # Returns true if +thing+ is a valid Nokogiri::XML::Document or # file. # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/schema.rb#68 def valid?(thing); end # Validate +thing+ against this schema. +thing+ can be a # Nokogiri::XML::Document object, or a filename. An Array of # Nokogiri::XML::SyntaxError objects found while validating the # +thing+ is returned. # # source://nokogiri//lib/nokogiri/xml/schema.rb#55 def validate(thing); end private def validate_document(_arg0); end def validate_file(_arg0); end class << self def from_document(*_arg0); end # Create a new Nokogiri::XML::Schema object using a +string_or_io+ # object. # # source://nokogiri//lib/nokogiri/xml/schema.rb#46 def new(string_or_io, options = T.unsafe(nil)); end def read_memory(*_arg0); end end end # The Searchable module declares the interface used for searching your DOM. # # It implements the public methods #search, #css, and #xpath, # as well as allowing specific implementations to specialize some # of the important behaviors. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#13 module Nokogiri::XML::Searchable # call-seq: # at(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]) # # Search this object for +paths+, and return only the first # result. +paths+ must be one or more XPath or CSS queries. # # See Searchable#search for more information. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#74 def %(*args); end # call-seq: # search(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]) # # Search this object for +paths+. +paths+ must be one or more XPath or CSS queries: # # node.search("div.employee", ".//title") # # A hash of namespace bindings may be appended: # # node.search('.//bike:tire', {'bike' => 'http://schwinn.com/'}) # node.search('bike|tire', {'bike' => 'http://schwinn.com/'}) # # For XPath queries, a hash of variable bindings may also be appended to the namespace # bindings. For example: # # node.search('.//address[@domestic=$value]', nil, {:value => 'Yes'}) # # 💡 Custom XPath functions and CSS pseudo-selectors may also be defined. To define custom # functions create a class and implement the function you want to define, which will be in the # `nokogiri` namespace in XPath queries. # # The first argument to the method will be the current matching NodeSet. Any other arguments # are ones that you pass in. Note that this class may appear anywhere in the argument # list. For example: # # handler = Class.new { # def regex node_set, regex # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ } # end # }.new # node.search('.//title[nokogiri:regex(., "\w+")]', 'div.employee:regex("[0-9]+")', handler) # # See Searchable#xpath and Searchable#css for further usage help. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#54 def /(*args); end # :call-seq: # >(selector) → NodeSet # # Search this node's immediate children using CSS selector +selector+ # # source://nokogiri//lib/nokogiri/xml/searchable.rb#201 def >(selector); end # call-seq: # at(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]) # # Search this object for +paths+, and return only the first # result. +paths+ must be one or more XPath or CSS queries. # # See Searchable#search for more information. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#74 def at(*args); end # call-seq: # at_css(*rules, [namespace-bindings, custom-pseudo-class]) # # Search this object for CSS +rules+, and return only the first # match. +rules+ must be one or more CSS selectors. # # See Searchable#css for more information. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#143 def at_css(*args); end # call-seq: # at_xpath(*paths, [namespace-bindings, variable-bindings, custom-handler-class]) # # Search this node for XPath +paths+, and return only the first # match. +paths+ must be one or more XPath queries. # # See Searchable#xpath for more information. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#193 def at_xpath(*args); end # call-seq: # css(*rules, [namespace-bindings, custom-pseudo-class]) # # Search this object for CSS +rules+. +rules+ must be one or more CSS # selectors. For example: # # node.css('title') # node.css('body h1.bold') # node.css('div + p.green', 'div#one') # # A hash of namespace bindings may be appended. For example: # # node.css('bike|tire', {'bike' => 'http://schwinn.com/'}) # # 💡 Custom CSS pseudo classes may also be defined which are mapped to a custom XPath # function. To define custom pseudo classes, create a class and implement the custom pseudo # class you want defined. The first argument to the method will be the matching context # NodeSet. Any other arguments are ones that you pass in. For example: # # handler = Class.new { # def regex(node_set, regex) # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ } # end # }.new # node.css('title:regex("\w+")', handler) # # 💡 Some XPath syntax is supported in CSS queries. For example, to query for an attribute: # # node.css('img > @href') # returns all +href+ attributes on an +img+ element # node.css('img / @href') # same # # # ⚠ this returns +class+ attributes from all +div+ elements AND THEIR CHILDREN! # node.css('div @class') # # node.css # # 💡 Array-like syntax is supported in CSS queries as an alternative to using +:nth-child()+. # # ⚠ NOTE that indices are 1-based like +:nth-child+ and not 0-based like Ruby Arrays. For # example: # # # equivalent to 'li:nth-child(2)' # node.css('li[2]') # retrieve the second li element in a list # # ⚠ NOTE that the CSS query string is case-sensitive with regards to your document type. HTML # tags will match only lowercase CSS queries, so if you search for "H1" in an HTML document, # you'll never find anything. However, "H1" might be found in an XML document, where tags # names are case-sensitive (e.g., "H1" is distinct from "h1"). # # source://nokogiri//lib/nokogiri/xml/searchable.rb#129 def css(*args); end # call-seq: # search(*paths, [namespace-bindings, xpath-variable-bindings, custom-handler-class]) # # Search this object for +paths+. +paths+ must be one or more XPath or CSS queries: # # node.search("div.employee", ".//title") # # A hash of namespace bindings may be appended: # # node.search('.//bike:tire', {'bike' => 'http://schwinn.com/'}) # node.search('bike|tire', {'bike' => 'http://schwinn.com/'}) # # For XPath queries, a hash of variable bindings may also be appended to the namespace # bindings. For example: # # node.search('.//address[@domestic=$value]', nil, {:value => 'Yes'}) # # 💡 Custom XPath functions and CSS pseudo-selectors may also be defined. To define custom # functions create a class and implement the function you want to define, which will be in the # `nokogiri` namespace in XPath queries. # # The first argument to the method will be the current matching NodeSet. Any other arguments # are ones that you pass in. Note that this class may appear anywhere in the argument # list. For example: # # handler = Class.new { # def regex node_set, regex # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ } # end # }.new # node.search('.//title[nokogiri:regex(., "\w+")]', 'div.employee:regex("[0-9]+")', handler) # # See Searchable#xpath and Searchable#css for further usage help. # # source://nokogiri//lib/nokogiri/xml/searchable.rb#54 def search(*args); end # call-seq: # xpath(*paths, [namespace-bindings, variable-bindings, custom-handler-class]) # # Search this node for XPath +paths+. +paths+ must be one or more XPath # queries. # # node.xpath('.//title') # # A hash of namespace bindings may be appended. For example: # # node.xpath('.//foo:name', {'foo' => 'http://example.org/'}) # node.xpath('.//xmlns:name', node.root.namespaces) # # A hash of variable bindings may also be appended to the namespace bindings. For example: # # node.xpath('.//address[@domestic=$value]', nil, {:value => 'Yes'}) # # 💡 Custom XPath functions may also be defined. To define custom functions create a class and # implement the function you want to define, which will be in the `nokogiri` namespace. # # The first argument to the method will be the current matching NodeSet. Any other arguments # are ones that you pass in. Note that this class may appear anywhere in the argument # list. For example: # # handler = Class.new { # def regex(node_set, regex) # node_set.find_all { |node| node['some_attribute'] =~ /#{regex}/ } # end # }.new # node.xpath('.//title[nokogiri:regex(., "\w+")]', handler) # # source://nokogiri//lib/nokogiri/xml/searchable.rb#179 def xpath(*args); end private # source://nokogiri//lib/nokogiri/xml/searchable.rb#210 def css_internal(node, rules, handler, ns); end # source://nokogiri//lib/nokogiri/xml/searchable.rb#241 def css_rules_to_xpath(rules, ns); end # source://nokogiri//lib/nokogiri/xml/searchable.rb#259 def extract_params(params); end # source://nokogiri//lib/nokogiri/xml/searchable.rb#229 def xpath_impl(node, path, handler, ns, binds); end # source://nokogiri//lib/nokogiri/xml/searchable.rb#214 def xpath_internal(node, paths, handler, ns, binds); end # source://nokogiri//lib/nokogiri/xml/searchable.rb#245 def xpath_query_from_css_rule(rule, ns); end end # Regular expression used by Searchable#search to determine if a query # string is CSS or XPath # # source://nokogiri//lib/nokogiri/xml/searchable.rb#16 Nokogiri::XML::Searchable::LOOKS_LIKE_XPATH = T.let(T.unsafe(nil), Regexp) # This class provides information about XML SyntaxErrors. These # exceptions are typically stored on Nokogiri::XML::Document#errors. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#8 class Nokogiri::XML::SyntaxError < ::Nokogiri::SyntaxError # Returns the value of attribute code. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#10 def code; end # Returns the value of attribute column. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#18 def column; end # Returns the value of attribute domain. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#9 def domain; end # return true if this is an error # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#34 def error?; end # return true if this error is fatal # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#40 def fatal?; end # Returns the value of attribute file. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#12 def file; end # Returns the value of attribute int1. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#17 def int1; end # Returns the value of attribute level. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#11 def level; end # Returns the value of attribute line. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#13 def line; end # return true if this is a non error # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#22 def none?; end # Returns the value of attribute str1. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#14 def str1; end # Returns the value of attribute str2. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#15 def str2; end # Returns the value of attribute str3. # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#16 def str3; end # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#44 def to_s; end # return true if this is a warning # # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#28 def warning?; end private # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#53 def level_to_s; end # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#65 def location_to_s; end # @return [Boolean] # # source://nokogiri//lib/nokogiri/xml/syntax_error.rb#61 def nil_or_zero?(attribute); end end # source://nokogiri//lib/nokogiri/xml/text.rb#5 class Nokogiri::XML::Text < ::Nokogiri::XML::CharacterData # source://nokogiri//lib/nokogiri/xml/text.rb#6 def content=(string); end class << self def new(*_arg0); end end end # Original C14N 1.0 spec canonicalization # # source://nokogiri//lib/nokogiri/xml.rb#14 Nokogiri::XML::XML_C14N_1_0 = T.let(T.unsafe(nil), Integer) # C14N 1.1 spec canonicalization # # source://nokogiri//lib/nokogiri/xml.rb#18 Nokogiri::XML::XML_C14N_1_1 = T.let(T.unsafe(nil), Integer) # Exclusive C14N 1.0 spec canonicalization # # source://nokogiri//lib/nokogiri/xml.rb#16 Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0 = T.let(T.unsafe(nil), Integer) # source://nokogiri//lib/nokogiri/xml/xpath.rb#5 module Nokogiri::XML::XPath; end # The XPath search prefix to search direct descendants of the current element, +./+ # # source://nokogiri//lib/nokogiri/xml/xpath.rb#13 Nokogiri::XML::XPath::CURRENT_SEARCH_PREFIX = T.let(T.unsafe(nil), String) # The XPath search prefix to search globally, +//+ # # source://nokogiri//lib/nokogiri/xml/xpath.rb#7 Nokogiri::XML::XPath::GLOBAL_SEARCH_PREFIX = T.let(T.unsafe(nil), String) # The XPath search prefix to search direct descendants of the root element, +/+ # # source://nokogiri//lib/nokogiri/xml/xpath.rb#10 Nokogiri::XML::XPath::ROOT_SEARCH_PREFIX = T.let(T.unsafe(nil), String) # The XPath search prefix to search anywhere in the current element's subtree, +.//+ # # source://nokogiri//lib/nokogiri/xml/xpath.rb#16 Nokogiri::XML::XPath::SUBTREE_SEARCH_PREFIX = T.let(T.unsafe(nil), String) # source://nokogiri//lib/nokogiri/xml/xpath/syntax_error.rb#6 class Nokogiri::XML::XPath::SyntaxError < ::Nokogiri::XML::SyntaxError # source://nokogiri//lib/nokogiri/xml/xpath/syntax_error.rb#7 def to_s; end end # source://nokogiri//lib/nokogiri/xml/xpath_context.rb#5 class Nokogiri::XML::XPathContext def evaluate(*_arg0); end # Register namespaces in +namespaces+ # # source://nokogiri//lib/nokogiri/xml/xpath_context.rb#8 def register_namespaces(namespaces); end def register_ns(_arg0, _arg1); end def register_variable(_arg0, _arg1); end class << self def new(_arg0); end end end # See Nokogiri::XSLT::Stylesheet for creating and manipulating # Stylesheet object. # # source://nokogiri//lib/nokogiri/xslt.rb#21 module Nokogiri::XSLT class << self # :call-seq: # parse(xsl) → Nokogiri::XSLT::Stylesheet # parse(xsl, modules) → Nokogiri::XSLT::Stylesheet # # Parse the stylesheet in +xsl+, registering optional +modules+ as custom class handlers. # # [Parameters] # - +xsl+ (String) XSL content to be parsed into a stylesheet # - +modules+ (Hash) A hash of URI-to-handler relations for linking a # namespace to a custom function handler. # # ⚠ The XSLT handler classes are registered *globally*. # # Also see Nokogiri::XSLT.register # # *Example* # # xml = Nokogiri.XML(<<~XML) # # Foo # Bar # # XML # # handler = Class.new do # def reverse(node) # node.text.reverse # end # end # # xsl = <<~XSL # # # # # # # # # # XSL # # xsl = Nokogiri.XSLT(xsl, "http://nokogiri.org/xslt/myfuncs" => handler) # xsl.transform(xml).to_xml # # => "\n" + # # "\n" + # # " ooF\n" + # # " raB\n" + # # "\n" # # source://nokogiri//lib/nokogiri/xslt.rb#76 def parse(string, modules = T.unsafe(nil)); end # :call-seq: # quote_params(params) → Array # # Quote parameters in +params+ for stylesheet safety. # See Nokogiri::XSLT::Stylesheet.transform for example usage. # # [Parameters] # - +params+ (Hash, Array) XSLT parameters (key->value, or tuples of [key, value]) # # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform # # source://nokogiri//lib/nokogiri/xslt.rb#100 def quote_params(params); end def register(_arg0, _arg1); end end end # A Stylesheet represents an XSLT Stylesheet object. Stylesheet creation # is done through Nokogiri.XSLT. Here is an example of transforming # an XML::Document with a Stylesheet: # # doc = Nokogiri::XML(File.read('some_file.xml')) # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt')) # # puts xslt.transform(doc) # # See Nokogiri::XSLT::Stylesheet#transform for more transformation # information. # # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#17 class Nokogiri::XSLT::Stylesheet # Apply an XSLT stylesheet to an XML::Document. # +params+ is an array of strings used as XSLT parameters. # returns serialized document # # source://nokogiri//lib/nokogiri/xslt/stylesheet.rb#22 def apply_to(document, params = T.unsafe(nil)); end def serialize(_arg0); end def transform(*_arg0); end class << self def parse_stylesheet_doc(_arg0); end end end class Object < ::BasicObject include ::Kernel include ::PP::ObjectMixin private # source://nokogiri//lib/nokogiri.rb#108 def Nokogiri(*args, &block); end end