Each MultiXml parser is expected to parse an XML document into a Hash. The conversion rules are:
VERSION | = | "0.4.1" |
REQUIREMENT_MAP | = | [ ['libxml', :libxml], ['nokogiri', :nokogiri], ['ox', :ox], ['rexml/document', :rexml] |
CONTENT_ROOT | = | '__content__'.freeze unless defined?(CONTENT_ROOT) |
PARSING | = | { 'symbol' => Proc.new{|symbol| symbol.to_sym}, 'date' => Proc.new{|date| Date.parse(date)}, 'datetime' => Proc.new{|time| Time.parse(time).utc rescue DateTime.parse(time).utc}, 'integer' => Proc.new{|integer| integer.to_i}, 'float' => Proc.new{|float| float.to_f}, 'decimal' => Proc.new{|number| BigDecimal(number)}, 'boolean' => Proc.new{|boolean| !%w(0 false).include?(boolean.strip)}, 'string' => Proc.new{|string| string.to_s}, 'yaml' => Proc.new{|yaml| YAML::load(yaml) rescue yaml}, 'base64Binary' => Proc.new{|binary| binary.unpack('m').first}, 'binary' => Proc.new{|binary, entity| parse_binary(binary, entity)}, 'file' => Proc.new{|file, entity| parse_file(file, entity)} |
The default parser based on what you currently have loaded and installed. First checks to see if any parsers are already loaded, then checks to see which are installed if none are loaded.
Parse an XML string or IO into Ruby.
Options
:symbolize_keys : | If true, will use symbols instead of strings for the keys. |
Set the XML parser utilizing a symbol, string, or class. Supported by default are: