# File lib/html/xpath.rb, line 30
    def as_rexml_document(rparent = nil, context = {})
      return @_rexml_tree if @_rexml_tree
      node = REXML::Element.new( tag, rparent, context )
      attribute_order().each { |attr|
        node.add_attribute(attr, attribute(attr).to_s)
      }
      children().each { |child|
        childNode = child.as_rexml_document(node, context)
      }
      @_rexml_tree = node
    end