hextream-0.1.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

externalID :: CharParsing m => Monad m => m ExternalID Source #

https://www.w3.org/TR/REC-xml/#NT-ExternalID

>>> parseOnly externalID "PUBLIC '-//Textuality//TEXT Standard open-hatch boilerplate//EN' 'http://www.textuality.com/boilerplate/OpenHatch.xml'"
Right (PublicID "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml")
>>> parseOnly externalID "SYSTEM '../grafix/OpenHatch.gif'"
Right (SystemID "../grafix/OpenHatch.gif")

data GeneralEntityDeclaration Source #

generalEntityDeclaration :: CharParsing m => Monad m => m GeneralEntityDeclaration Source #

https://www.w3.org/TR/REC-xml/#NT-GEDecl

>>> parseOnly generalEntityDeclaration "<!ENTITY d '&#xD;'>"
Right (GeneralEntityDeclaration "d" [ContentReference (CharRef '\r')])
>>> parseOnly generalEntityDeclaration "<!ENTITY da '&#xD;&#xA;'>"
Right (GeneralEntityDeclaration "da" [ContentReference (CharRef '\r'),ContentReference (CharRef '\n')])
>>> parseOnly generalEntityDeclaration "<!ENTITY Pub-Status 'This is a pre-release of the specification.'>"
Right (GeneralEntityDeclaration "Pub-Status" [ContentText "This is a pre-release of the specification."])

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")) [])
>>> parseOnly doctype "<!DOCTYPE foo [ <!ENTITY x '&lt;'> ]>"
Right (Doctype "foo" Nothing [GeneralEntityDeclaration "x" [ContentReference (EntityRef "lt")]])