-traiter_xml(Contenu) ->\r
- {XML, _} = xmerl_scan:string(Contenu),\r
- traiter_action(XML#xmlElement.attributes, XML).\r
- \r
-
+traiter_donnees(Contenu) ->\r
+ case xmerl_scan:string(Contenu) of
+ {XML, _} ->
+ case XML of
+ #xmlElement{name = json, content = [#xmlText{value = J}|_]} ->
+ case json:decode_string(J) of
+ {ok, {struct, [{action, Action}| Reste]}} ->
+ traiter_action(Action, Reste);
+ _ ->
+ erreur
+ end;
+ _ ->
+ traiter_action(XML#xmlElement.attributes, XML)
+ end;
+ _ -> erreur
+ end.\r
+
+
+traiter_action("authentification", JSON) ->
+ euphorik_protocole:login(JSON);