Class

XmlSimple

Extends:

Includes:

Locked down XmlSimple#xml_in_string

From active_support/vendor/xml-simple-1.0.11/xmlsimple.rb

Easy API to maintain XML (especially configuration files).

Classes
Cache A simple cache for XML documents that were already transformed by xml_in.
Constants
DEF_ANONYMOUS_TAG
DEF_CONTENT_KEY
DEF_FORCE_ARRAY
DEF_INDENTATION
DEF_KEY_ATTRIBUTES Define some reasonable defaults.
DEF_KEY_TO_SYMBOL
DEF_ROOT_NAME
DEF_XML_DECLARATION
KNOWN_OPTIONS Declare options that are valid for xml_in and xml_out.
Public Methods
new Creates and intializes a new XmlSimple object.
xml_in Converts an XML document in the same way as the Perl module XML::Simple.
xml_in This is the functional version of the instance method xml_in.
xml_in_string
xml_in_string Same as xml_in but doesn’t try to smartly shoot itself in the foot.
xml_out This is the functional version of the instance method xml_out.
xml_out Converts a data structure into an XML document.
Private Methods
collapse Actually converts an XML document element into a data structure.
collapse_content Tries to collapse a Hash even more ;-)
collapse_text_node Collapses a text node and merges it with an existing Hash, if possible. Thanks to Curtis Schofield for reporting a subtle bug.
empty Checks, if an object is nil, an empty String or an empty Hash. Thanks to Norbert Gawor for a bugfix.
escape_value Replaces XML markup characters by their external entities.
find_xml_file Searches in a list of paths for a certain file. Returns the full path to the file, if it could be found. Otherwise, an exception will be raised.
fold_array Folds an Array to a Hash, if possible. Folding happens according to the content of keyattr, which has to be an array.
fold_array_by_name Folds an Array to a Hash, if possible. Folding happens according to the content of keyattr, which has to be a Hash.
fold_arrays Folds all arrays in a Hash.
force_array? Checks, if the ‘forcearray’ option has to be used for a certain key.
get_attributes Converts the attributes array of a document node into a Hash. Returns an empty Hash, if node has no attributes.
get_var Called during variable substitution to get the value for the named variable.
handle_options Merges a set of options with the default options.
has_mixed_content? Determines, if a document element has mixed content.
hash_to_array Attempts to unfold a hash of hashes into an array of hashes. Returns a reference to th array on success or the original hash, if unfolding is not possible.
load_xml_file Loads and parses an XML configuration file.
merge Adds a new key/value pair to an existing Hash. If the key to be added does already exist and the existing value associated with key is not an Array, it will be converted into an Array. Then the new value is appended to that Array.
node_to_text Converts a document node into a String. If the node could not be converted into a String for any reason, default will be returned.
normalise_space Removes leading and trailing whitespace and sequences of whitespaces from a string.
normalize_option_names Normalizes option names in a hash, i.e., turns all characters to lower case and removes all underscores. Additionally, this method checks, if an unknown option was used and raises an according exception.
parse Parses an XML string and returns the according document.
put_into_cache Caches the data belonging to a certain file.
scalar Checks, if a certain value is a "scalar" value. Whatever that will be in Ruby … ;-)
set_var Called when a variable definition is encountered in the XML. A variable definition looks like
value_to_xml Recurses through a data structure building up and returning an XML representation of that structure as a string.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.