Module: LibXML::Conversions::Node
- Defined in:
- lib/active_support/xml_mini/libxml.rb
Constant Summary collapse
- CONTENT_ROOT =
'__content__'
- LIB_XML_LIMIT =
Hardcoded LibXML limit
30000000
Instance Method Summary collapse
-
#to_hash(hash = {}) ⇒ Object
Convert XML document to hash.
Instance Method Details
#to_hash(hash = {}) ⇒ Object
Convert XML document to hash
- hash
-
Hash to merge the converted element into.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/active_support/xml_mini/libxml.rb', line 40 def to_hash(hash={}) if text? raise LibXML::XML::Error if content.length >= LIB_XML_LIMIT hash[CONTENT_ROOT] = content else sub_hash = insert_name_into_hash(hash, name) attributes_to_hash(sub_hash) if array? children_array_to_hash(sub_hash) elsif yaml? children_yaml_to_hash(sub_hash) else children_to_hash(sub_hash) end end hash end |