0 | module Language.XML.Misc
2 | import Data.String.Parser
5 | data Misc = Comment String | ProcessingInstruction String String
11 | show (Comment comment) = "<!--\{comment}-->"
12 | show (ProcessingInstruction target instruction) = "<?\{target} \{instruction}?>"
15 | comment : Parser Misc
16 | comment = (map Comment (string "<!--" *> takeUntil "-->")) <?> "XML comment"
19 | processingInstruction : Parser Misc
20 | processingInstruction = (do
21 | ignore $
string "<?"
22 | target <- pack <$> many letter
24 | instruction <- takeUntil "?>"
25 | pure $
ProcessingInstruction target instruction
26 | ) <?> "XML processing instruction"
30 | misc = comment <|> processingInstruction