Parser does not recognize namespaced attributes
When I try to parse a <stream> element, the parser does not understand the difference between namespaced attributes.
1> {ok, Parser} = exml_stream:new_parser().
{ok,{parser,<<>>,[]}}
2> {ok, _, _} = exml_stream:parse(Parser, <<"<?xml version='1.0'?><stream:stream from='[email protected]' to='im.example.com' version='1.0' xml:lang='en' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>">>).
{ok,{parser,<<>>,
[{xmlelement,<<"stream:stream">>,
[{<<"xmlns:stream">>,<<"http://etherx.jabber.org/streams">>},
{<<"from">>,<<"[email protected]">>},
{<<"to">>,<<"im.example.com">>},
{<<"version">>,<<"1.0">>},
{<<"xml:lang">>,<<"en">>}],
[]}]},
[{xmlstreamstart,<<"stream:stream">>,
[{<<"xmlns:stream">>,<<"http://etherx.jabber.org/streams">>},
{<<"from">>,<<"[email protected]">>},
{<<"to">>,<<"im.example.com">>},
{<<"version">>,<<"1.0">>},
{<<"xml:lang">>,<<"en">>}]}]}
3> {ok, Parser2} = exml_stream:new_parser().
{ok,{parser,<<>>,[]}}
4> {ok, _, _} = exml_stream:parse(Parser2, <<"<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' from='[email protected]' to='im.example.com' version='1.0' xml:lang='en' xmlns='jabber:client'>">>).
{ok,{parser,<<>>,
[{xmlelement,<<"stream:stream">>,
[{<<"xmlns">>,<<"jabber:client">>},
{<<"from">>,<<"[email protected]">>},
{<<"to">>,<<"im.example.com">>},
{<<"version">>,<<"1.0">>},
{<<"xml:lang">>,<<"en">>}],
[]}]},
[{xmlstreamstart,<<"stream:stream">>,
[{<<"xmlns">>,<<"jabber:client">>},
{<<"from">>,<<"[email protected]">>},
{<<"to">>,<<"im.example.com">>},
{<<"version">>,<<"1.0">>},
{<<"xml:lang">>,<<"en">>}]}]}
In the first parser, the xml has the xmlns attribute first and the xmlns:stream attribute second. As you can see, the result only includes the second attribute xmlns:stream.
In the second parser, the xml has the xmlns:stream attribute first and the xmlns attribute second. As you can see, the result only includes the second attribute xmlns.
Desired: both attributes should be kept, as per the XMPP protocol.
I would mention that I do not observe beforementioned issue on the current master.
Should it be closed, so as to stop people from trying out this project on their own? The issue sounds pretty rough.