Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser does not recognize namespaced attributes #10

Open
ostinelli opened this issue Oct 21, 2012 · 1 comment
Open

Parser does not recognize namespaced attributes #10

ostinelli opened this issue Oct 21, 2012 · 1 comment

Comments

@ostinelli
Copy link
Contributor

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.

@keynslug
Copy link

keynslug commented Sep 9, 2014

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.

michalwski pushed a commit to michalwski/exml that referenced this issue May 9, 2018
Escape attr value when converting to iolist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants