Exception: Nokogiri::XML::SyntaxError

Inherits:
SyntaxError
  • Object
show all
Defined in:
lib/nokogiri/xml/syntax_error.rb,
ext/nokogiri/xml_syntax_error.c

Overview

This class provides information about XML SyntaxErrors. These exceptions are typically stored on Nokogiri::XML::Document#errors.

Direct Known Subclasses

XPath::SyntaxError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



8
9
10
# File 'lib/nokogiri/xml/syntax_error.rb', line 8

def code
  @code
end

#columnObject (readonly)

Returns the value of attribute column



16
17
18
# File 'lib/nokogiri/xml/syntax_error.rb', line 16

def column
  @column
end

#domainObject (readonly)

Returns the value of attribute domain



7
8
9
# File 'lib/nokogiri/xml/syntax_error.rb', line 7

def domain
  @domain
end

#fileObject (readonly)

Returns the value of attribute file



10
11
12
# File 'lib/nokogiri/xml/syntax_error.rb', line 10

def file
  @file
end

#int1Object (readonly)

Returns the value of attribute int1



15
16
17
# File 'lib/nokogiri/xml/syntax_error.rb', line 15

def int1
  @int1
end

#levelObject (readonly)

Returns the value of attribute level



9
10
11
# File 'lib/nokogiri/xml/syntax_error.rb', line 9

def level
  @level
end

#lineObject (readonly)

Returns the value of attribute line



11
12
13
# File 'lib/nokogiri/xml/syntax_error.rb', line 11

def line
  @line
end

#str1Object (readonly)

Returns the value of attribute str1



12
13
14
# File 'lib/nokogiri/xml/syntax_error.rb', line 12

def str1
  @str1
end

#str2Object (readonly)

Returns the value of attribute str2



13
14
15
# File 'lib/nokogiri/xml/syntax_error.rb', line 13

def str2
  @str2
end

#str3Object (readonly)

Returns the value of attribute str3



14
15
16
# File 'lib/nokogiri/xml/syntax_error.rb', line 14

def str3
  @str3
end

Instance Method Details

#error?Boolean

return true if this is an error

Returns:

  • (Boolean)


32
33
34
# File 'lib/nokogiri/xml/syntax_error.rb', line 32

def error?
  level == 2
end

#fatal?Boolean

return true if this error is fatal

Returns:

  • (Boolean)


38
39
40
# File 'lib/nokogiri/xml/syntax_error.rb', line 38

def fatal?
  level == 3
end

#none?Boolean

return true if this is a non error

Returns:

  • (Boolean)


20
21
22
# File 'lib/nokogiri/xml/syntax_error.rb', line 20

def none?
  level == 0
end

#to_sObject



42
43
44
45
46
47
# File 'lib/nokogiri/xml/syntax_error.rb', line 42

def to_s
  message = super.chomp
  [location_to_s, level_to_s, message].
    compact.join(": ").
    force_encoding(message.encoding)
end

#warning?Boolean

return true if this is a warning

Returns:

  • (Boolean)


26
27
28
# File 'lib/nokogiri/xml/syntax_error.rb', line 26

def warning?
  level == 1
end