from_xml (ToHashParser)

    # File lib/extlib/hash.rb, line 418
      def self.from_xml(xml)
        stack = []
        parser = REXML::Parsers::BaseParser.new(xml)

        while true
          event = parser.pull
          case event[0]
          when :end_document
            break
          when :end_doctype, :start_doctype
            # do nothing
          when :start_element
            stack.push REXMLUtilityNode.new(event[1], event[2])
          when :end_element
            if stack.size > 1
              temp = stack.pop
              stack.last.add_node(temp)
            end
          when :text, :cdata
            stack.last.add_node(event[1]) unless event[1].strip.length == 0
          end
        end
        stack.pop.to_hash
      end