anchor.diff:                        [H|_]= tuple_to_list(Result),
                         true = is_atom(H),
                         false = is_label(H),
  +                      [Tag] = dict:fetch(H, RecNames),
                         XMLNSAttrs = erl_syntax:list(
                                        [erl_syntax:tuple(
                                           [abstract(<<"xmlns">>),
  
positive.code:           Clauses ++ [NilClause])])].
  
  make_top_encoders(TaggedSpecs) ->
      Clauses =
          lists:flatmap(
            fun({Tag, #elem{name = Name, xmlns = XMLNS, result = Result}}) ->
  
negative.code:         true = is_atom(RecordName),
          false = is_label(RecordName),
          true = lists:all(fun is_label/1, RecordFields),
          [{RecordName,
            erl_syntax:attribute(
              erl_syntax:atom("record"),
              [erl_syntax:atom(atom_to_list(RecordName)),
               erl_syntax:tuple(
                 lists:map(
                   fun(Label) ->
                           Field = label_to_record_field(Label),
                           case get_spec_by_label(Label, Elem) of
                               #ref{default = Default,
                                    min = 0, max = 1}
                                 when Default /= undefined ->
                                   erl_syntax:match_expr(
                                     Field,
                                     erl_syntax:abstract(Default));
                               #ref{max = Max} when Max > 1 ->
                                   erl_syntax:match_expr(
                                     Field,
                                     erl_syntax:abstract([]));
                               #attr{default = Default}
                                 when Default /= undefined ->
                                   erl_syntax:match_expr(
                                     Field,
                                     erl_syntax:abstract(Default));
                               #cdata{default = Default}
                                 when Default /= undefined ->
                                   erl_syntax:match_expr(
                                     Field,
                                     erl_syntax:abstract(Default));
                               sub_els ->
                                   erl_syntax:match_expr(
                                     Field,
                                     erl_syntax:abstract([]));
                               _ ->
                                   Field
                           end
                   end, RecordFields))])}]
      catch _:_ ->
              []
      end.
  