How to parse XML with Opa?

1den

New Member
if you want to connect an Opa web client with a XML-RPC server. The right way to send a request is probably\[code\]xml request_body = @xml( <methodCall> <methodName>my_rpc_method</methodName> <params>some_rpc_params</params> </methodCall>)request = WebClient.Post.of_xml( {WebClient.Post.default_options with content: {some: request_body} })WebClient.Post.try_post_with_options_async( server_uri, request, callback)function callback(response) { ...}\[/code\]Now, what is the right way to parse the server response back into an Opa XML data structure? I have currently created my own XML parser for that, but this is certainly not the best practice.The API shows several XML parsing functions like:but which of those would be the right one? The documentation doesn't (yet) tell much about their usage. Or might it be right to convert the server response directly in XML form via WebClient.Result.as_xml?I created a repository that contains runnable code with the given problem. Feel free to fork and fix it.What would be the best (and easiest) way to parse such a XML server response into a corresponding data structure?JHannes
 
Back
Top