Code Monkey home page Code Monkey logo

fast_xml's Introduction

Erlang and Elixir XML Parsing

CI Coverage Status Hex version

Fast Expat based Erlang XML parsing and manipulation library, with a strong focus on XML stream parsing from network.

It supports:

  • Full XML structure parsing: Suitable for small but complete XML chunks.
  • XML stream parsing: Suitable for large XML document, or infinite network XML stream like XMPP.

This module can parse files much faster than built-in module xmerl. Depending on file complexity and size fxml_stream:parse_element/1 can be 8-18 times faster than calling xmerl_scan:string/2.

This application was previously called p1_xml and was renamed after major optimisations to put emphasis on the fact it is damn fast.

Building

Erlang XML parser can be build as follow:

./configure && make

Erlang XML parser is a rebar-compatible OTP application. Alternatively, you can build it with rebar:

rebar compile

Dependencies

Erlang XML parser depends on Expat XML parser. You need development headers for Expat library to build it.

You can use configure options to pass custom path to Expat libraries and headers:

--with-expat=[ARG]      use Expat XML Parser from given prefix (ARG=path);
                        check standard prefixes (ARG=yes); disable (ARG=no)
--with-expat-inc=[DIR]  path to Expat XML Parser headers
--with-expat-lib=[ARG]  link options for Expat XML Parser libraries

xmlel record and types

XML elements are provided as Erlang xmlel records.

Format of the record allows defining a simple tree-like structure. xmlel record has the following fields:

  • name :: binary()
  • attrs :: [attr()]
  • children :: [xmlel() | cdata()]

cdata type is a tuple of the form:

{xmlcdata, CData::binary()}

attr type if a tuple of the form:

{Name::binary(), Value::binary()}

XML full structure parsing

You can definitely parse a complete XML structure with fast_xml:

$ erl -pa ebin
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.3  (abort with ^G)
1> application:start(fast_xml).
ok
2> rr(fxml).
[xmlel]
3> fxml_stream:parse_element(<<"<test>content cdata</test>">>).
#xmlel{name = <<"test">>,attrs = [],
       children = [{xmlcdata,<<"content cdata">>}]}

XML Stream parsing example

You can also parse continuous stream. Our design allows decoupling very easily the process receiving the raw XML to parse from the process receiving the parsed content.

The workflow is as follow:

state = new(CallbackPID); parse(state, data); parse(state, moredata); ...

and the parsed XML fragments (stanzas) are send to CallbackPID.

With that approach you can be very flexible on how you architect your own application.

Here is an example XML stream parsing:

$ erl -pa ebin
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.3  (abort with ^G)

% Start the application:
1> application:start(fast_xml).
ok

% Create a new stream, using self PID to received XML parsing event:
2> S1 = fxml_stream:new(self()).
<<>>

% Start feeding content to the XML parser.
3> S2 = fxml_stream:parse(S1, <<"<root>">>).
<<>>

% Receive Erlang message send to shell process:
4> flush().
Shell got {'$gen_event',{xmlstreamstart,<<"root">>,[]}}
ok

% Feed more content:
5> S3 = fxml_stream:parse(S2, <<"<xmlelement>content cdata</xmlelement>">>).
<<>>

% Receive more messages:
6> flush().
Shell got {'$gen_event',
              {xmlstreamelement,
                  {xmlel,<<"xmlelement">>,[],
                      [{xmlcdata,<<"content cdata">>}]}}}
ok

% Feed more content:
7> S4 = fxml_stream:parse(S3, <<"</root>">>).      
<<>>

% Receive messages:
8> flush().
Shell got {'$gen_event',{xmlstreamend,<<"root">>}}
ok

9> fxml_stream:close(S4).
true

Note how the root element is important. We expect to have the root element serve as boundary with stream start and stream end event. Then, lower level tags are passed as sub stream elements.

How does this module relate to exmpp ?

This module is a low level fast XML parser. It is not an XMPP client library like exmpp.

References

This module is use at large scale for parsing massive XML content in ejabberd XMPP server project. It is used in production in thousands of real life deployments.

Development

Test

Unit test

You can run eunit test with the command:

$ rebar eunit

Elixir / Quickcheck test

You can run test written with Elixir / Quickcheck thanks to the mix command:

MIX_EXS=test/elixir/mix.exs mix test

fast_xml's People

Contributors

aaronjensen avatar alexeyshch avatar badlop avatar ch4s3 avatar dch avatar efine avatar hrubi avatar jamielinux avatar kianmeng avatar mremond avatar nosnilmot avatar prefiks avatar weiss avatar zinid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast_xml's Issues

compilation breaks on tag: 1.1.43

MacOS: 10.15.7

gmake[1]: Leaving directory '/Users/pankajsoni/Documents/Git/Rivers/ejabberd/staging/deps/stringprep'
gmake[1]: Entering directory '/Users/pankajsoni/Documents/Git/Rivers/ejabberd/staging/deps/fast_xml'
cc -c -o c_src/fxml.o c_src/fxml.c -I/usr/local/opt/openssl/include/ -I/usr/local/include -I/usr/local/opt/expat/include -fPIC -I -I -Wall -finline-functions -Wall -fPIC -I "/usr/local/Cellar/erlang/23.1/lib/erlang/erts-11.1/include" -I "/usr/local/Cellar/erlang/23.1/lib/erlang/lib/erl_interface-4.0.1/include" -fPIC 
cc -o priv/lib/fxml.so c_src/fxml.o -L/usr/local/opt/openssl/lib -L/usr/local/lib -L/usr/local/opt/expat/lib -lexpat  -flat_namespace -undefined suppress -L -lei  
ld: warning: directory not found for option '-L-lei'
cc -c -o c_src/fxml_stream.o c_src/fxml_stream.c -I/usr/local/opt/openssl/include/ -I/usr/local/include -I/usr/local/opt/expat/include -fPIC -I -I -Wall -finline-functions -Wall -fPIC -I "/usr/local/Cellar/erlang/23.1/lib/erlang/erts-11.1/include" -I "/usr/local/Cellar/erlang/23.1/lib/erlang/lib/erl_interface-4.0.1/include" -fPIC 
cc -o priv/lib/fxml_stream.so c_src/fxml_stream.o -L/usr/local/opt/openssl/lib -L/usr/local/lib -L/usr/local/opt/expat/lib -lexpat  -flat_namespace -undefined suppress -L -lei  
ld: warning: directory not found for option '-L-lei'
 DEPEND fast_xml.d
 ERLC   fast_xml.erl fxml.erl fxml_gen.erl fxml_gen_pt.erl fxml_stream.erl fxml_sup.erl fxmlrpc.erl fxmlrpc_codec.erl fxmlrpc_codec_external.erl
src/fxmlrpc_codec.erl:6: Warning: export_all flag enabled - all functions will be exported
src/fxmlrpc_codec_external.erl:6: Warning: export_all flag enabled - all functions will be exported
 APP    fast_xml.app.src
gmake[1]: Leaving directory '/Users/pankajsoni/Documents/Git/Rivers/ejabberd/staging/deps/fast_xml'
gmake[1]: Entering directory '/Users/pankajsoni/Documents/Git/Rivers/ejabberd/staging/deps/xmpp'
cc -c -o c_src/jid.o c_src/jid.c -DHAS_ERTS_EXIT -g -O2 -Wall -finline-functions -Wall -fPIC -I "/usr/local/Cellar/erlang/23.1/lib/erlang/erts-11.1/include" -I "/usr/local/Cellar/erlang/23.1/lib/erlang/lib/erl_interface-4.0.1/include" -fPIC 
cc -o priv/lib/jid.so c_src/jid.o -flat_namespace -undefined suppress -L "/usr/local/Cellar/erlang/23.1/lib/erlang/lib/erl_interface-4.0.1/lib" -lerl_interface -lei  
ld: library not found for -lerl_interface
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [c_src/Makefile.erlang.mk:25: priv/lib/jid.so] Error 1
gmake[1]: *** [Makefile:31: pre-app] Error 2
gmake[1]: Leaving directory '/Users/pankajsoni/Documents/Git/Rivers/ejabberd/staging/deps/xmpp'
gmake: *** [erlang.mk:4433: deps] Error 2

Does not compile with erlang 19

Compiling 8 files (.erl)
src/fxml.erl:51: syntax error before: '/'
src/fxml.erl:72: syntax error before: '/'
src/fxml.erl:82: syntax error before: '/'
src/fxml.erl:93: syntax error before: '/'
src/fxml.erl:107: syntax error before: '/'
src/fxml.erl:132: syntax error before: '/'
src/fxml.erl:141: syntax error before: '/'
src/fxml.erl:153: syntax error before: '/'
src/fxml.erl:162: syntax error before: '/'
src/fxml.erl:177: syntax error before: '/'
src/fxml.erl:191: syntax error before: '/'
src/fxml.erl:203: syntax error before: '/'
src/fxml.erl:214: syntax error before: '/'
src/fxml.erl:225: syntax error before: '/'
src/fxml.erl:239: syntax error before: '/'
src/fxml.erl:258: syntax error before: '/'
src/fxml.erl:270: syntax error before: '/'
src/fxml.erl:293: syntax error before: '/'
src/fxml.erl:320: syntax error before: '/'
src/fxml.erl:334: syntax error before: '/'
src/fxml.erl:345: syntax error before: '/'
src/fxml.erl:366: syntax error before: '/'
src/fxml.erl:384: syntax error before: '/'

Can't compile on windows

I'm trying to build fast_xml under windows since I used it on an elixir application which must run under that OS.

This is what happens:

===> Compiling c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c
===> Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24225.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '-g'
fxml_stream.c
c:\Program Files\erl9.0\erts-9.0\include\erl_nif.h(139): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'ref_bin'
C:\Program Files (x86)\Expat 2.2.5\Source\lib\expat.h(876): warning C4820: '<unnamed-tag>': '3' bytes padding added after data member 'finalBuffer'
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(33): warning C4201: nonstandard extension used: nameless struct/union
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(36): warning C4820: 'children_list_t': '3' bytes padding added after data member 'is_cdata'
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(42): warning C4820: 'attrs_list_t': '4' bytes padding added after data member 'next'
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(66): warning C4214: nonstandard extension used: bit field types other than int
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(67): warning C4214: nonstandard extension used: bit field types other than int
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(68): warning C4214: nonstandard extension used: bit field types other than int
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(69): warning C4820: '<unnamed-tag>': '3' bytes padding added after data member 'use_maps'
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(79): error C2099: initializer is not a constant
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(1029): warning C4242: '=': conversion from 'int' to 'char', possible loss of data
c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(1030): warning C4242: '=': conversion from 'int' to 'char', possible loss of data

The error is this one:

c:/Users/Administrator/dev/foo-streaming/deps/fast_xml/c_src/fxml_stream.c(79): error C2099: initializer is not a constant

Any idea how to solve it? Anyone able to install fast_xml under windows?

Is there an option to disable nesting into text elements containing HTML?

Hi,

I'm probably missing somehing but I am trying to figure out if it is possible to consider the body of a particular element as sometihng that does not need to be nested into (as is done in the below example with the granular tokenizing of the HTML elements inside the "body" element). I can see the logic for the outcome I'm getting but if I would like it just as one big CDATA is there any way I can specify that?

My goal is to simply extract the "body" as one erlang binary.

Thanks,

7> fxml_stream:parse_element(<<"<message><body>?OTRv2?\n<b>[email protected]</b> has requested an <a href=\"http://otr.cypherpunks.ca/\">Off-the-Record private conversation</a>.  However, you do not have a plugin to support that.\nSee <a href=\"http://otr.cypherpunks.ca/\">http://otr.cypherpunks.ca/</a> for more information.</body></message>">>).

{xmlel,<<"message">>,[],
       [{xmlel,<<"body">>,[],
               [{xmlcdata,<<"?OTRv2?\n">>},
                {xmlel,<<"b">>,[],[{xmlcdata,<<"[email protected]">>}]},
                {xmlcdata,<<" has requested an ">>},
                {xmlel,<<"a">>,
                       [{<<"href">>,<<"http://otr.cypherpunks.ca/">>}],
                       [{xmlcdata,<<"Off-the-Record private conversation">>}]},
                {xmlcdata,<<".  However, you do not have a plugin to support that"...>>},
                {xmlel,<<"a">>,
                       [{<<"href">>,<<"http://otr.cypherpunks.ca/">>}],
                       [{xmlcdata,<<"http://otr.cypherpunks.ca/">>}]},
                {xmlcdata,<<" for more information.">>}]}]}

multiple definition of `nif_init'

Hi,
I'm trying to run " ./configure && make" and I get this error:

==> fast_xml (compile)
/usr/bin/ld: c_src/fxml_stream.o: in function nif_init': /home/oem/fast_xml/fast_xml/c_src/fxml_stream.c:1060: multiple definition of nif_init'; c_src/fxml.o:/home/oem/fast_xml/fast_xml/c_src/fxml.c:302: first defined here
collect2: error: ld returned 1 exit status
ERROR: sh(cc c_src/fxml.o c_src/fxml_stream.o $LDFLAGS -shared -L"/usr/lib/erlang/lib/erl_interface-3.13.1/lib" -lerl_interface -lei -o priv/fast_xml_drv.so)
failed with return code 1 and the following output:
/usr/bin/ld: c_src/fxml_stream.o: in function nif_init': /home/oem/fast_xml/fast_xml/c_src/fxml_stream.c:1060: multiple definition of nif_init'; c_src/fxml.o:/home/oem/fast_xml/fast_xml/c_src/fxml.c:302: first defined here
collect2: error: ld returned 1 exit status

ERROR: compile failed while processing /home/oem/fast_xml/fast_xml: rebar_abort

I saw that a few years ago someone had the same problem but he just said eventually "sorry, I got the answer. I lost the rebar.config file."
What does it mean to lose the rebar.config file? Is there a chance you can give more details about the solution?

Thanks!

fast_xml requires Expat >=2.4.5 (or backported fixes) for secure operation

Hi fast_xml,

it has come to my attention that the way fast_xml processes element names at…

static xmlns_op encode_name(state_t *state, const char *xml_name, ErlNifBinary *buf,
char **ns_str, char **pfx_str, int top_element)
{
const char *parts[3];
int i, idx = 0;
for (i = 0; ; i++) {
if (!xml_name[i] || xml_name[i] == '\n') {
parts[idx++] = xml_name + i;
if (!xml_name[i])
break;
}
if (idx >= 3)
return OP_ERROR;
}
const char *ns = NULL, *name = NULL, *prefix = NULL;
size_t ns_len = 0, name_len = 0, prefix_len = 0;
if (idx == 1) {
name = xml_name;
name_len = parts[0] - xml_name;
} else {
ns = xml_name;
ns_len = parts[0] - xml_name;
name = parts[0] + 1;
name_len = parts[1] - parts[0] - 1;
if (idx == 3) {
prefix = parts[1] + 1;
prefix_len = parts[2] - parts[1] - 1;
}
}
…requires Expat >=2.4.5 (with the fix to CVE-2022-25236 from pull request(s) libexpat/libexpat#561 (and libexpat/libexpat#577)) to not be vulnerable to injection of namespace separator characters as demonstrated with vulnerable Expat 2.4.4 by the Dockerfile, below.

If everyone uses fast_xml with Expat >=2.4.5, then fast_xml code does not need any changes. I wanted to be sure you're aware.

For the Dockerfile:

# Copyright (c) 2022 Sebastian Pipping <[email protected]>
# Licensed under the Apache License version 2.0

FROM debian:sid
SHELL ["/bin/bash", "-c"]
RUN apt-get update \
        && \
    apt-get install --no-install-recommends --yes \
            build-essential \
            ca-certificates \
            cmake \
            git \
            make \
        && \
    git clone --depth 1 --branch R_2_4_4 https://github.com/libexpat/libexpat/ 2>/dev/null \
        && \
    cmake -S libexpat/expat \
        && \
    cp libexpat/expat/examples/elements.c{,_BACKUP} \
        && \
    sed "s/XML_ParserCreate(NULL);/XML_ParserCreateNS(NULL, '|');\n  XML_SetReturnNSTriplet(parser, 1);/" -i libexpat/expat/examples/elements.c \
        && \
    make -j$(nproc) \
        && \
    ! diff -u libexpat/expat/examples/elements.c{_BACKUP,} \
        && \
    ./examples/elements <<<'<a><d xmlns="b&#x7C;c" /><d:c xmlns:d="b" /></a>'

And for the expected output:

# docker build .
[..]
a
        b|c|d
        b|c|d
[..]

Best, Sebastian

Compiling fast_xml in Jenkins fails

Excuse my ignorance but I don't even know how to read this stacktrace. My Jenkins server returned this when I attempted to build on it:

==> fast_xml
cc -g -O2 -Wall -I/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include -fPIC -lexpat -o priv/lib/fxml_stream.so c_src/fxml_stream.c
c_src/fxml_stream.c:94:14: warning: ‘jabber_client_ns’ defined but not used [-Wunused-variable]
 static char *jabber_client_ns = "jabber:client";
              ^
c_src/fxml_stream.c:115:14: warning: ‘dup_str’ defined but not used [-Wunused-function]
 static char *dup_str(const char *str)
              ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccObG54K.o: In function `free_parser_allocated_structs':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:729: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:730: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:731: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:740: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:738: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:743: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:745: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:751: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:752: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:753: undefined reference to `enif_free'
/tmp/ccObG54K.o: In function `dup_to_term':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:134: undefined reference to `enif_make_new_binary'
/tmp/ccObG54K.o: In function `dup_buf':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:105: undefined reference to `enif_alloc'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `append_attr':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:296: undefined reference to `enif_make_list_cell'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:293: undefined reference to `enif_make_map_put'
/tmp/ccObG54K.o: In function `send_event':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:269: undefined reference to `enif_send'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:264: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `send_event':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:264: undefined reference to `enif_send'
/tmp/ccObG54K.o: In function `send_error':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:917: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `send_error':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:909: undefined reference to `enif_make_new_map'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:910: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:910: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:910: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:912: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:912: undefined reference to `enif_make_map_put'
/tmp/ccObG54K.o: In function `erlXML_CharacterDataHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:519: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:521: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:522: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:523: undefined reference to `XML_StopParser'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:516: undefined reference to `enif_realloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:503: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:505: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:505: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `send_all_state_event':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:283: undefined reference to `enif_send'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:285: undefined reference to `enif_clear_env'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:278: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `send_all_state_event':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:278: undefined reference to `enif_send'
/tmp/ccObG54K.o: In function `load':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:810: undefined reference to `enif_open_resource_type'
/tmp/ccObG54K.o: In function `destroy_parser_state':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:761: undefined reference to `XML_ParserFree'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:762: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:763: undefined reference to `enif_free_env'
/tmp/ccObG54K.o: In function `close_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:990: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:989: undefined reference to `enif_get_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:997: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `change_callback_pid_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:974: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:967: undefined reference to `enif_get_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:973: undefined reference to `enif_get_local_pid'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:978: undefined reference to `enif_make_resource'
/tmp/ccObG54K.o: In function `setup_parser':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:773: undefined reference to `XML_SetUserData'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:774: undefined reference to `XML_SetStartElementHandler'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:776: undefined reference to `XML_SetEndElementHandler'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:778: undefined reference to `XML_SetCharacterDataHandler'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:780: undefined reference to `XML_SetStartNamespaceDeclHandler'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:783: undefined reference to `XML_SetStartDoctypeDeclHandler'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:786: undefined reference to `XML_SetReturnNSTriplet'
/tmp/ccObG54K.o: In function `reset_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:840: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:839: undefined reference to `enif_get_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:842: undefined reference to `XML_ParserReset'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:847: undefined reference to `enif_clear_env'
/tmp/ccObG54K.o: In function `init_parser_state':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:792: undefined reference to `enif_alloc_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:796: undefined reference to `enif_alloc_env'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:798: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:802: undefined reference to `XML_ParserCreate_MM'
/tmp/ccObG54K.o: In function `make_parse_error':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:819: undefined reference to `XML_GetErrorCode'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:825: undefined reference to `XML_ErrorString'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:827: undefined reference to `enif_make_uint'
/tmp/ccObG54K.o: In function `parse_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:937: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:933: undefined reference to `enif_get_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:936: undefined reference to `enif_inspect_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:948: undefined reference to `XML_Parse'
/tmp/ccObG54K.o: In function `dup_to_bin':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:122: undefined reference to `enif_alloc_binary'
/tmp/ccObG54K.o: In function `erlXML_StartNamespaceDeclHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:662: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:668: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:683: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:684: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:685: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:675: undefined reference to `enif_alloc_binary'
/tmp/ccObG54K.o: In function `parse_element_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:877: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:865: undefined reference to `enif_inspect_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:874: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:887: undefined reference to `XML_Parse'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:892: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:895: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `parse_element_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:900: undefined reference to `enif_release_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:876: undefined reference to `enif_release_resource'
/tmp/ccObG54K.o: In function `new_nif':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1025: undefined reference to `enif_get_local_pid'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1036: undefined reference to `enif_make_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1037: undefined reference to `enif_release_resource'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1040: undefined reference to `enif_get_ulong'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1045: undefined reference to `enif_make_badarg'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1010: undefined reference to `enif_is_list'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1013: undefined reference to `enif_get_list_cell'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1015: undefined reference to `enif_get_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1042: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:1042: undefined reference to `enif_compare'
/tmp/ccObG54K.o: In function `encode_name':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:216: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:234: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:242: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:244: undefined reference to `enif_free'
/tmp/ccObG54K.o: In function `erlXML_StartElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:310: undefined reference to `enif_make_new_map'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:312: undefined reference to `enif_make_list'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:333: undefined reference to `enif_make_new_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:337: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:459: undefined reference to `XML_StopParser'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:429: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:429: undefined reference to `enif_make_binary'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_StartElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:432: undefined reference to `enif_make_list_cell'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:441: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:423: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:423: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:423: undefined reference to `enif_make_map_update'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:426: undefined reference to `enif_make_map_update'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:412: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:413: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:414: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:398: undefined reference to `enif_release_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:400: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:458: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:487: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:403: undefined reference to `enif_make_binary'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_StartElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:471: undefined reference to `enif_make_new_map'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:472: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:472: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:472: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:474: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:474: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:474: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:476: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:476: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:480: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:480: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple3':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:357: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_StartElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:452: undefined reference to `enif_free'
/tmp/ccObG54K.o: In function `make_xmlel_children_list':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:537: undefined reference to `enif_make_list'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:543: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:549: undefined reference to `enif_make_list_cell'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:556: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:545: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:545: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `make_xmlel_children_list':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:551: undefined reference to `enif_make_list_cell'
/tmp/ccObG54K.o: In function `erlXML_EndElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:595: undefined reference to `enif_make_new_map'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:596: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:596: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:596: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:598: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:598: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:599: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:599: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:600: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:600: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:613: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:622: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:623: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:603: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple4':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:366: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_EndElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:577: undefined reference to `enif_make_new_map'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:578: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:578: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:578: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:580: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:580: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:580: undefined reference to `enif_make_map_put'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:613: undefined reference to `XML_StopParser'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:628: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:629: undefined reference to `enif_free'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:635: undefined reference to `enif_make_atom'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_EndElementHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:584: undefined reference to `enif_make_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:584: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:631: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:631: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:631: undefined reference to `enif_make_map_put'
/tmp/ccObG54K.o: In function `erlXML_StartDoctypeDeclHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:707: undefined reference to `XML_StopParser'
/tmp/ccObG54K.o: In function `send_event':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:271: undefined reference to `enif_clear_env'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:271: undefined reference to `enif_clear_env'
/tmp/ccObG54K.o: In function `setup_parser':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:787: undefined reference to `XML_SetDefaultHandler'
/tmp/ccObG54K.o: In function `enif_make_tuple2':
/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include/erl_nif_api_funcs.h:349: undefined reference to `enif_make_tuple'
/tmp/ccObG54K.o: In function `erlXML_StartNamespaceDeclHandler':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml_stream.c:686: undefined reference to `XML_StopParser'
/tmp/ccObG54K.o:(.data.rel+0x0): undefined reference to `enif_alloc'
/tmp/ccObG54K.o:(.data.rel+0x8): undefined reference to `enif_realloc'
/tmp/ccObG54K.o:(.data.rel+0x10): undefined reference to `enif_free'
collect2: error: ld returned 1 exit status
make: *** [priv/lib/fxml_stream.so] Error 1

cc -g -O2 -Wall -I/var/lib/jenkins/.asdf/installs/erlang/18.2.1/lib/erlang/erts-7.2.1/include -fPIC -lexpat -o priv/lib/fxml.so c_src/fxml.c
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/ccwBMLPn.o: In function `load':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:51: undefined reference to `enif_make_atom'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:52: undefined reference to `enif_make_atom'
/tmp/ccwBMLPn.o: In function `resize_buf':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:82: undefined reference to `enif_realloc'
/tmp/ccwBMLPn.o: In function `make_element':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:220: undefined reference to `enif_get_tuple'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:230: undefined reference to `enif_compare'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:231: undefined reference to `enif_inspect_iolist_as_binary'
/tmp/ccwBMLPn.o: In function `make_attrs':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:186: undefined reference to `enif_get_list_cell'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:187: undefined reference to `enif_get_tuple'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:189: undefined reference to `enif_inspect_iolist_as_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:190: undefined reference to `enif_inspect_iolist_as_binary'
/tmp/ccwBMLPn.o: In function `make_element':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:222: undefined reference to `enif_compare'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:223: undefined reference to `enif_inspect_iolist_as_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:236: undefined reference to `enif_is_empty_list'
/tmp/ccwBMLPn.o: In function `make_elements':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:167: undefined reference to `enif_get_list_cell'
/tmp/ccwBMLPn.o: In function `destroy_buf':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:69: undefined reference to `enif_free'
/tmp/ccwBMLPn.o: In function `element_to':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:284: undefined reference to `enif_make_badarg'
/tmp/ccwBMLPn.o: In function `init_buf':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:58: undefined reference to `enif_alloc'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:61: undefined reference to `enif_alloc'
/tmp/ccwBMLPn.o: In function `element_to':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:273: undefined reference to `enif_alloc_binary'
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:275: undefined reference to `enif_make_binary'
/tmp/ccwBMLPn.o: In function `destroy_buf':
/var/lib/jenkins/jobs/test_api_v2/branches/master/workspace/deps/fast_xml/c_src/fxml.c:71: undefined reference to `enif_free'
collect2: error: ld returned 1 exit status
make: *** [priv/lib/fxml.so] Error 1

Compiled src/fxmlrpc.erl
Compiled src/fxml_sup.erl
Compiled src/fxml_stream.erl
Compiled src/fxml_gen.erl
Compiled src/fxmlrpc_codec.erl
Compiled src/fxml.erl
Compiled src/fast_xml.erl
Generated fast_xml app

Test failure with error:nif_not_loaded

Hello!

I am working on updating fast_xml in Fedora, and the unit tests seems to have two failures with an error message about nif not being loaded:

$ rebar eunit
==> fast_xml (eunit)
Compiled src/fxml_gen_pt.erl
Compiled src/fxml_sup.erl
Compiled src/fxml_stream.erl
Compiled src/fxmlrpc.erl
Compiled src/fxml.erl
Compiled src/fast_xml.erl
Compiled src/fxmlrpc_codec.erl
Compiled test/fxml_test.erl
Compiled src/fxml_gen.erl
fxml_test: element_to_header_test...*failed*
in function erlang:nif_error/1
  called as nif_error(nif_not_loaded)
in call from fxml:element_to_header/1 (src/fxml.erl, line 62)
in call from fxml_test:'-element_to_header_test/0-fun-0-'/0 (test/fxml_test.erl, line 421)
**error:nif_not_loaded
  output:<<"">>

fxml_test: element_to_header_xmlcdata_test...*failed*
in function fxml_test:'-element_to_header_xmlcdata_test/0-fun-0-'/0 (test/fxml_test.erl, line 430)
**error:{assertException,
    [{module,fxml_test},
     {line,430},
     {expression,"fxml : element_to_header ( { xmlcdata , << \"\" >> } )"},
     {pattern,"{ error , badarg , [...] }"},
     {unexpected_exception,
         {error,nif_not_loaded,
             [{erlang,nif_error,[nif_not_loaded],[]},
              {fxml,element_to_header,1,[{...}|...]},
              {fxml_test,'-element_to_header_xmlcdata_test/0-fun-0-',0,[...]},
              {eunit_test,'-mf_wrapper/2-fun-0-',2,...},
              {eunit_test,run_testfun,...},
              {eunit_proc,...},
              {...}|...]}}]}
  output:<<"">>


=INFO REPORT==== 31-Dec-2016::00:24:36 ===
    application: fast_xml
    exited: stopped
    type: temporary
=======================================================
  Failed: 2.  Skipped: 0.  Passed: 72.

Streaming elements not directly below the root

Hello! First, thank you for this library. I'm very happy with the performance improvement over xmerl.

I have a large XML document I wish to stream, it looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<tns:Envelope xmlns:tns="urn:Service:Integration">
  <tns:Body>
    <tns:RangeResponse>
      <tns:RangeResult>
        <tns:Detail> ...more content here... </tns:Detail>
        <tns:Detail> ...more content here... </tns:Detail>
        <tns:Detail> ...more content here... </tns:Detail>
        <tns:Detail> ...more content here... </tns:Detail>
        <tns:Detail> ...more content here... </tns:Detail>
        <tns:Detail> ...more content here... </tns:Detail>

        ... and so on...

      </tns:RangeResult>
    </tns:RangeResponse>
  </tns:Body>
</tns:Envelope>

I wish to process each Detail element in turn, getting messages like so:

{'$gen_event', {xmlstreamelement, {xmlel, "Detail", [], ...}}}

However when I stream this document by passing each line to fxml_stream:parse/2 I get a single message containing the Body element, meaning I am parsing and processing the Detail elements eagerly.

Is it possible to instruct fast_xml to use RangeResult as the root?

Thanks,
Louis

1.1.14 doesn't work w/ exrm

I end up seeing:

{"Kernel pid terminated",application_controller,"{application_start_failure,fast_xml,{bad_return,{{fast_xml,start,[normal,[]]},{'EXIT',{undef,[{p1_nif_utils,get_so_path,[fxml,[fast_xml],\"fxml\"],[]},{fxml,load_nif,0,[{file,\"/tmp/erlang/booking/edge/builds/booking/deps/fast_xml/src/fxml.erl\"},{line,43}]},{fast_xml,start,2,[{file,\"/tmp/erlang/booking/edge/builds/booking/deps/fast_xml/src/fast_xml.erl\"},{line,52}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}

when trying to boot the app.

rebar3 fails to compile

rebar3 seems to fail to compile fast_xml. Also it would be nice to say that is rebar is REQUIRED to build this.

EUnit: 3 failing tests on Debian sid

Hi, for a while now, fast_xml has 3 failing tests on Debian sid (they succeed on Debian stable).
It used to work when I packaged it last year, I could not find out what change has caused this.

As this doesn't seem to go away and is effectively blocking me from providing ejabberd for Debian testing (and thus Trixie),
I require your help as I have no clue how to track this down.

I am attaching the full build log for 1.1.51.
You can view the full build log for 1.1.49 at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064722.
The issue is the same.
erlang-p1-xml_1.1.51-1_amd64.build.txt

Elixir support broken

Hi guys,

The latest version (1.1.14), while it now successfully creates the Erlang beam files using the latest Elixir 1.3 tooling, doesn't appear to produce the Elixir.FastXML*.beam files any more.

Edward

invalid_chunk when running test suite

I've been attempting to run the test suite on Fedora Rawhide and it seems to fail to cover compile:

$ export VSN=1.1.19
$ export REBAR_VSN_CACHE_FILE=/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/vsn.cache
$ export REBAR_DEPS_PREFER_LIBS=TRUE
$ /usr/bin/rebar eunit skip_deps=true -vv
DEBUG: Evaluating config script "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/rebar.config.script"
DEBUG: Consult config file "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/rebar.config"
DEBUG: Rebar location: "/usr/bin/rebar"
DEBUG: Consult config file "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/src/fast_xml.app.src"
DEBUG: is_app_available, looking for App p1_utils with Path "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/deps/p1_utils"
DEBUG: Directory expected to be an app dir, but it doesn't exist (yet?):
/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/deps/p1_utils
DEBUG: is_app_available, looking for App p1_utils with Path "/usr/lib64/erlang/lib/p1_utils-1.0.6"
INFO:  Looking for p1_utils-.* ; found p1_utils-1.0.6 at /usr/lib64/erlang/lib/p1_utils-1.0.6
DEBUG: Available deps: [{dep,"/usr/lib64/erlang/lib/p1_utils-1.0.6",p1_utils,
                             ".*",
                             {git,"https://github.com/processone/p1_utils",
                                  {tag,"1.0.6"}},
                             false}]
DEBUG: Missing deps  : []
DEBUG: is_app_available, looking for App p1_utils with Path "/usr/lib64/erlang/lib/p1_utils-1.0.6"
INFO:  Looking for p1_utils-.* ; found p1_utils-1.0.6 at /usr/lib64/erlang/lib/p1_utils-1.0.6
DEBUG: Adding /usr/lib64/erlang/lib/p1_utils-1.0.6/ebin to code path
DEBUG: Adding skip dir: /usr/lib64/erlang/lib/p1_utils-1.0.6
DEBUG: Associate sub_dir /usr/lib64/erlang/lib/p1_utils-1.0.6 with /home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19
DEBUG: Plugins requested while processing /home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19: []
DEBUG: Predirs: ["/usr/lib64/erlang/lib/p1_utils-1.0.6"]
DEBUG: Consult config file "/usr/lib64/erlang/lib/p1_utils-1.0.6/rebar.config"
DEBUG: Available deps: []
DEBUG: Missing deps  : []
DEBUG: Plugins requested while processing /usr/lib64/erlang/lib/p1_utils-1.0.6: []
DEBUG: Predirs: []
DEBUG: Postdirs: []
==> fast_xml-1.1.19 (eunit)
DEBUG: Matched required ERTS version: 8.2.1 -> .*
DEBUG: Matched required OTP release: 19 -> .*
DEBUG: Min OTP version unconfigured
DEBUG: Triq availability: false
DEBUG: PropEr availability: true
DEBUG: QuickCheck availability: false
INFO:  sh info:
        cwd: "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19"
        cmd: cp -R src/fxmlrpc_codec.erl src/fxmlrpc.erl src/fxml_sup.erl src/fxml_stream.erl src/fxml_gen_pt.erl src/fxml_gen.erl src/fxml.erl src/fast_xml.erl test/fxml_test.erl ".eunit"
DEBUG:  opts: [{use_stdout,false},abort_on_error]
DEBUG: Port Cmd: "cp -R src/fxmlrpc_codec.erl src/fxmlrpc.erl src/fxml_sup.erl src/fxml_stream.erl src/fxml_gen_pt.erlsrc/fxml_gen.erl src/fxml.erl src/fast_xml.erl test/fxml_test.erl \".eunit\""
Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide]
DEBUG: erl_opts [{d,'TEST'},
                 debug_info,debug_info,
                 {src_dirs,["src"]},
                 {d,'PROPER'}]
DEBUG: Files to compile first: []
INFO:  Cover compiling /home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19
ERROR: eunit failed while processing /home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19: {'EXIT',
    {{case_clause,
         {error,beam_lib,
             {invalid_chunk,
                 "/home/rbarlow/rpmbuild/BUILD/fast_xml-1.1.19/.eunit/fxml_gen.beam",
                 "Abst"}}},
     [{cover,do_compile_beam1,3,[{file,"cover.erl"},{line,1539}]},
      {cover,do_compile_beam,3,[{file,"cover.erl"},{line,1478}]},
      {lists,map,2,[{file,"lists.erl"},{line,1239}]},
      {cover,'-pmap_spawn/4-fun-0-',2,[{file,"cover.erl"},{line,2732}]}]}}

I've tried this with fast_xml-1.1.18, 1.1.19 and 1.1.20. Other related deps:

erlang-erts-19.2.2-1.fc26.x86_64
erlang-eunit-19.2.2-1.fc26.x86_64
erlang-p1_utils-1.0.6-1.fc26.x86_64
erlang-rebar-2.6.4-2.fc26.x86_64

Let me know if I can provide more information!

1.1.33 broke for rebar3

b70d5cf breaks the builds

===> Compiling rebar3_gpb_plugin
===> Package p1_utils-6ff85e8 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /home/jenkins/.cache/rebar3/hex/default/registry
===> Generating package index...
===> Writing index to /home/jenkins/.cache/rebar3/hex/default/packages.idx
===> Package not found in registry: p1_utils-6ff85e8.

fast_xml does not compile on Erlang/OTP 19

$ ./configure && make
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether make sets $(MAKE)... yes
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for ANSI C header files... (cached) yes
checking for erl... /usr/bin/erl
checking for erlc... /usr/bin/erlc
checking expat.h usability... yes
checking expat.h presence... yes
checking for expat.h... yes
checking for library containing XML_ParserCreate... -lexpat
configure: creating ./config.status
config.status: creating vars.config
rebar get-deps compile xref
==> fast_xml (get-deps)
Pulling p1_utils from {git,"https://github.com/processone/p1_utils",
                           {tag,"1.0.5"}}
Cloning into 'p1_utils'...
==> p1_utils (get-deps)
==> p1_utils (compile)
Compiled src/treap.erl
Compiled src/p1_fsm.erl
Compiled src/p1_server.erl
Compiled src/p1_nif_utils.erl
Compiled src/p1_time_compat.erl
Compiled src/p1_edoc_layout.erl
==> fast_xml (compile)
Compiled src/fxml_gen_pt.erl
Compiled src/fast_xml.erl
Compiled src/fxmlrpc.erl
Compiled src/fxml_sup.erl
Compiled src/fxml.erl
Compiled src/fxml_stream.erl
Compiled src/fxmlrpc_codec.erl
Compiled src/fxml_gen.erl
Compiling c_src/fxml.c
Compiling c_src/fxml_stream.c
c_src/fxml_stream.c:115:14: warning: ‘dup_str’ defined but not used [-Wunused-function]
 static char *dup_str(const char *str)
              ^~~~~~~
c_src/fxml_stream.c:94:14: warning: ‘jabber_client_ns’ defined but not used [-Wunused-variable]
 static char *jabber_client_ns = "jabber:client";
              ^~~~~~~~~~~~~~~~
==> fast_xml (xref)
erl_types.erl: Warning: erl_types:t_from_form/4 is undefined function (Xref)
erl_types.erl: Warning: erl_types:t_remote/3 is undefined function (Xref)
src/fxml_gen.erl:1679: Warning: fxml_gen:get_fun_return_type/3 calls undefined function erl_types:t_from_form/4 (Xref)
src/fxml_gen.erl:1820: Warning: fxml_gen:get_label_type/5 calls undefined function erl_types:t_remote/3 (Xref)
ERROR: xref failed while processing /home/fag/elixir/test/fast_xml: rebar_abort
make: *** [Makefile:4: src] Error 1

Compiles fine on Erlang/OTP 18.1. Check your travis page (Because it doesn't compile on Erlang/OTP 17 either)

I would appreciate it if you fixed this.
Thank you in advance.

xmlel vs xmerl records

Hi there, I apologize if I'm missing something obvious, but it looks like fast_xml puts out records that are incompatible with things like xmerl_xpath. Is that intentional? I wasn't able to find anything about xmlel. It'd be great if I could use it as a drop in replacement for xmerl's scan but still be able to use its xpath querying. Thanks!

Unit tests fail for versions 1.1.15-1.1.22

Tried Erlang 18.3 and 19.2.

 $ make test
rebar get-deps compile
==> p1_utils (get-deps)
==> fast_xml (get-deps)
==> p1_utils (compile)
==> fast_xml (compile)
rebar -v skip_deps=true eunit
INFO:  Looking for p1_utils-.* ; found p1_utils-1.0.6 at /home/aidecoe/src/fast_xml/deps/p1_utils
INFO:  Looking for p1_utils-.* ; found p1_utils-1.0.6 at /home/aidecoe/src/fast_xml/deps/p1_utils
==> fast_xml (eunit)
INFO:  sh info:
        cwd: "/home/aidecoe/src/fast_xml"
        cmd: cp -R src/fxmlrpc.erl src/fxml_gen_pt.erl src/fxml_sup.erl src/fxml_gen.erl src/fxmlrpc_codec.erl src/fxml.erl src/fast_xml.erl src/fxml_stream.erl test/fxml_test.erl ".eunit"
Compiled src/fxml_gen_pt.erl
Compiled src/fxml_sup.erl
Compiled src/fxmlrpc.erl
Compiled src/fxml.erl
Compiled src/fast_xml.erl
Compiled src/fxml_stream.erl
Compiled src/fxmlrpc_codec.erl
Compiled test/fxml_test.erl
Compiled src/fxml_gen.erl
INFO:  Cover compiling /home/aidecoe/src/fast_xml
ERROR: eunit failed while processing /home/aidecoe/src/fast_xml: {'EXIT',
    {{case_clause,
         {error,beam_lib,
             {invalid_chunk,
                 "/home/aidecoe/src/fast_xml/.eunit/fxml_gen.beam","Abst"}}},
     [{cover,do_compile_beam1,3,[{file,"cover.erl"},{line,1533}]},
      {cover,do_compile_beam,3,[{file,"cover.erl"},{line,1472}]},
      {lists,map,2,[{file,"lists.erl"},{line,1238}]},
      {cover,'-pmap_spawn/4-fun-0-',2,[{file,"cover.erl"},{line,2731}]}]}}

Support for dirty scheduler

I was wondering if it makes sense to add support for dirty schedulers and if so, if you have any plans for do it?

eunit: 2 tests failed in 1.1.18

Environment:

  • fast_xml: 1.1.18
  • p1_utils: 1.0.6
  • erlang: 18.3
  • expat: 2.2.0
  • elixir: 1.3.0
  • rebar: 2.6.1

Log:

  fxml_test: element_to_header_test...*failed*
in function erlang:nif_error/1
  called as nif_error(nif_not_loaded)
in call from fxml:element_to_header/1 (src/fxml.erl, line 62)
in call from fxml_test:'-element_to_header_test/0-fun-0-'/1 (test/fxml_test.erl, line 421)
**error:nif_not_loaded
  output:<<"">>

  fxml_test: element_to_header_xmlcdata_test...*failed*
in function fxml_test:'-element_to_header_xmlcdata_test/0-fun-0-'/0 (test/fxml_test.erl, line 430)
**error:{assertException,
    [{module,fxml_test},
     {line,430},
     {expression,"fxml : element_to_header ( { xmlcdata , << \"\" >> } )"},
     {pattern,"{ error , badarg , [...] }"},
     {unexpected_exception,
         {error,nif_not_loaded,
             [{erlang,nif_error,[nif_not_loaded],[]},
              {fxml,element_to_header,1,[{...}|...]},
              {fxml_test,'-element_to_header_xmlcdata_test/0-fun-0-',0,[...]},
              {eunit_test,'-mf_wrapper/2-fun-0-',2,...},
              {eunit_test,run_testfun,...},
              {eunit_proc,...},
              {...}|...]}}]}
  output:<<"">>

Version I had previously - 1.1.15 - passes all eunit tests.

Dialyzer errors with syntax_tools

If syntax_tools is added to the list of applications like this:

diff --git a/src/fast_xml.app.src b/src/fast_xml.app.src
index 622e855..6b78df9 100644
--- a/src/fast_xml.app.src
+++ b/src/fast_xml.app.src
@@ -26,7 +26,7 @@
   {vsn,          "1.1.49"},
   {modules,      []},
   {registered,   []},
-  {applications, [kernel, stdlib, p1_utils]},
+  {applications, [kernel, stdlib, p1_utils, syntax_tools]},
   {mod,          {fast_xml,[]}},
 
   %% hex.pm packaging:

then dialyzer detects a lot of errors, mostly related to erl_syntax:

$ rebar3 dialyzer
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling fast_xml
===> Dialyzer starting, this may take a while...
===> Updating plt...
===> Resolving files...
===> Checking 230 files in _build/default/rebar3_25.0.2_plt...
===> Doing success typing analysis...
===> Resolving files...
===> Analyzing 9 files with _build/default/rebar3_25.0.2_plt...

src/fxml_gen.erl
Line 1: Function make_decoders/5 will never be called
Line 1: Function make_decoders_json/4 will never be called
Line 1: Function make_decoding_MFA/9 has no local return
Line 1: The created fun has no local return
Line 1: Function make_encoders/3 will never be called
Line 1: Function make_printer/4 will never be called
Line 1: The created fun has no local return
Line 1: Function make_registrar/1 will never be called
Line 1: Function make_resolver/2 will never be called
Line 1: Function make_top_decoders/3 will never be called
Line 1: Function make_top_decoders_json/2 will never be called
Line 422 Column 1: Function write_module/9 has no local return
Line 467 Column 1: Function write_resolver/4 has no local return
Line 509 Column 1: Function make_aux_funs/0 will never be called
Line 573 Column 1: Function make_local_funs/3 will never be called
Line 645 Column 28: The call string:join(Records::[[[any()],...],...], Sep::[any(),...]) breaks the contract (StringList, Separator) -> String when StringList :: [string()], Separator :: string(), String :: string()
Line 712 Column 1: Function make_atd_records/4 will never be called
Line 806 Column 1: Function record_to_atd_string/3 will never be called
Line 871 Column 1: Function tuple_to_atd_string/5 will never be called
Line 890 Column 1: Function record_to_atd_types/4 will never be called
Line 966 Column 1: Function atd_header/1 will never be called
Line 1225 Column 39: The call fxml_gen:make_function_call(nonempty_string() | {_,nonempty_string()}, [{'var', {1225, 45}, 'El'}]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]},...] (with opaque subterms) as 2nd argument
Line 1233 Column 39: The call fxml_gen:make_function_call(nonempty_string() | {_,nonempty_string()}, [{'var', {1233, 45}, 'El'}]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]},...] (with opaque subterms) as 2nd argument
Line 1243 Column 1: Function make_top_encoders/3 will never be called
Line 1493 Column 1: Function make_getters_setters/3 will never be called
Line 1553 Column 17: The created fun has no local return
Line 1729 Column 30: The call fxml_gen:make_function_call(nonempty_string(), [{'atom',{1733,46},'undefined'} | {'var',{1729 | 1730,15 | 36},'__TopXMLNS' | '_attrs'},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]},...] (with opaque subterms) as 2nd argument
Line 1822 Column 8: The call erl_syntax:clause([{'var', {1822, 14}, '_new_el'}], 'none', [{'tree','list',{'attr',{1824,14},[],'none'},{'list',[{'var',{1824,15},'_new_el'},...],{'tree',atom(),{'attr',erl_anno:anno(),[],'none'},_}}},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 1860 Column 6: The call erl_syntax:clause([{'var', {1860, 12}, '_'}], 'none', [{'tree',atom(),{'attr',erl_anno:anno(),[],'none'},_},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 1869 Column 11: The call erl_syntax:list([{'var', {1869, 17}, '_el'}], {'tree',atom(),{'attr',erl_anno:anno(),[],'none'},_}) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 1893 Column 33: The call erl_syntax:binary_field({'tree',atom(),{'attr',erl_anno:anno(),[],'none'},_}, [{'atom', {1893, 39}, 'binary'}]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 2nd argument
Line 1930 Column 34: The call erl_syntax:clause([{'atom', {1930, 40}, 'error'}], 'none', [{'tree','application',{'attr',{1932,40},[],'none'},{'application',{'tree','module_qualifier',{'attr',{1932,46},[],'none'},{'module_qualifier',{'atom',{1932,40},'erlang'},{'atom',{1932,47},'error'}}},[{'tree','tuple',{'attr',{1933,7},[],'none'},[{'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...]},...]}},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 2120 Column 48: The call erl_syntax:clause([{'var',{2118 | 2119,13 | 67},'__TopXMLNS' | '_acc'} | {'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...], 'none', [{'var', {2120, 54}, '_acc'}]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 3rd argument
Line 2125 Column 42: The call erl_syntax:clause([{'nil', {2125, 48}}, {'var', {2125, 58}, '__TopXMLNS'}, {'var', {2125, 76}, '_acc'}], 'none', [{'var', {2126, 54}, '_acc'}]) does not have opaque terms as 1st and 3rd arguments
Line 2130 Column 19: The call lists:map(fun((_) -> none()), Refs::nonempty_maybe_improper_list()) will never return since the success typing arguments are (fun((_) -> any()),[any()])
Line 2226 Column 27: The call erl_syntax:clause([{'var', {2226, 33}, '_value'}], 'none', [{'tree','tuple',{'attr',{2228,33},[],'none'},[{'var',{2217 | 2294 | 2839 | 2880,42 | 46 | 50 | 52},'_X' | '_val' | '_val1' | '_value'} | {'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...]},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 2236 Column 35: The call erl_syntax:clause([{'var', {2236, 41}, '_'}], 'none', [{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 2243 Column 41: The call fxml_gen:make_function_call(nonempty_string() | {_,nonempty_string()}, [{'atom',{2246,57},'undefined'} | {'var',{2243,47},'_fields'},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]},...] (with opaque subterms) as 2nd argument
Line 2303 Column 19: The call erl_syntax:clause([{'var', {2303, 25}, '_val'}], 'none', [{'var',{2217 | 2294 | 2839 | 2880,42 | 46 | 50 | 52},'_X' | '_val' | '_val1' | '_value'} | {'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 2499 Column 27: The call erl_syntax:clause([{'tree','tuple',{'attr',{2497,33},[],'none'},[{'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...]},...], 'none', [{'atom', {2499, 33}, 'null'}]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 3rd argument
Line 2605 Column 19: The call erl_syntax:clause([{'var', {2605, 25}, '_val'}], 'none', [{'var',{2509 | 2596 | 2672,42 | 46 | 50},'_X' | '_val'} | {'tree',atom(),{'attr',_,[any()],'none' | {_,_,_}},_} | {'wrapper',atom(),{'attr',_,[any()],'none' | {_,_,_}},{'eof',non_neg_integer() | {_,_}} | {'error',{_,_,_}} | {'nil',erl_anno:anno()} | {'warning',{_,_,_}} | {atom(),erl_anno:anno(),_} | {atom(),erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[any()],[any()],[any()]}},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 3258 Column 42: The call erl_syntax:clause([{'var', {3258, 48}, '_res'}], 'none', [{'var', {3258, 68}, '_res'}]) does not have opaque terms as 1st and 3rd arguments
Line 3261 Column 3: The call erl_syntax:clause([{'var', {3261, 9}, '__TopXMLNS'}, {'var', {3262, 9}, '_val'}], 'none', [{'var',{3243,25},'_val'} | {'tree',atom(),{'attr',erl_anno:anno(),[],'none'},_},...]) does not have a term of type [{'eof',non_neg_integer() | {non_neg_integer(),pos_integer()}} | {'error',{non_neg_integer() | {_,_},atom(),_}} | {'nil',erl_anno:anno()} | {'warning',{non_neg_integer() | {_,_},atom(),_}} | {atom(),erl_anno:anno(),_} | {atom(),atom() | erl_anno:anno(),_,_} | {'bin_element' | 'clause' | 'function' | 'op' | 'receive' | 'record' | 'record_field',erl_anno:anno(),_,_,_} | {'try',erl_anno:anno(),[any(),...],[{_,_,_,_,_}],[{_,_,_,_,_}],[any()]}] (with opaque subterms) as 1st argument
Line 3265 Column 1: Function make_encoding_MFA/6 will never be called
Line 3401 Column 1: Function record_fields_to_vars/2 will never be called
Line 3404 Column 1: Function record_fields_to_vars/3 will never be called
===> Warnings written to _build/default/25.0.2.dialyzer_warnings
===> Warnings occurred running dialyzer: 46

xmlcdata not parsed correctly with elixir

Hi,

I have following xmlel

{:xmlel, "image", [{"width", "100"}, {"height", "100"}],
[xmlcdata: "http://example.com/example.jpg"]}

and then i try to parse it with following code

el |> FastXML.xmlel |> :fxml.get_cdata

but only thing i get is empty string...

The whole sotry is that i get xmpp extended message stanza in following form

{:message, "", :normal, "", :undefined, :undefined, [], [], :undefined,
[{:xmlel, "image", [{"width", "100"}, {"height", "100"}],
[xmlcdata: "http://example.com/example.jpg"]}], %{}}

I can then run this through

stanza |> :xmpp.encode |> :fxml.get_subtag_cdata("image")

to get the cdata but in my opinion the whole thing should just work with

el |> :fxml.get_cdata

Dependencies part

Hi,
I download the Expat XML parser from here: https://github.com/libexpat/libexpat/tree/R_2_2_9
I'm trying to use the configure options as you explained but I still get the "libexpat header file expat.h was not found".
I guess I'm just doing something wrong (probably the command line in the terminal or something), Is there a chance you can explain with more details what exactly I need to do (or write and where to write) in order for this to work?
Thanks

multiple definition of `nif_init'

when I compile the fast_xml, I got this:

c_src/fxml_stream.c:94: warning: ‘jabber_client_ns’ defined but not used
c_src/fxml_stream.c:115: warning: ‘dup_str’ defined but not used
c_src/fxml_stream.o: In function `nif_init':
 /home/q/lffan.liu/qtalk-ejabber-tq/deps/fast_xml/c_src/fxml_stream.c:1061:
 multiple definition of `nif_init'
c_src/fxml.o:/home/q/lffan.liu/qtalk-ejabber-tq/deps/fast_xml/c_src/fxml.c:302:
 first defined here
collect2: ld returned 1 exit status
ERROR: cc c_src/fxml.o c_src/fxml_stream.o   -lexpat  -shared  
 -L/home/q/erlang1704/lib/erlang/lib/erl_interface-3.7.20/lib -lerl_interface -lei -o priv/fast_xml_drv.so
 failed with error: 1 and output:
c_src/fxml_stream.o: In function `nif_init':
 /home/q/lffan.liu/qtalk-ejabber-tq/deps/fast_xml/c_src/fxml_stream.c:1061:
 multiple definition of `nif_init'
c_src/fxml.o:/home/q/lffan.liu/qtalk-ejabber-tq/deps/fast_xml/c_src/fxml.c:302:
 first defined here
collect2: ld returned 1 exit status

the version is:

{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.18"}}},

Elixir lib/* missing from hex.pm

Hi. I've found that the lib/fast_xml.ex is not downloaded when I reference fast_xml from my mix.exs using:

defp deps do
  [{:fast_xml, "~> 1.1"}]
end

As a result, FastXML is not available (:fast_xml is, of course). I have had to reference github directly in order to get it to work:

defp deps do
  [{:fast_xml, github: "processone/fast_xml", tag: "1.1.8"}]
end

1.1.25 release?

Can a hex package for 1.1.25 be made please, currently having some issues with building ejabberd 17.11 from source and a dependency chain from processone/xmpp version that's required.

Hex package without Makefile

I was trying to load ejabberd into an existing project to get an XMPP service going, but I've been stumped by build errors.

So I decided to start by just adding the smaller deps

System Arch Linux x86_64
Version 1.1.23
Erlang Erlang/OTP 20 [erts-9.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.5.1

==> fast_xml
make: Makefile: No such file or directory
make: *** No rule to make target 'Makefile'.  Stop.
could not compile dependency :fast_xml, "mix compile" failed. You can recompile this dependency with "mix deps.compile fast_xml", update it with "mix deps.update fast_xml" or clean it with "mix deps.clean fast_xml"
** (Mix) Could not compile with "make" (exit status: 2).
Depending on your OS, make sure to follow these instructions:

  * Mac OS X: You need to have gcc and make installed. Try running the
    commands "gcc --version" and / or "make --version". If these programs
    are not installed, you will be prompted to install them.

  * Linux: You need to have gcc and make installed. If you are using
    Ubuntu or any other Debian-based system, install the packages
    "build-essential". Also install "erlang-dev" package if not
    included in your Erlang/OTP version. If you're on Fedora, run
    "dnf group install 'Development Tools'".

I got around the problem by just using the git version which has the Makefile.

Also the library doesn't seem to play nicely in a Elixir mix based environment, I've had an issue with it being unable to find rebar, this was alleviated by just including rebar in the path:

PATH="$PATH:$HOME/.mix/" mix compile

Not sure why fast_xml doesn't play nicely, I use other packages which also build with rebar (poolboy and cowboy come to mind) and they haven't complained about rebar before

BLOCKER - 1.1.34 is still broken due to p1_util

followup on #36 and i cannot re-open it.

because the rebar.config.script unnecessarily changes direct git/tag/version deps to hex deps/version type of getting dependancies master branch still does not work .

Please fix it either in script file or just by publishing HEX.

@prefiks

How to question

How can i create my own socket type and integrate to ejabberd on a seperate port?
for eg. socket type xml_stream goes to fast_xml what i wanted to create json_stream and get json records to erlang records how can easily use jiffy to use c2s but use json_stream instead of xml_stream ..
I understand this very non-standard use of ejabberd but i am expirementing on somethings for which I need an extra port to listing to json_streams.

application restart fails on OTP 20+

It looks like the application blindly loads the NIF library every time it's started, rather than when the modules are loaded for the first time, returning the error to the OTP start callback. In OTP 20+, NIF reloading is unsupported:

Eshell V10.3.5.16  (abort with ^G)
1> application:ensure_all_started(fast_xml).
{ok,[p1_utils,fast_xml]}
2> application:stop(fast_xml).
=INFO REPORT==== 17-Sep-2021::10:30:30.043155 ===
    application: fast_xml
    exited: stopped
    type: temporary
ok
3> application:ensure_all_started(fast_xml).
=WARNING REPORT==== 17-Sep-2021::10:30:34.680875 ===
unable to load fxml NIF: {error,
                             {reload,
                                 "NIF library already loaded (reload disallowed since OTP 20)."}}

=ERROR REPORT==== 17-Sep-2021::10:30:34.681111 ===
failed to load NIF /Users/nal/src/alertlogic/data_processing/daccess/_build/default/lib/fast_xml/priv/lib/fxml_stream: NIF library already loaded (reload disallowed since OTP 20).
=CRASH REPORT==== 17-Sep-2021::10:30:34.681300 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.1706.0>
    registered_name: []
    exception exit: {unable_to_load_nif,{fast_xml,start,[normal,[]]}}
      in function  application_master:init/4 (application_master.erl, line 138)
    ancestors: [<0.1705.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.1707.0>,normal}]
    links: [<0.1705.0>,<0.43.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 222
  neighbours:

=INFO REPORT==== 17-Sep-2021::10:30:34.706811 ===
    application: fast_xml
    exited: {unable_to_load_nif,{fast_xml,start,[normal,[]]}}
    type: temporary
{error,{fast_xml,{unable_to_load_nif,{fast_xml,start,
                                               [normal,[]]}}}}

This means that if the application is ever stopped during runtime for any reason, it can never be started again—and that means that any apps with a normal OTP dependency on it, if they are also stopped, will fail to start through the application:ensure_all_started/1,2 interface. This seems to go against Erlang/OTP and NIF best practices. It seems like the NIF initialization for fxml and fxml_stream ought to be moved to an -on_load() directive in each respective module, with the OTP application:start/2 callback maybe triggering a function to make sure the modules are loaded, if there is a desire to prevent the usual lazy beam/NIF loading.

I wasn't sure if this was an issue because of the call to p1_nif_utils: get_so_path/3, but that looks like it doesn't have any runtime dependencies itself and wouldn't be harmed much by being called prior to fastxml and p1_utils OTP application starts:

https://github.com/processone/p1_utils/blob/013621b9b8e3d6ce22aba731bdd322fcfaf0b573/src/p1_nif_utils.erl#L28-L64

Still, I wanted to ask the authors if there was a reason for the current implementation. If there's no opposition, I am happy to make a PR to shift the loading logic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.