Safe Haskell | None |
---|---|
Language | Haskell2010 |
Document type declaration parsers.
https://www.w3.org/TR/REC-xml/#dt-doctype
All documentation examples assume the following setup:
:set -XOverloadedStrings import Data.Attoparsec.ByteString
Synopsis
- data Doctype = Doctype Text (Maybe ExternalID) InternalSubset
- doctype :: CharParsing m => Monad m => m Doctype
Documentation
doctype :: CharParsing m => Monad m => m Doctype Source #
https://www.w3.org/TR/REC-xml/#NT-doctypedecl
>>>
parseOnly doctype "<!DOCTYPE greeting SYSTEM 'hello.dtd'>"
Right (Doctype "greeting" (Just (SystemID "hello.dtd")) (InternalSubset {_elementTypes = [], _attributeLists = [], _generalEntities = [], _parameterEntities = [], _notations = [], _instructions = []}))>>>
parseOnly doctype "<!DOCTYPE foo [ <!ENTITY x '<'> ]>"
Right (Doctype "foo" Nothing (InternalSubset {_elementTypes = [], _attributeLists = [], _generalEntities = [GeneralEntity "x" [ContentReference (EntityRef "lt")]], _parameterEntities = [], _notations = [], _instructions = []}))