Created
December 17, 2016 01:55
-
-
Save patrickt/6b6b98e9a986ac70f5af5e5dbd1de80b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Given a file at /tmp/lol.xml | |
<!DOCTYPE html> | |
<body> | |
lol! | |
</body> | |
-} | |
import qualified Text.XML as X | |
import qualified Text.HTML.DOM as HTML | |
getPrologue :: X.Document -> Maybe X.Doctype | |
getPrologue = X.prologueDoctype . X.documentPrologue | |
-- trying to get the prologue with html-conduit | |
getPrologue <$> HTML.readFile "/tmp/lol.xml" | |
-- yields Nothing. but if you try it with xml-conduit | |
getPrologue <$> X.readFile X.def "/tmp/lol.xml" | |
-- you get back `Just (Doctype {doctypeName = "html", doctypeID = Nothing})` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment