def to_rxf_node(object , level)
      if is_value?(object)
        return SimpleNode.new(object.to_rxf())
      end
      occurence = @members.objects[object.object_id]
      raise "no object #{object}" unless occurence
      #puts "#{level} ? #{occurence.level} : ref #{occurence.referenced}"
      if( occurence.referenced )
        #puts "ref #{occurence.referenced} level #{level} at #{occurence.level}"
        return SimpleNode.new("->#{occurence.referenced}") unless (level == occurence.level )
        if( occurence.written.nil? )
          occurence.written = true
        else
          return SimpleNode.new("->#{occurence.referenced}")
        end
      end

      ref = occurence.referenced
      case object.class.name
      when "Array" , "Parfait::List"
        # If a class defines to_rxf_node it tells the write that it will generate Nodes itself
        # this delegates to array_to_rxf_node
        array_to_rxf_node(object , level , ref )
      when "Hash" , "Parfait::Dictionary"
        # and hash keys/values
        hash_to_rxf_node( object , level , ref)
      else
        object_to_rxf_node(object , level , ref)
      end

    end
def to_rxf_node(object , level)
      if is_value?(object)
        return SimpleNode.new(object.to_rxf())
      end
      occurence = @members.objects[object.object_id]
      raise "no object #{object}" unless occurence
      #puts "#{level} ? #{occurence.level} : ref #{occurence.referenced}"
      if( occurence.referenced )
        #puts "ref #{occurence.referenced} level #{level} at #{occurence.level}"
        return SimpleNode.new("->#{occurence.referenced}") unless (level == occurence.level )
        if( occurence.written.nil? )
          occurence.written = true
        else
          return SimpleNode.new("->#{occurence.referenced}")
        end
      end

      ref = occurence.referenced
      case object.class.name
      when "Array" , "Parfait::List"
        # If a class defines to_rxf_node it tells the write that it will generate Nodes itself
        # this delegates to array_to_rxf_node
        array_to_rxf_node(object , level , ref )
      when "Hash" , "Parfait::Dictionary"
        # and hash keys/values
        hash_to_rxf_node( object , level , ref)
      else
        object_to_rxf_node(object , level , ref)
      end

    end
create a Node (subclass) for an object at a given level.
 Level is mainly needed for the indenting
 from the object we get the Occurence and decide wether a reference node is needed
 simple objects (with more inner structure) become SimpleNodes
 Any structured object becomes a ObjectNode
 Hash and Array create their own nodes via  to_rxf_node functions on the classes