-traiter_xml(Contenu) ->\r
- {XML, _} = xmerl_scan:string(Contenu),\r
- traiter_action(XML#xmlElement.attributes, XML).\r
- \r
+traiter_donnees(Contenu) ->
+ % FIXME : ne plus encapsuler le JSON dans de l'xml... apparement yaws veux absolument de l'xml (voir post mi-avril 2008 sur la mailing list)\r
+ Reponse = case xmerl_scan:string(Contenu) of
+ {#xmlElement{name = json, content = [#xmlText{value = J}|_]}, _} ->
+ case json:decode_string(J) of
+ {ok, {struct, [{action, Action}| Reste]}} ->
+ %io:format("~p~n", [euphorik_protocole:login(JSON)]),
+ json:encode(traiter_action(Action, Reste));
+ _ ->
+ error
+ end;
+ _ -> error
+ end,
+ if Reponse =:= error ->
+ euphorik_protocole:erreur("Format XML/JSON incorrect");
+ true ->
+ Reponse
+ end.
+