-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhxt.hs
36 lines (31 loc) · 1 KB
/
hxt.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Text.XML.HXT.Core
-- import Text.XML.HXT.... -- further HXT packages
import System.IO
import System.Environment
import System.Console.GetOpt
import System.Exit
main :: IO ()
main = do
argv <- getArgs
let inp = argv !! 0
let out = argv !! 1
[rc] <- runX (application [withValidate no] inp out)
if rc >= c_err
then exitWith (ExitFailure (0-1))
else exitWith ExitSuccess
-- | the main arrow
application :: SysConfigList -> String -> String -> IOSArrow b Int
application cfg src dst
= configSysVars cfg
>>>
readDocument [] src
>>>
processChildren (processDocumentRootElement `when` isElem)
>>>
writeDocument [] dst
>>>
getErrStatus
-- | the dummy for the real processing: the identity filter
processDocumentRootElement :: IOSArrow XmlTree XmlTree
processDocumentRootElement
= this