我正在尝试解析以下 XML 文档HXT
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Key</key>
<string>Value</string>
</dict>
</plist>
我不想在这里进行任何验证,因为它需要网络访问。不幸的是,HXT 仍然希望安装hxt-curl
/hxt-http
包来解析这个简单的文档:
Prelude> :m +Text.XML.HXT.Core
Prelude Text.XML.HXT.Core> runX $ readDocument [withValidate no] "example.xml"
fatal error: HTTP handler not configured,
please install package hxt-curl and use 'withCurl' config option
or install package hxt-http and use 'withHTTP' config option
我不想将hxt-curl
/hxt-http
包添加到依赖项列表中,因为我真的不需要它们。我无法更改正在解析的文档。移动到另一个 xml 解析库也是不可取的。
有没有办法在不添加不必要的包的情况下使用 HXT 解析示例文档?