dtd-0.6.0: Parse and render DTD files

MaintainerYitzchak Gale <gale@sefer.org>
Safe HaskellSafe-Infered




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.


Parsing a DTD

dtd :: Parser DTDSource

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.

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.

pERef :: Parser PERefSource

Parse a parameter entity reference

notation :: Parser NotationSource

Parse a declaration of a notation.

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 ContentModelSource

Parse the model of structured content for an element.

repeatChar :: Parser RepeatSource

Parse a repetition character.

Attribute declarations

attList :: Parser AttListSource

Parse a list of attribute declarations for an element.

attDecl :: Parser AttDeclSource

Parse the three-part declaration of an attribute.

attType :: Parser AttTypeSource

Parse the type of an attribute.

attDefault :: Parser AttDefaultSource

Parse a default value specification for an attribute.

Declarations of comments and processing instructions

instruction :: Parser InstructionSource

Parse a processing instruction.

comment :: Parser TextSource

Parse a comment

Parsing combinators for general DTD syntax

externalID :: Parser ExternalIDSource

Parse an external ID.

name :: Parser TextSource

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.

nameSS :: Parser TextSource

Parse a DTD name followed by optional white space.

quoted :: Parser TextSource

A single-quoted or double-quoted string. The quotation marks are dropped.

skipWS :: Parser ()Source

Skip zero or more characters of white space

ws :: Parser CharSource

Parse one character of white space.