Class: XMLObject::Adapters::REXML::Element

Inherits:
Base::Element show all
Defined in:
lib/xml-object/adapters/rexml.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Base::Element

#attributes, #children, #name, #raw, #value

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Element

Returns a new instance of Element.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/xml-object/adapters/rexml.rb', line 20

def initialize(xml)
  @raw, @name, @attributes = xml, xml.name, xml.attributes

  @element_nodes = xml.elements

  @text_nodes = xml.children.select do |child|
    child.class == ::REXML::Text
  end.map! { |child| child.to_s }

  @cdata_nodes = xml.children.select do |child|
    child.class == ::REXML::CData
  end.map! { |child| child.to_s }

  super
end