class Nokogiri::XML::ParseOptions

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/nokogiri/xml/parse_options.rbs

class Nokogiri::XML::ParseOptions
  def initialize: (?Integer options) -> void
end


doc = Nokogiri::XML::Document.parse(xml, nil, nil, po)
po = Nokogiri::XML::ParseOptions.new(Nokogiri::XML::ParseOptions::HUGE | Nokogiri::XML::ParseOptions::PEDANTIC)
combinations. They are bits in a bitmask, and so can be combined with bitwise operators:
You can also use the constants declared under Nokogiri::XML::ParseOptions to set various
[ParseOptions constants]
doc = Nokogiri::XML::Document.parse(xml) { |config| config.huge.pedantic }
recommend chaining the setter methods:
Most parsing methods will accept a block for configuration of parse options, and we
[Using Ruby Blocks]
features.
💡 Note that negation is not available for STRICT, which is itself a negation of all other
po.nonocdata # Unset the NOCDATA parse option
po.nocdata # Set the NOCDATA parse option
double negative:
💡 Note that some options begin with “no” leading to the logical but perhaps unintuitive
po.nopedantic # Unset the PEDANTIC option
po.nohuge # Unset the HUGE option
# later we want to modify the options
po = Nokogiri::XML::ParseOptions.new.huge.pedantic
# Set the HUGE & PEDANTIC options
methods on an instance of ParseOptions to unset the option.
Every option has an equivalent no{option} method in lowercase. You can call these
doc = Nokogiri::XML::Document.parse(xml, nil, nil, po)
po = Nokogiri::XML::ParseOptions.new.huge.pedantic
# Set the HUGE & PEDANTIC options
set various combinations.
Every option has an equivalent method in lowercase. You can chain these methods together to
[ParseOptions method chaining]
You can build your own combinations of parse options by using any of the following methods:
== Setting and unsetting parse options
behavior in Xerces/NekoHTML on JRuby when it’s possible.
⚠ Not all parse options are supported on JRuby. Nokogiri will attempt to invoke the equivalent
HTML5 specification. See Nokogiri::HTML5.
💡 Note that HTML5 parsing has a separate, orthogonal set of options due to the nature of the
an option is “on” or “off”.
These options directly expose libxml2’s parse options, which are all boolean in the sense that
HTML4::Document, HTML4::DocumentFragment, XSLT::Stylesheet, and XML::Schema.
Options that control the parsing behavior for XML::Document, XML::DocumentFragment,

def ==(other)

def ==(other)
  other.to_i == to_i
end

def initialize(options = STRICT)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (?Integer options) -> void

This signature was generated using 4 samples from 3 applications.

def initialize(options = STRICT)
  @options = options
end

def inspect

def inspect
  options = []
  self.class.constants.each do |k|
    options << k.downcase if send(:"#{k.downcase}?")
  end
  super.sub(/>$/, " " + options.join(", ") + ">")
end

def strict

def strict
  @options &= ~RECOVER
  self
end

def strict?

def strict?
  @options & RECOVER == STRICT
end