Haskell HXT:使用远程DTD解析xml文档而不使用hxt-curl
发布时间:2020-12-16 23:14:16 所属栏目:百科 来源:网络整理
导读:我正在尝试使用HXT解析以下 XML文档: ?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 keyKey/key stringValue/string/dict/plist 我
我正在尝试使用HXT解析以下
XML文档:
<?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> 我不想在这里进行任何验证,因为它需要网络访问. 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解析示例文档而不添加不必要的包? 解决方法
你还要声明withSubstDTDEntities no,i.即
runX $readDocument [withValidate no,withSubstDTDEntities no] "example.xml" 说明:此配置的默认值为yes,我猜这就是hxt尝试下载dtd文件的原因.从the documentation开始:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |