Copyright | Suite Solutions Ltd. Israel 2011 |
---|---|
Maintainer | Yitzchak Gale <gale@sefer.org> |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
This module provides types to represent an XML Document Type Declaration (DTD) as defined in W3C specifications (http://www.w3.org/XML/Core/#Publications). It is intended to be compatible with and extend the set of types in Data.XML.Types provided by the xml-types package.
Following the philosophy of Data.XML.Types
, the types in this
module are not intended to be a strict and complete representation
of the model in the W3C specifications; rather, they are intended
to be convenient and type-safe for the kinds of processing of DTDs
that are commonly done in practice. As such, this model is
compatible with both Version 1.0 and Version 1.1 of the XML
specification.
Therefore, these types are not suitable for type-level validation of the syntax of a DTD. For example: these types are more lenient than the specs about the characters that are allowed in various locations in a DTD; entities of various kinds only appear as distinct syntactic elements in places where they are commonly needed when processing DTDs; etc.
Conditional sections are not represented in these types. They should be handled directly by parsers and renderers, if needed.
Synopsis
- data DTD = DTD {}
- data DTDTextDecl = DTDTextDecl {}
- data DTDComponent
- data EntityDecl
- data EntityValue
- type PERef = Text
- data ElementDecl = ElementDecl {}
- data ContentDecl
- data ContentModel
- data Repeat
- = One
- | ZeroOrOne
- | ZeroOrMore
- | OneOrMore
- data AttList = AttList {}
- data AttDecl = AttDecl {}
- data AttType
- data AttDefault
- data Notation = Notation {}
- data NotationSource
DTD structure
A DTD
is a sequence components in any order.
data DTDTextDecl Source #
The ?xml
text declaration at the beginning of a DTD.
Instances
Eq DTDTextDecl Source # | |
Defined in Data.XML.DTD.Types (==) :: DTDTextDecl -> DTDTextDecl -> Bool # (/=) :: DTDTextDecl -> DTDTextDecl -> Bool # | |
Show DTDTextDecl Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> DTDTextDecl -> ShowS # show :: DTDTextDecl -> String # showList :: [DTDTextDecl] -> ShowS # |
data DTDComponent Source #
The kinds of components that can appear in a DTD
.
DTDEntityDecl EntityDecl | Entity declaration |
DTDElementDecl ElementDecl | Element declaration |
DTDAttList AttList | List of attribute declarions for an element |
DTDNotation Notation | A notation declaration |
DTDPERef PERef | A parameter entity reference in the top-level flow of the DTD |
DTDInstruction Instruction | A processing instruction |
DTDComment Text | A comment |
Instances
Eq DTDComponent Source # | |
Defined in Data.XML.DTD.Types (==) :: DTDComponent -> DTDComponent -> Bool # (/=) :: DTDComponent -> DTDComponent -> Bool # | |
Show DTDComponent Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> DTDComponent -> ShowS # show :: DTDComponent -> String # showList :: [DTDComponent] -> ShowS # |
Entity declarations and references
data EntityDecl Source #
A declaration of an entity. An entity is a textual substitution variable. General entities can be referenced in an XML document conforming to the DTD, and parameter entities can be referenced in the DTD itself. The value of an unparsed entity is not specified in the DTD; it is specified by external syntax declared as a notation elsewhere in the DTD.
InternalGeneralEntityDecl | |
| |
ExternalGeneralEntityDecl | An external general entity is unparsed if a notation is specified. |
InternalParameterEntityDecl | |
| |
ExternalParameterEntityDecl | |
Instances
Eq EntityDecl Source # | |
Defined in Data.XML.DTD.Types (==) :: EntityDecl -> EntityDecl -> Bool # (/=) :: EntityDecl -> EntityDecl -> Bool # | |
Show EntityDecl Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> EntityDecl -> ShowS # show :: EntityDecl -> String # showList :: [EntityDecl] -> ShowS # |
data EntityValue Source #
The value of an internal entity may contain references to parameter entities; these references need to be resolved to obtain the actual replacement value of the entity. So we represent the value as a mixture of parameter entity references and free text.
Instances
Eq EntityValue Source # | |
Defined in Data.XML.DTD.Types (==) :: EntityValue -> EntityValue -> Bool # (/=) :: EntityValue -> EntityValue -> Bool # | |
Show EntityValue Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> EntityValue -> ShowS # show :: EntityValue -> String # showList :: [EntityValue] -> ShowS # |
A parameter entity reference. It contains the name of the parameter entity that is being referenced.
Element declarations
data ElementDecl Source #
A declaration of an element.
Instances
Eq ElementDecl Source # | |
Defined in Data.XML.DTD.Types (==) :: ElementDecl -> ElementDecl -> Bool # (/=) :: ElementDecl -> ElementDecl -> Bool # | |
Show ElementDecl Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> ElementDecl -> ShowS # show :: ElementDecl -> String # showList :: [ElementDecl] -> ShowS # |
data ContentDecl Source #
The content that can occur in an element.
ContentEmpty | No content |
ContentAny | Unrestricted content |
ContentElement ContentModel | Structured element content |
ContentMixed [Text] | A mixture of text and elements |
Instances
Eq ContentDecl Source # | |
Defined in Data.XML.DTD.Types (==) :: ContentDecl -> ContentDecl -> Bool # (/=) :: ContentDecl -> ContentDecl -> Bool # | |
Show ContentDecl Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> ContentDecl -> ShowS # show :: ContentDecl -> String # showList :: [ContentDecl] -> ShowS # |
data ContentModel Source #
A model of structured content for an element.
CMName Text Repeat | Element name |
CMChoice [ContentModel] Repeat | Choice, delimited by |
CMSeq [ContentModel] Repeat | Sequence, delimited by |
Instances
Eq ContentModel Source # | |
Defined in Data.XML.DTD.Types (==) :: ContentModel -> ContentModel -> Bool # (/=) :: ContentModel -> ContentModel -> Bool # | |
Show ContentModel Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> ContentModel -> ShowS # show :: ContentModel -> String # showList :: [ContentModel] -> ShowS # |
The number of times a production of content model syntax can repeat.
Attribute declarations
A list of attribute declarations for an element.
AttList | |
|
A declaration of an attribute that can occur in an element.
AttDecl | |
|
The type of value that an attribute can take.
AttStringType | Any text |
AttIDType | A unique ID |
AttIDRefType | A reference to an ID |
AttIDRefsType | One or more references to IDs |
AttEntityType | An unparsed external entity |
AttEntitiesType | One or more unparsed external entities |
AttNmTokenType | A name-like token |
AttNmTokensType | One or more name-like tokens |
AttEnumType [Text] | One of the given values |
AttNotationType [Text] | Specified by external syntax declared as a notation |
data AttDefault Source #
A default value specification for an attribute.
AttRequired | No default value; the attribute must always be supplied |
AttImplied | No default value; the attribute is optional |
AttFixed Text | When supplied, the attribute must have the given value |
AttDefaultValue Text | The attribute has the given default value when not supplied |
Instances
Eq AttDefault Source # | |
Defined in Data.XML.DTD.Types (==) :: AttDefault -> AttDefault -> Bool # (/=) :: AttDefault -> AttDefault -> Bool # | |
Show AttDefault Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> AttDefault -> ShowS # show :: AttDefault -> String # showList :: [AttDefault] -> ShowS # |
Notation declarations
A declaration of a notation.
data NotationSource Source #
A source for a notation. We do not use the usual ExternalID
type here, because for notations it is only optional, not required,
for a public ID to be accompanied also by a system ID.
NotationSysID Text | A system ID |
NotationPubID Text | A public ID |
NotationPubSysID Text Text | A public ID with a system ID |
Instances
Eq NotationSource Source # | |
Defined in Data.XML.DTD.Types (==) :: NotationSource -> NotationSource -> Bool # (/=) :: NotationSource -> NotationSource -> Bool # | |
Show NotationSource Source # | |
Defined in Data.XML.DTD.Types showsPrec :: Int -> NotationSource -> ShowS # show :: NotationSource -> String # showList :: [NotationSource] -> ShowS # |