Class: XmlSimple

Class | XmlSimple
In: | lib/xmlsimple.rb
Parent: | Object

Easy API to maintain XML (especially configuration files).

### Methods

new xml_in xml_in xml_out xml_out

### Included Modules

REXML

### Classes and Modules

Class XmlSimple::Cache

### Constants

KNOWN_OPTIONS | = | { 'in' => %w( keyattr keeproot forcecontent contentkey noattr searchpath forcearray suppressempty anonymoustag cache grouptags normalisespace normalizespace variables varattr keytosymbol ), 'out' => %w( keyattr keeproot contentkey noattr rootname xmldeclaration outputfile noescape suppressempty anonymoustag indent grouptags noindent ) |  | Declare options that are valid for xml_in and xml_out.
DEF_KEY_ATTRIBUTES | = | [] |  | Define some reasonable defaults.
DEF_ROOT_NAME | = | 'opt'
DEF_CONTENT_KEY | = | 'content'
DEF_XML_DECLARATION | = | "<?xml version='1.0' standalone='yes'?>"
DEF_ANONYMOUS_TAG | = | 'anon'
DEF_FORCE_ARRAY | = | true
DEF_INDENTATION | = | ' '
DEF_KEY_TO_SYMBOL | = | false

### Public Class methods

new(defaults = nil)

Creates and intializes a new XmlSimple object.

defaults: | Default values for options.

xml_in(string = nil, options = nil)

This is the functional version of the instance method xml_in.

xml_out(hash, options = nil)

This is the functional version of the instance method xml_out.

### Public Instance methods

xml_in(string = nil, options = nil)

Converts an XML document in the same way as the Perl module XML::Simple.

string: | XML source. Could be one of the following: nil: Tries to load and parse ’<scriptname>.xml’. filename: Tries to load and parse filename. IO object: Reads from object until EOF is detected and parses result. XML string: Parses string.
options: | Options to be used.

xml_out(ref, options = nil)

Converts a data structure into an XML document.

ref: | Reference to data structure to be converted into XML.
options: | Options to be used.

[Validate]