Can not fetch and process xml resources

    let url = "http://localhost:1234/" <> formatYearMonth dt <> "/" <> formatDate dt <> ".xml"
    res <- get document url
    case res of
      Left err -> do
        liftEffect $ log $ "TCMB exchange request error:" <> printError err
        pure Nothing
      Right response@{body} -> do
        ...

get function is from Affjax module.

This code writes TCMB exchange request error:There was a problem with the response body: Type mismatch: expected Document, found XMLDocument to the console.

How can I receive and process xml resources?

Thanks in advance.

probably new ResponseFormat.ResponseFormat a should be added

Iā€™m not sure, but error probably happens here https://github.com/purescript-contrib/purescript-affjax/blob/3eb5119fef73a97dfbc4ece5e8925bf95c746a80/src/Affjax.purs#L240

1 Like

Exactly.

I parsed the response by retreiving as string and parsing by purescript-web-dom-parser. This works but adds an extra step of parsing.

ResponseFormat for XMLDocument would be handy.

1 Like