dtd-types 0.2.0.1 → 0.3.0.1
raw patch · 2 files changed
+70/−67 lines, 2 files
Files
- Data/XML/DTD/Types.hs +69/−66
- dtd-types.cabal +1/−1
Data/XML/DTD/Types.hs view
@@ -43,22 +43,23 @@ DTD (..) , DTDTextDecl (..) , DTDComponent (..)- + -- * Entity declarations and references , EntityDecl (..)- , PEContent (..)+ , EntityValue (..) , PERef -- * Element declarations , ElementDecl (..)+ , ContentDecl (..) , ContentModel (..) , Repeat (..) -- * Attribute declarations- , AttrList (..)- , AttrDecl (..)- , AttrType (..)- , AttrDefault (..)+ , AttList (..)+ , AttDecl (..)+ , AttType (..)+ , AttDefault (..) -- * Notation declarations , Notation (..)@@ -96,7 +97,7 @@ data DTDComponent = DTDEntityDecl EntityDecl -- ^ Entity declaration | DTDElementDecl ElementDecl -- ^ Element declaration- | DTDAttrList AttrList -- ^ List of attribute declarions for+ | DTDAttList AttList -- ^ List of attribute declarions for -- an element | DTDNotation Notation -- ^ A notation declaration | DTDPERef PERef -- ^ A parameter entity reference in@@ -115,39 +116,41 @@ -- the DTD; it is specified by external syntax declared as a notation -- elsewhere in the DTD. data EntityDecl =- InternalEntityDecl+ InternalGeneralEntityDecl { entityDeclName :: Text- , entityDeclValue :: Text- } -- ^ An internal general entity- | ExternalEntityDecl+ , entityDeclValue :: [EntityValue]+ }+ | ExternalGeneralEntityDecl { entityDeclName :: Text , entityDeclID :: ExternalID , entityDeclNotation :: Maybe Text } -- ^ An external general- -- entity, parsed or- -- unparsed. It is unparsed- -- if a notation is- -- specified.-- | ParameterEntityDecl+ -- entity is unparsed if a+ -- notation is specified.+ | InternalParameterEntityDecl { entityDeclName :: Text- , peDeclValue :: [PEContent]- } -- ^ A parameter entity+ , entityDeclValue :: [EntityValue]+ }+ | ExternalParameterEntityDecl+ { entityDeclName :: Text+ , entityDeclID :: ExternalID+ } deriving (Show, Eq) instance Typeable EntityDecl where typeOf = typeString "EntityDecl" --- | Parameter entities need to be recursively resolved, so we--- represent their content as a mixture of nested parameter entity--- references and free text.-data PEContent =- PEText Text- | PENested PERef+-- | 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.+data EntityValue =+ EntityText Text+ | EntityPERef PERef deriving (Show, Eq) -instance Typeable PEContent where- typeOf = typeString "PEContent"+instance Typeable EntityValue where+ typeOf = typeString "EntityValue" -- | A parameter entity reference. It contains the name of the -- parameter entity that is being referenced.@@ -194,61 +197,61 @@ typeOf = typeString "Repeat" -- | A list of attribute declarations for an element.-data AttrList =- AttrList- { attrListElementName :: Text -- ^ The name of the element to- -- which the attribute- -- declarations apply- , attrListDecls :: [AttrDecl]+data AttList =+ AttList+ { attListElementName :: Text -- ^ The name of the element to+ -- which the attribute+ -- declarations apply+ , attListDecls :: [AttDecl] } deriving (Show, Eq) -instance Typeable AttrList where- typeOf = typeString "AttrList"+instance Typeable AttList where+ typeOf = typeString "AttList" -- | A declaration of an attribute that can occur in an element.-data AttrDecl =- AttrDecl- { attrDeclName :: Text -- ^ The name of the attribute- , attrDeclType :: AttrType -- ^ The type of the attribute- , attrDeclDefault :: AttrDefault -- ^ The default value specification+data AttDecl =+ AttDecl+ { attDeclName :: Text -- ^ The name of the attribute+ , attDeclType :: AttType -- ^ The type of the attribute+ , attDeclDefault :: AttDefault -- ^ The default value specification } deriving (Show, Eq) -instance Typeable AttrDecl where- typeOf = typeString "AttrDecl"+instance Typeable AttDecl where+ typeOf = typeString "AttDecl" -- | The type of value that an attribute can take.-data AttrType =- AttrStringType -- ^ Any text- | AttrIDType -- ^ A unique ID- | AttrIDRefType -- ^ A reference to an ID- | AttrIDRefsType -- ^ One or more references to IDs- | AttrEntityType -- ^ An unparsed external entity- | AttrEntitiesType -- ^ One or more unparsed external entities- | AttrNmTokenType -- ^ A name-like token- | AttrNmTokensType -- ^ One or more name-like tokens- | AttrEnumType [Text] -- ^ One of the given values- | AttrNotationType [Text] -- ^ Specified by external syntax- -- declared as a notation+data AttType =+ 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 deriving (Show, Eq) -instance Typeable AttrType where- typeOf = typeString "AttrType"+instance Typeable AttType where+ typeOf = typeString "AttType" -- | A default value specification for an attribute.-data AttrDefault =- AttrRequired -- ^ No default value; the attribute must always- -- be supplied- | AttrImplied -- ^ No default value; the attribute is optional- | AttrFixed Text -- ^ When supplied, the attribute must have the- -- given value- | AttrDefaultValue Text -- ^ The attribute has the given default value- -- when not supplied+data AttDefault =+ 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 deriving (Show, Eq) -instance Typeable AttrDefault where- typeOf = typeString "AttrDefault"+instance Typeable AttDefault where+ typeOf = typeString "AttDefault" -- | A declaration of a notation. data Notation =
dtd-types.cabal view
@@ -1,5 +1,5 @@ name: dtd-types-version: 0.2.0.1+version: 0.3.0.1 synopsis: Basic types for representing XML DTDs description: This package provides types to represent an XML Document Type