有没有办法用 Purescript 解析 XML?

Is there a way to parse XML with Purescript?

我正在研究函数式编程方法来编写一个简单的 Web 应用程序来执行类似 XSLT 的操作。我正在考虑尝试使用 Purescript,但我需要确保可以(并且相对容易)使用它来解析 XML。有没有办法做到这一点?我找到 purescript-xml 但它似乎已经死了(不再追求)。我错过了什么吗?

我为 DOMParser and then used the standard DOM library purescript-dom 做了一个简单的国外导入。

purescript-domparser 中有绑定,但我不关心它们。我没有理由辨别代表 DOMParser 对象。

这是我用的:

exports.parseXML = function (s) {
  return new DOMParser().parseFromString(s, 'application/xml');
}

foreign import parseXML :: String -> Document

不幸的是,DOMParser 无法直接确定解析是否失败。失败时,它仍然 returns 是一个有效的 Document 但只包含有关错误的信息。