Portability | portable |
---|---|
Maintainer | Montez Fitzpatrick <montezf@gmail.com> |
Safe Haskell | None |
This module provides a Data.Attoparsec.Text parser for XML Document Type Declaration (DTD) documents. A higher-level interface that implements parameter entity resolution is also provided.
- dtd :: Parser DTD
- parseDTD :: Text -> DTD
- parseDTDWithExtern :: SymTable -> Text -> DTD
- type SymTable = Map Text Text
- textDecl :: Parser DTDTextDecl
- dtdComponent :: Parser DTDComponent
- entityDecl :: Parser EntityDecl
- entityValue :: Parser [EntityValue]
- pERef :: Parser PERef
- notation :: Parser Notation
- notationSrc :: Parser NotationSource
- elementDecl :: Parser ElementDecl
- contentDecl :: Parser ContentDecl
- contentModel :: Parser Text ContentModel
- repeatChar :: Parser Repeat
- attList :: Parser AttList
- attDecl :: Parser AttDecl
- attType :: Parser AttType
- attDefault :: Parser AttDefault
- instruction :: Parser Instruction
- comment :: Parser Text
- externalID :: Parser ExternalID
- name :: Parser Text
- nameSS :: Parser Text
- quoted :: Parser Text
Parsing a DTD
Parse a DTD. Parameter entity substitution is not supported by this parser, so parameter entities cannot appear in places where a valid DTD syntax production cannot be determined without resolving them.
Parse a DTD from lazy Text
while fully resolving the values
of all parameter entities whose values are provided internally in
the DTD. If the syntax of the DTD is invalid, all declarations up
to the first invalid one are returned.
parseDTDWithExtern :: SymTable -> Text -> DTDSource
Parse a DTD from lazy Text
while fully resolving the values
of parameter entities. The given table of values is used to resolve
external parameter entities.
If you need information from the DTD itself to look up the external
entities, such as system and public IDs, you might be able to get
the information by applying parseDTD
to the DTD or part of it for
an initial parse.
Top-level DTD structure
textDecl :: Parser DTDTextDeclSource
Parse an ?xml
text declaration at the beginning of a DTD
.
dtdComponent :: Parser DTDComponentSource
Parse a single component of a DTD
. Conditional sections are
currently not supported.
Entity declarations and references
entityDecl :: Parser EntityDeclSource
Parse an entity declaration.
entityValue :: Parser [EntityValue]Source
Parse an entity value. An entity value is a quoted string possibly containing parameter entity references.
notationSrc :: Parser NotationSourceSource
Parse a source for a notation.
Element declarations
elementDecl :: Parser ElementDeclSource
Parse the declaration of an element.
contentDecl :: Parser ContentDeclSource
Parse the content that can occur in an element.
contentModel :: Parser Text ContentModelSource
Parse the model of structured content for an element.
repeatChar :: Parser RepeatSource
Parse a repetition character.
Attribute declarations
attDefault :: Parser AttDefaultSource
Parse a default value specification for an attribute.
Declarations of comments and processing instructions
instruction :: Parser InstructionSource
Parse a processing instruction.
Parsing combinators for general DTD syntax
externalID :: Parser ExternalIDSource
Parse an external ID.
Parse a DTD name. We are much more liberal than the spec: we
allow any characters that will not interfere with other DTD
syntax. This parser subsumes both Name
and NmToken
in the spec,
and more.