diff options
author | Alexey Shchepin <alexey@process-one.net> | 2006-04-05 23:56:16 +0000 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2006-04-05 23:56:16 +0000 |
commit | a5a978946d43dbac0e24e1aefbc1612c82b2c519 (patch) | |
tree | 45c945255f6790d3da64c547b0341bf1e24d6b6e | |
parent | * src/msgs/ru.msg: Updated (thanks to Sergei Golovan) (diff) |
* src/expat_erl.c: Use binaries for CDATA
* src/xml.erl: Likewise
SVN Revision: 526
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/expat_erl.c | 2 | ||||
-rw-r--r-- | src/xml.erl | 10 |
3 files changed, 12 insertions, 5 deletions
@@ -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) diff --git a/src/expat_erl.c b/src/expat_erl.c index 1b197dace..e4c3fd10b 100644 --- a/src/expat_erl.c +++ b/src/expat_erl.c @@ -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; } diff --git a/src/xml.erl b/src/xml.erl index 222e49b3e..888618867 100644 --- a/src/xml.erl +++ b/src/xml.erl @@ -105,7 +105,7 @@ attr_to_list({Name, Value}) -> %crypt([], R) -> % R. -crypt(S) -> +crypt(S) when is_list(S) -> [case C of $& -> "&"; $< -> "<"; @@ -113,7 +113,9 @@ crypt(S) -> $" -> """; $' -> "'"; _ -> 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) -> |