Exception: MultiXml::DisallowedTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/multi_xml/errors.rb

Overview

Raised when an XML type attribute is in the disallowed list

By default, 'yaml' and 'symbol' types are disallowed for security reasons.

Examples:

Catching a disallowed type error

begin
  MultiXml.parse('<data type="yaml">--- :key</data>')
rescue MultiXml::DisallowedTypeError => e
  puts e.type #=> "yaml"
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ DisallowedTypeError

Create a new DisallowedTypeError

Examples:

Create a disallowed type error

DisallowedTypeError.new("yaml")

Parameters:

  • type (String)

    The disallowed type attribute value



88
89
90
91
# File 'lib/multi_xml/errors.rb', line 88

def initialize(type)
  @type = type
  super("Disallowed type attribute: #{type.inspect}")
end

Instance Attribute Details

#typeString (readonly)

The disallowed type that was encountered

Examples:

Access the disallowed type

error.type #=> "yaml"

Returns:

  • (String)

    the type attribute value that was disallowed



79
80
81
# File 'lib/multi_xml/errors.rb', line 79

def type
  @type
end