hextream-0.3.0.0: Streaming-friendly XML parsers
Safe HaskellNone
LanguageHaskell2010

Data.XML.Parser.Mid.Doctype

Description

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

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 '&lt;'> ]>"
Right (Doctype "foo" Nothing (InternalSubset {_elementTypes = [], _attributeLists = [], _generalEntities = [GeneralEntity "x" [ContentReference (EntityRef "lt")]], _parameterEntities = [], _notations = [], _instructions = []}))