aboutsummaryrefslogtreecommitdiff
path: root/src/xml.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml.erl')
-rw-r--r--src/xml.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/xml.erl b/src/xml.erl
index 9a9a7f833..22746b10a 100644
--- a/src/xml.erl
+++ b/src/xml.erl
@@ -37,8 +37,11 @@
get_subtag/2, get_subtag_cdata/2,
append_subtags/2,
get_path_s/2,
+ start/0,
replace_tag_attr/3]).
+-include("ejabberd.hrl").
+
%% Select at compile time how to escape characters in binary text
%% nodes.
%% Can be choosen with ./configure --enable-full-xml
@@ -48,6 +51,22 @@
-define(ESCAPE_BINARY(CData), crypt(CData)).
-endif.
+%% Replace element_to_binary/1 with NIF
+%% Can be choosen with ./configure --enable-nif
+-ifdef(NIF).
+start() ->
+ SOPath = filename:join(ejabberd:get_so_path(), "xml"),
+ case catch erlang:load_nif(SOPath, 0) of
+ ok ->
+ ok;
+ Err ->
+ ?WARNING_MSG("unable to load xml NIF: ~p", [Err])
+ end.
+-else.
+start() ->
+ ok.
+-endif.
+
element_to_binary(El) ->
iolist_to_binary(element_to_string(El)).