module ActiveSupport::XmlMini_JDOM

def empty_content?(element)

XML element to be checked.
element::

Determines if a document element has text content
def empty_content?(element)
  text = +""
  child_nodes = element.child_nodes
  (0...child_nodes.length).each do |i|
    item = child_nodes.item(i)
    if item.node_type == Node.TEXT_NODE
      text << item.get_data.strip
    end
  end
  text.strip.length == 0
end