Safe Haskell | None |
---|---|
Language | Haskell2010 |
Mid-level parsers for doctype's internal subset, built on top of Data.XML.InternalSubset.Parser.Low:
- some formatting details are abstracted away (e.g. quoting, whitespacing), therefore parsers are not reversible
- entities delimited by an opening and closing sequence are recognized
- token parsers do not overlap, therefore XML document can be tokenized in a stateless way
All documentation examples assume the following setup:
:set -XOverloadedStrings import Data.Attoparsec.ByteString
Synopsis
- module Data.XML.Parser.Mid.Comment
- module Data.XML.Parser.Mid.ExternalID
- module Data.XML.Parser.Mid.Instruction
- data ElementType = ElementType Text ElementTypeContent
- newtype AttributeList = AttributeList Text
- data GeneralEntity = GeneralEntity Text [Content]
- data ParameterEntity = ParameterEntity Text [EntityValue]
- data Notation = Notation Text ExternalID
- data Token
- data TokenParser m a
- runTokenParser :: TokenParser m a -> m a
- tokenElementType :: CharParsing m => Monad m => TokenParser m ElementType
- tokenAttributeList :: CharParsing m => Monad m => TokenParser m AttributeList
- tokenGeneralEntity :: CharParsing m => Monad m => TokenParser m GeneralEntity
- tokenParameterEntity :: CharParsing m => Monad m => TokenParser m ParameterEntity
- tokenNotation :: CharParsing m => Monad m => TokenParser m Notation
- tokenInstruction :: CharParsing m => Monad m => TokenParser m Instruction
- tokenComment :: CharParsing m => Monad m => TokenParser m Text
- anyToken :: CharParsing m => Monad m => TokenParser m Token
Documentation
module Data.XML.Parser.Mid.Comment
data ElementType Source #
ElementType Text ElementTypeContent |
Instances
Eq ElementType Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid (==) :: ElementType -> ElementType -> Bool # (/=) :: ElementType -> ElementType -> Bool # | |
Ord ElementType Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid compare :: ElementType -> ElementType -> Ordering # (<) :: ElementType -> ElementType -> Bool # (<=) :: ElementType -> ElementType -> Bool # (>) :: ElementType -> ElementType -> Bool # (>=) :: ElementType -> ElementType -> Bool # max :: ElementType -> ElementType -> ElementType # min :: ElementType -> ElementType -> ElementType # | |
Read ElementType Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid readsPrec :: Int -> ReadS ElementType # readList :: ReadS [ElementType] # readPrec :: ReadPrec ElementType # readListPrec :: ReadPrec [ElementType] # | |
Show ElementType Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid showsPrec :: Int -> ElementType -> ShowS # show :: ElementType -> String # showList :: [ElementType] -> ShowS # |
newtype AttributeList Source #
https://www.w3.org/TR/REC-xml/#NT-AttlistDecl
Missing: attribute definition
Instances
Eq AttributeList Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid (==) :: AttributeList -> AttributeList -> Bool # (/=) :: AttributeList -> AttributeList -> Bool # | |
Ord AttributeList Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid compare :: AttributeList -> AttributeList -> Ordering # (<) :: AttributeList -> AttributeList -> Bool # (<=) :: AttributeList -> AttributeList -> Bool # (>) :: AttributeList -> AttributeList -> Bool # (>=) :: AttributeList -> AttributeList -> Bool # max :: AttributeList -> AttributeList -> AttributeList # min :: AttributeList -> AttributeList -> AttributeList # | |
Read AttributeList Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid readsPrec :: Int -> ReadS AttributeList # readList :: ReadS [AttributeList] # | |
Show AttributeList Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid showsPrec :: Int -> AttributeList -> ShowS # show :: AttributeList -> String # showList :: [AttributeList] -> ShowS # |
data GeneralEntity Source #
Instances
Eq GeneralEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid (==) :: GeneralEntity -> GeneralEntity -> Bool # (/=) :: GeneralEntity -> GeneralEntity -> Bool # | |
Ord GeneralEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid compare :: GeneralEntity -> GeneralEntity -> Ordering # (<) :: GeneralEntity -> GeneralEntity -> Bool # (<=) :: GeneralEntity -> GeneralEntity -> Bool # (>) :: GeneralEntity -> GeneralEntity -> Bool # (>=) :: GeneralEntity -> GeneralEntity -> Bool # max :: GeneralEntity -> GeneralEntity -> GeneralEntity # min :: GeneralEntity -> GeneralEntity -> GeneralEntity # | |
Read GeneralEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid readsPrec :: Int -> ReadS GeneralEntity # readList :: ReadS [GeneralEntity] # | |
Show GeneralEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid showsPrec :: Int -> GeneralEntity -> ShowS # show :: GeneralEntity -> String # showList :: [GeneralEntity] -> ShowS # |
data ParameterEntity Source #
Instances
Eq ParameterEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid (==) :: ParameterEntity -> ParameterEntity -> Bool # (/=) :: ParameterEntity -> ParameterEntity -> Bool # | |
Ord ParameterEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid compare :: ParameterEntity -> ParameterEntity -> Ordering # (<) :: ParameterEntity -> ParameterEntity -> Bool # (<=) :: ParameterEntity -> ParameterEntity -> Bool # (>) :: ParameterEntity -> ParameterEntity -> Bool # (>=) :: ParameterEntity -> ParameterEntity -> Bool # max :: ParameterEntity -> ParameterEntity -> ParameterEntity # min :: ParameterEntity -> ParameterEntity -> ParameterEntity # | |
Read ParameterEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid | |
Show ParameterEntity Source # | |
Defined in Data.XML.InternalSubset.Parser.Mid showsPrec :: Int -> ParameterEntity -> ShowS # show :: ParameterEntity -> String # showList :: [ParameterEntity] -> ShowS # |
data TokenParser m a Source #
A parser that consumes whole Token
s.
Instances
runTokenParser :: TokenParser m a -> m a Source #
tokenElementType :: CharParsing m => Monad m => TokenParser m ElementType Source #
https://www.w3.org/TR/REC-xml/#NT-elementdecl
>>>
parseOnly (runTokenParser tokenElementType) "<!ELEMENT br EMPTY>"
Right (ElementType "br" ContentEmpty)>>>
parseOnly (runTokenParser tokenElementType) "<!ELEMENT container ANY>"
Right (ElementType "container" ContentAny)
tokenAttributeList :: CharParsing m => Monad m => TokenParser m AttributeList Source #
https://www.w3.org/TR/REC-xml/#NT-AttlistDecl
>>>
parseOnly (runTokenParser tokenAttributeList) "<!ATTLIST termdef>"
Right (AttributeList "termdef")
tokenGeneralEntity :: CharParsing m => Monad m => TokenParser m GeneralEntity Source #
https://www.w3.org/TR/REC-xml/#NT-GEDecl
>>>
parseOnly (runTokenParser tokenGeneralEntity) "<!ENTITY d '
'>"
Right (GeneralEntity "d" [ContentReference (CharRef '\r')])>>>
parseOnly (runTokenParser tokenGeneralEntity) "<!ENTITY da '
'>"
Right (GeneralEntity "da" [ContentReference (CharRef '\r'),ContentReference (CharRef '\n')])>>>
parseOnly (runTokenParser tokenGeneralEntity) "<!ENTITY Pub-Status 'This is a pre-release of the specification.'>"
Right (GeneralEntity "Pub-Status" [ContentText "This is a pre-release of the specification."])
tokenParameterEntity :: CharParsing m => Monad m => TokenParser m ParameterEntity Source #
https://www.w3.org/TR/REC-xml/#NT-PEDecl
>>>
parseOnly (runTokenParser tokenParameterEntity) "<!ENTITY % YN '\"Yes\"' >"
Right (ParameterEntity "YN" [ValueText "\"Yes\""])
tokenNotation :: CharParsing m => Monad m => TokenParser m Notation Source #
https://www.w3.org/TR/REC-xml/#NT-NotationDecl
>>>
parseOnly (runTokenParser tokenNotation) "<!NOTATION foo SYSTEM \"identifier\">"
Right (Notation "foo" (SystemID "identifier"))
tokenInstruction :: CharParsing m => Monad m => TokenParser m Instruction Source #
tokenComment :: CharParsing m => Monad m => TokenParser m Text Source #
anyToken :: CharParsing m => Monad m => TokenParser m Token Source #
Parse any Token
.