anchor.diff:      end.
   
   -spec reset_parser(parser()) -> {ok, parser()} | {error, any()}.
  -reset_parser(#parser{event_parser = EventParser}) ->
  +reset_parser(#parser{event_parser = EventParser, type = Type}) ->
       try
           exml_event:reset_parser(EventParser),
           %% drop all the state except event_parser
  -        {ok, #parser{event_parser = EventParser}}
  +        {ok, prepare_parser(#parser{event_parser = EventParser, type = Type})}
       catch
           E:R ->
               {error, {E, R}}
  
positive.code: %%%===================================================================
  %%% Helpers
  %%%===================================================================
  
  -spec parse_events(list(), list(), list()) -> {list(xmlstreamelement()), list()}.
  parse_events([], Stack, Acc) ->
  
negative.code: 
  -spec new_parser() -> {ok, parser()} | {error, any()}.
  new_parser() ->
      new_parser(single_doc).
  
  -spec new_parser(parser_type()) -> {ok, parser()} | {error, any()}.
  new_parser(Type)->
      try
          {ok, EventParser} = exml_event:new_parser(),
          {ok, prepare_parser(#parser{event_parser = EventParser, type = Type})}
      catch
          E:R ->
              {error, {E, R}}
  