class Nokogiri::XML::SyntaxError
The XML::SyntaxError
is raised on parse errors
This class provides information about XML
SyntaxErrors. These exceptions are typically stored on Nokogiri::XML::Document#errors
.
Attributes
Public Instance Methods
Source
# File lib/nokogiri/xml/syntax_error.rb, line 34 def error? level == 2 end
return true if this is an error
Source
# File lib/nokogiri/xml/syntax_error.rb, line 40 def fatal? level == 3 end
return true if this error is fatal
Source
# File lib/nokogiri/xml/syntax_error.rb, line 22 def none? level == 0 end
return true if this is a non error
Source
# File lib/nokogiri/xml/syntax_error.rb, line 44 def to_s message = super.chomp [location_to_s, level_to_s, message] .compact.join(": ") .force_encoding(message.encoding) end
Calls superclass method
Source
# File lib/nokogiri/xml/syntax_error.rb, line 28 def warning? level == 1 end
return true if this is a warning
Private Instance Methods
Source
# File lib/nokogiri/xml/syntax_error.rb, line 53 def level_to_s case level when 3 then "FATAL" when 2 then "ERROR" when 1 then "WARNING" end end
Source
# File lib/nokogiri/xml/syntax_error.rb, line 65 def location_to_s return if nil_or_zero?(line) && nil_or_zero?(column) "#{line}:#{column}" end
Source
# File lib/nokogiri/xml/syntax_error.rb, line 61 def nil_or_zero?(attribute) attribute.nil? || attribute.zero? end