Module: ActiveSupport::XmlMini_JDOM
Overview
:nodoc:
Constant Summary collapse
- CONTENT_KEY =
'__content__'.freeze
- NODE_TYPE_NAMES =
%w{ATTRIBUTE_NODE CDATA_SECTION_NODE COMMENT_NODE DOCUMENT_FRAGMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE ELEMENT_NODE ENTITY_NODE ENTITY_REFERENCE_NODE NOTATION_NODE PROCESSING_INSTRUCTION_NODE TEXT_NODE}
Instance Method Summary collapse
-
#parse(string) ⇒ Object
Parse an XML Document string into a simple hash using Java’s jdom.
Instance Method Details
#parse(string) ⇒ Object
Parse an XML Document string into a simple hash using Java’s jdom.
- string
-
XML Document string to parse
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/active_support/xml_mini/jdom.rb', line 30 def parse(string) if string.blank? {} else @dbf = DocumentBuilderFactory.new_instance xml_string_reader = StringReader.new(string) xml_input_source = InputSource.new(xml_string_reader) doc = @dbf.new_document_builder.parse(xml_input_source) merge_element!({}, doc.document_element) end end |