論文のセクション 3 に到達しました。M. Ohlendorf のRDF ドキュメントを処理するための例を含む Haskell XML ツールボックスのクックブック。
ここに私が書いたプログラムがあります、
import Text.XML.HXT.Core
import System.Exit
import System.Environment
import Data.Maybe
main = do
args <- getArgs
(al, src) <- cmdLineOpts args
[rc] <- runX (processDocument al src)
exitWith ( if rc >= c_err
then ExitFailure (-1)
else ExitSuccess
)
cmdLineOpts :: [String] -> IO (Attributes, String)
cmdLineOpts [] = return ([("","")], "")
cmdLineOpts xss = return (zip [""] xss :: Attributes, last xss)
processDocument :: Attributes -> String -> IOSArrow b Int
processDocument al src =
readDocument al src -- lecture du document en appliquant les attributes
>>>
removeAllWhiteSpace >>> propagateNamespaces
>>>
writeDocument al (fromMaybe "" (lookup a_output_file al))
>>>
getErrStatus
しかし、私はまだ次のエラーを経験しています
hxtuto.hs:28:17:
Couldn't match expected type `XIOSysState -> XIOSysState'
against inferred type `(String, String)'
Expected type: SysConfigList
Inferred type: Attributes
In the first argument of `readDocument', namely `al'
In the first argument of `(>>>)', namely `readDocument al src'
Failed, modules loaded: none.
それは私の実装のようですが、cmdLineOpts
うまく適合していないようです。
ここで何が問題ですか?どうすれば修正できますか?
助けてくれてありがとう!