anchor.diff:  -define(warn(F, Args), io:format("* xml_gen warning: " ++ F ++ "~n", Args)).
   
   -record(state, {labels = [], ast = [], all_specs = [],
  -                known_functions = [], silent = false}).
  +                known_functions = [], silent = false,
  +                records = []}).
   
   %%====================================================================
   %% Compiler API
  
positive.code:     Decoder = make_xmlns_decoder(TaggedSpecs),
      ResultAST = erl_syntax:form_list([Module, CompilerOpts, Exports|NewAST]),
      DirName = filename:dirname(Path),
      file:write_file(
        filename:join([DirName, ModName ++ ".erl"]),
        [erl_prettypr:format(ResultAST), io_lib:nl()]).
  
  make_xmlns_decoder(TaggedSpecs) ->
      Clauses = lists:map(
  
negative.code:                 end, [], Vars),
      "decode_" ++ string:join(NewVars, "_").
  
  make_record(Term, Labels) ->
      try
          [H|T] = [erl_syntax:atom_value(El)
                   || El <- erl_syntax:tuple_elements(abstract(Term))],
          false = is_label(H),
          true = lists:all(fun is_label/1, T),
          [erl_syntax:attribute(
             erl_syntax:atom("record"),
             [erl_syntax:atom(H),
              erl_syntax:tuple(
                lists:map(
                  fun(Label) ->
                          Field = label_to_record_field(Label),
                          case lists:flatmap(
                                 fun({L, _F, S}) when L == Label ->
                                         [S];
                                    (_) ->
                                         []
                                 end, Labels) of
                              [#spec{default = Default,
                                     min = 0, max = 1}|_]
                                when Default /= undefined ->
                                  erl_syntax:match_expr(
                                    Field,
                                    erl_syntax:abstract(Default));
                              [#spec{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));
                              [] ->
                                  erl_syntax:match_expr(
                                    Field,
                                    erl_syntax:abstract([]));
                              (_) ->
                                  Field
                          end
                  end, T))])]
      catch _:_ ->
              []
      end.
  
  %% Fun(Args) -> Body.
  make_function(Fun, Args, Body) ->
      erl_syntax:function(
  