* src/xml.erl: More verbose error reporting for

element_to_string (thanks to Magnus Henoch)(EJAB-301)

SVN Revision: 2045
This commit is contained in:
Badlop 2009-04-27 21:36:41 +00:00
parent 7c4e7dea4b
commit e45e486fd2
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2009-04-27 Badlop <badlop@process-one.net>
* src/xml.erl: More verbose error reporting for
element_to_string (thanks to Magnus Henoch)(EJAB-301)
* src/translate.erl: Support additional files (EJAB-925)
* contrib/extract_translations/extract_translations.erl: Likewise
* contrib/extract_translations/prepare-translation.sh: Likewise

View File

@ -47,12 +47,20 @@
-endif.
element_to_string(El) ->
case catch element_to_string_nocatch(El) of
{'EXIT', Reason} ->
erlang:error({badxml, El, Reason});
Result ->
Result
end.
element_to_string_nocatch(El) ->
case El of
{xmlelement, Name, Attrs, Els} ->
if
Els /= [] ->
[$<, Name, attrs_to_list(Attrs), $>,
[element_to_string(E) || E <- Els],
[element_to_string_nocatch(E) || E <- Els],
$<, $/, Name, $>];
true ->
[$<, Name, attrs_to_list(Attrs), $/, $>]