[erlang-questions] xmerl simple form
Rapsey
rapsey@REDACTED
Mon Dec 26 16:20:06 CET 2011
I use this:
parsexml(I,O) when is_binary(I) ->
parsexml(tolist(I),O);
parsexml(InputXml,Opt) ->
try {Xml,_} = xmerl_scan:string(InputXml,
[{space,normalize},{encoding,"utf-8"},{validation,off}|Opt]),
strip_whitespace(xmerl_lib:simplify_element(Xml)) of
Res ->
Res
catch
error:_X ->
io:format("~p", [_X]),
false
end.
strip_whitespace({El,Attr,Children}) ->
NChild = lists:filter(fun(X) ->
case X of
" " -> false;
_ -> true
end
end,Children),
Ch = lists:map(fun(X) -> strip_whitespace(X) end,NChild),
{El,Attr,Ch};
strip_whitespace(String) ->
String.
Sergej
On Mon, Dec 26, 2011 at 2:54 PM, Martin Dimitrov <mrtndimitrov@REDACTED>wrote:
> Hello,
>
> There is an example in the user's guide
> (http://www1.erlang.org/doc/apps/xmerl/xmerl_ug.html#id58936) of how to
> export to XML format a structure in the so called 'simple form'.
> Is there a method to parse XML document to this 'simple form'?
>
> Regards,
>
> Martin
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111226/46637ba0/attachment.htm>
More information about the erlang-questions
mailing list