class Nokogiri::XML::ParseOptions


options.nonoent # Removes the Nokogiri::XML::ParseOptions::NOENT option
options.norecover # Removes the Nokogiri::XML::ParseOptions::RECOVER option
# later…
options = Nokogiri::XML::ParseOptions.new.recover.noent
# Setting the RECOVER & NOENT options…
Note that this is not available for STRICT.
Every option has an equivalent no{option} method in lowercase. You can call these methods on an instance of ParseOptions to remove the option.
You can also remove options from an instance of ParseOptions dynamically.
== Removing particular parse options
Nokogiri.XML(‘<content>Chapter 1</content’) {|config| config.recover.noent}
[Using Ruby Blocks] You can also setup parse combinations in the block passed to Nokogiri.XML or Nokogiri.HTML
Nokogiri.XML(‘<content>Chapter 1</content’, nil, nil, Nokogiri::XML::ParseOptions.new.recover.noent)
[Method chaining] Every option has an equivalent method in lowercase. You can chain these methods together to set various combinations.
Nokogiri.XML(‘<content>Chapter 1</content’, nil, nil, Nokogiri::XML::ParseOptions.new((1 << 0) | (1 << 1)))
[Ruby’s bitwise operators] You can use the Ruby bitwise operators to set various combinations.
Note: All examples attempt to set the RECOVER & NOENT options.
You can build your own combinations of these parse options by using any of the following methods:
== Building combinations of parse options
Parse options for passing to Nokogiri.XML or Nokogiri.HTML
##

def ==(other)

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

def initialize(options = STRICT)

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