/usr/lib/hugs/packages/HaXml/programs/Validate/Main.hs is in libhugs-haxml-bundled 98.200609.21-5.4+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | module Main where
import System (getArgs)
import IO
import List (isSuffixOf)
import Maybe (fromJust)
import Text.XML.HaXml.Types (Document(..),Content(..))
import Text.XML.HaXml.Parse (xmlParse,dtdParse)
import Text.XML.HaXml.Validate (validate)
import Text.XML.HaXml.Wrappers (fix2Args)
-- This is a fairly trivial application that reads a DTD from a file,
-- an XML document from another file (or stdin), and writes any validation
-- errors to stdout.
main = do
(dtdf,xmlf) <- fix2Args
dtdtext <- ( if dtdf=="-" then error "Usage: validate dtdfile [xmlfile]"
else readFile dtdf )
content <- ( if xmlf=="-" then getContents else readFile xmlf )
let dtd = dtdParse dtdf dtdtext
Document _ _ xml _ = xmlParse xmlf content
errs = validate (fromJust dtd) xml
mapM_ putStrLn errs
hFlush stdout
|