* src/expat_erl.c: Use binaries for CDATA

* src/xml.erl: Likewise

SVN Revision: 526
This commit is contained in:
Alexey Shchepin 2006-04-05 23:56:16 +00:00
parent ed43f8024c
commit a5a978946d
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2006-04-06 Alexey Shchepin <alexey@sevcom.net>
* src/expat_erl.c: Use binaries for CDATA
* src/xml.erl: Likewise
2006-04-02 Alexey Shchepin <alexey@sevcom.net>
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)

View File

@ -164,7 +164,7 @@ void *erlXML_CharacterDataHandler(expat_data *d,
ei_x_encode_list_header(&event_buf, 1);
ei_x_encode_tuple_header(&event_buf, 2);
ei_x_encode_long(&event_buf, XML_CDATA);
ei_x_encode_string_len_fixed(&event_buf, s, len);
ei_x_encode_binary(&event_buf, s, len);
return NULL;
}

View File

@ -105,7 +105,7 @@ attr_to_list({Name, Value}) ->
%crypt([], R) ->
% R.
crypt(S) ->
crypt(S) when is_list(S) ->
[case C of
$& -> "&amp;";
$< -> "&lt;";
@ -113,7 +113,9 @@ crypt(S) ->
$" -> "&quot;";
$' -> "&apos;";
_ -> C
end || C <- S].
end || C <- S];
crypt(S) when is_binary(S) ->
crypt(binary_to_list(S)).
%crypt1(S) ->
% lists:flatten([case C of
@ -159,10 +161,10 @@ remove_cdata(L) -> [E || E <- L, remove_cdata_p(E)].
% R.
get_cdata(L) ->
get_cdata(L, "").
binary_to_list(list_to_binary(get_cdata(L, ""))).
get_cdata([{xmlcdata, CData} | L], S) ->
get_cdata(L, S ++ CData);
get_cdata(L, [S, CData]);
get_cdata([_ | L], S) ->
get_cdata(L, S);
get_cdata([], S) ->