Top Level Namespace

Defined Under Namespace

Classes: CampaignMonitor

Constant Summary collapse

PARSER =

If libxml is installed, we use the FasterXmlSimple library, that provides most of the functionality of XmlSimple except it uses the xml/libxml library for xml parsing (rather than REXML). If libxml isn’t installed, we just fall back on XmlSimple.

begin
  require 'xml/libxml'
  # Older version of libxml aren't stable (bus error when requesting attributes that don't exist) so we
  # have to use a version greater than '0.3.8.2'.
  raise LoadError unless XML::Parser::VERSION > '0.3.8.2'
  $:.push(File.join(File.dirname(__FILE__), '..', 'support', 'faster-xml-simple', 'lib'))
  require 'faster_xml_simple' 
  p 'Using libxml-ruby'
  FasterXmlSimple
rescue LoadError
  begin
    require 'rexml-expansion-fix'
  rescue LoadError => e
    p 'Cannot load rexml security patch'
  end
  XmlSimple
end