[erlang-questions] xmerl simple form

Martin Dimitrov mrtndimitrov@REDACTED
Mon Dec 26 17:12:39 CET 2011


Hello Sergej,

Thanks for sharing this code. I cannot find documentation for the
xmerl_lib module? What does simplify_element/1 do?

Regards,

Martin

On 12/26/2011 5:20 PM, Rapsey wrote:
> 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
>>




More information about the erlang-questions mailing list