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
code[R]
column[R]
domain[R]
file[R]
int1[R]
level[R]
line[R]
path[R]
The XPath
path of the node that caused the error when validating a ‘Nokogiri::XML::Document`.
This attribute will only be non-nil when the error is emitted by ‘Schema#validate` on Document
objects. It will return `nil` for DOM parsing errors and for errors emitted during Schema
validation of files.
⚠ ‘#path` is not supported on JRuby, where it will always return `nil`.
str1[R]
str2[R]
str3[R]
Public Class Methods
aggregate(errors)
click to toggle source
# File lib/nokogiri/xml/syntax_error.rb, line 10 def aggregate(errors) return nil if errors.empty? return errors.first if errors.length == 1 messages = ["Multiple errors encountered:"] errors.each do |error| messages << error.to_s end new(messages.join("\n")) end
Public Instance Methods
error?()
click to toggle source
return true if this is an error
# File lib/nokogiri/xml/syntax_error.rb, line 56 def error? level == 2 end
fatal?()
click to toggle source
return true if this error is fatal
# File lib/nokogiri/xml/syntax_error.rb, line 62 def fatal? level == 3 end
none?()
click to toggle source
return true if this is a non error
# File lib/nokogiri/xml/syntax_error.rb, line 44 def none? level == 0 end
to_s()
click to toggle source
Calls superclass method
# File lib/nokogiri/xml/syntax_error.rb, line 66 def to_s message = super.chomp [location_to_s, level_to_s, message] .compact.join(": ") .force_encoding(message.encoding) end
warning?()
click to toggle source
return true if this is a warning
# File lib/nokogiri/xml/syntax_error.rb, line 50 def warning? level == 1 end