Skip to content

Instantly share code, notes, and snippets.

@bradfordw
Created April 25, 2013 20:18
Show Gist options
  • Save bradfordw/5462790 to your computer and use it in GitHub Desktop.
Save bradfordw/5462790 to your computer and use it in GitHub Desktop.
decode_element(Stream) ->
decode_element(Stream, <<"">>).
decode_element(<<>>, Output) -> Output;
decode_element(<<$&,$l,$t,$;,Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, $<>>);
decode_element(<<$&,$g,$t,$;,Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, $>>>);
decode_element(<<E:1/binary, Rest/binary>>, Output) ->
decode_element(Rest, <<Output/binary, E/binary>>).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment