anchor.diff:                  #{file  => Name,
                     base  => Name,
                     nodes => map_to_bin(State2#state.nodes),
  -                  texts => State2#state.texts,
  +                  texts => add_text_lookup(State2#state.texts),
                     names => State2#state.names,
                     namsp => State2#state.namsp,
                     att_types => State2#state.att_types}
  
positive.code:    xqerl_xdm:namespace_node(N, L, D, I).
  
  doc_to_binary(#{file := Uri} = Doc) ->
     Doc1 = add_text_lookup(Doc),
     Bin = erlang:term_to_binary(Doc1, [compressed]),
     {Uri, Bin}.
  
  doc_to_xqnode_doc(Doc) ->
     add_text_lookup(Doc).
  
  binary_to_doc(Bin) ->
     erlang:binary_to_term(Bin).
  
  %% map with position => node
  map_to_bin(Map) ->
     SKeys = lists:seq(1,maps:size(Map)),
     List = lists:map(fun(Key) ->
                          maps:get(Key, Map)
                      end, SKeys),
     erlang:iolist_to_binary(List).
  
  add_text_lookup(#{texts := Texts} = Doc) ->
     F = fun(K,V,AccIn) -> AccIn#{V => K} end,
     TextLu = maps:fold(F,#{},Texts),
     Doc#{texts := TextLu}.
  
  add_node(#state{nodes = Nodes} = State, #nodes{id = K} = Rec) ->
     V = norm(Rec),
     Nodes2 = maps:put(K, V, Nodes),
     State#state{nodes = Nodes2}.
  
  store_doc(_Uri, {error,E}) -> {error,E};
  store_doc(Uri, Doc) ->
  
negative.code:    State4 = add_node(State3, Record),
     State4#state{counter = C +1};   
  
  handle_event({comment, String0}, _Ln, #state{counter = C,
                                              stack = [P|_]} = State) -> 
     String = String0,%unicode:characters_to_binary(String0),
     {TxId, State1} = get_text_id(State, String),
     Record = #nodes{id = C, 
                     tp = comment,
  