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

Can't parse file with xml header #19

Open
grey-kristy opened this issue May 22, 2015 · 2 comments
Open

Can't parse file with xml header #19

grey-kristy opened this issue May 22, 2015 · 2 comments

Comments

@grey-kristy
Copy link

exml:parse(<<"<tag>5</tag>">>).
{ok,{xmlel,<<"tag">>,[],[{xmlcdata,<<"5">>}]}}

ok

exml:parse(<<"<?xml version='1.0'?><tag>5</tag>">>).
{error,{"XML or text declaration not at start of entity",
        <<"<stream><?xml version='1.0'?><tag>5</tag></stream>">>}}

error

@silviucpp
Copy link

I have the same problem, Any advice on this ?

@grey-kristy
Copy link
Author

You can, of course, strip header yourself, like this:

strip_header(<<"<?xml", Rest/binary>>) ->
    [_, CleanXml] = binary:split(Rest, <<"?>">>),
    CleanXml;

strip_header(CleanXml) ->
    CleanXml.

But in my opinion, it should do exml

michalwski added a commit to michalwski/exml that referenced this issue May 9, 2018
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