anchor.diff:  %%%===================================================================
   %%% Helpers
   %%%===================================================================
  +-spec prepare_parser(#parser{}) -> {ok, #parser{}}.
  +prepare_parser(#parser{type = single_doc} = Parser) ->
  +    {ok,Parser};
  +prepare_parser(#parser{type = multiple_docs} = Parser) ->
  +    %% open fake stream tag and discard events
  +    %% use random bytes to reduce probability of closing the tag by user
  +    <<I:128/integer>> = crypto:rand_bytes(16),
  +    Tag = list_to_binary(erlang:integer_to_list(I,16)),
  +    {ok, NewParser, _ } = parse(Parser, <<"<_",Tag/binary,">">>),
  +    {ok, NewParser}.
   
   -spec parse_events(list(), list(), list()) -> {list(xmlstreamelement()), list()}.
   parse_events([], Stack, Acc) ->
  
positive.code: 
  -spec new_parser() -> {ok, parser()} | {error, any()}.
  new_parser() ->
      try
          {ok, EventParser} = exml_event:new_parser(),
          {ok, #parser{event_parser = EventParser}}
      catch
          E:R ->
              {error, {E, R}}
  
negative.code:     end.
  
  -spec reset_parser(parser()) -> {ok, parser()} | {error, any()}.
  reset_parser(#parser{event_parser = EventParser, type = Type}) ->
      try
          exml_event:reset_parser(EventParser),
          %% drop all the state except event_parser
          {ok, prepare_parser(#parser{event_parser = EventParser, type = Type})}
      catch
          E:R ->
              {error, {E, R}}
  