| Validate | Source code | Contents | Index
Text.XML.HaXml.Types
Contents
A simple symbol table mapping strings (references) to values. Symbol table operations XML Types The top-level document container The main document content Administrative parts of the document The DTD content model attribute model conditional sections References Entities Basic value types
Description
This module defines an internal (generic) representation for XML documents including their DTDs. History: The original module was derived by hand from the XML specification, following the grammar precisely. Then we simplified the types, removing layers of indirection and redundancy, and generally making things easier to work with. Then we allowed PEReferences to be ubiquitous, by removing them from the types and resolving all PE references at parse-time. Finally, we added a per-document symbol table for GEReferences, and a whitespace-significance flag for plaintext.
Synopsis
type SymTab a = [(String, a)]
emptyST :: SymTab a
addST :: String -> a -> SymTab a -> SymTab a
lookupST :: String -> SymTab a -> Maybe a
data Document i = Document Prolog (SymTab EntityDef) (Element i) [Misc]
data Element i = Elem Name [Attribute] [Content i]
data ElemTag = ElemTag Name [Attribute]
data Content i
= CElem (Element i) i
| CString Bool CharData i
| CRef Reference i
| CMisc Misc i
type Attribute = (Name, AttValue)
data AttValue = AttValue [Either String Reference]
info :: Content t -> t
data Prolog = Prolog (Maybe XMLDecl) [Misc] (Maybe DocTypeDecl) [Misc]
data XMLDecl = XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl)
data Misc
= Comment Comment
| PI ProcessingInstruction
type ProcessingInstruction = (PITarget, String)
type SDDecl = Bool
type VersionInfo = String
type Comment = String
type PITarget = String
data DocTypeDecl = DTD Name (Maybe ExternalID) [MarkupDecl]
data MarkupDecl
= Element ElementDecl
| AttList AttListDecl
| Entity EntityDecl
| Notation NotationDecl
| MarkupMisc Misc
data ExtSubset = ExtSubset (Maybe TextDecl) [ExtSubsetDecl]
data ExtSubsetDecl
= ExtMarkupDecl MarkupDecl
| ExtConditionalSect ConditionalSect
data ElementDecl = ElementDecl Name ContentSpec
data ContentSpec
= EMPTY
| ANY
| Mixed Mixed
| ContentSpec CP
data CP
= TagName Name Modifier
| Choice [CP] Modifier
| Seq [CP] Modifier
data Modifier
= None
| Query
| Star
| Plus
data Mixed
= PCDATA
| PCDATAplus [Name]
data AttListDecl = AttListDecl Name [AttDef]
data AttDef = AttDef Name AttType DefaultDecl
data AttType
= StringType
| TokenizedType TokenizedType
| EnumeratedType EnumeratedType
data TokenizedType
= ID
| IDREF
| IDREFS
| ENTITY
| ENTITIES
| NMTOKEN
| NMTOKENS
data EnumeratedType
= NotationType NotationType
| Enumeration Enumeration
type NotationType = [Name]
type Enumeration = [NmToken]
data DefaultDecl
= REQUIRED
| IMPLIED
| DefaultTo AttValue (Maybe FIXED)
data FIXED = FIXED
data ConditionalSect
= IncludeSect IncludeSect
| IgnoreSect IgnoreSect
type IncludeSect = [ExtSubsetDecl]
type IgnoreSect = [IgnoreSectContents]
data Ignore = Ignore
data IgnoreSectContents = IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)]
data Reference
= RefEntity EntityRef
| RefChar CharRef
type EntityRef = Name
type CharRef = Int
type PEReference = Name
data EntityDecl
= EntityGEDecl GEDecl
| EntityPEDecl PEDecl
data GEDecl = GEDecl Name EntityDef
data PEDecl = PEDecl Name PEDef
data EntityDef
= DefEntityValue EntityValue
| DefExternalID ExternalID (Maybe NDataDecl)
data PEDef
= PEDefEntityValue EntityValue
| PEDefExternalID ExternalID
data ExternalID
= SYSTEM SystemLiteral
| PUBLIC PubidLiteral SystemLiteral
newtype NDataDecl = NDATA Name
data TextDecl = TextDecl (Maybe VersionInfo) EncodingDecl
data ExtParsedEnt i = ExtParsedEnt (Maybe TextDecl) (Content i)
data ExtPE = ExtPE (Maybe TextDecl) [ExtSubsetDecl]
data NotationDecl = NOTATION Name (Either ExternalID PublicID)
newtype PublicID = PUBLICID PubidLiteral
newtype EncodingDecl = EncodingDecl String
data EntityValue = EntityValue [EV]
data EV
= EVString String
| EVRef Reference
newtype PubidLiteral = PubidLiteral String
newtype SystemLiteral = SystemLiteral String
type Name = String
type Names = [Name]
type NmToken = String
type NmTokens = [NmToken]
type CharData = String
type CDSect = CharData
A simple symbol table mapping strings (references) to values.
type SymTab a = [(String, a)] | Source
Symbol table operations
emptyST :: SymTab a | Source
addST :: String -> a -> SymTab a -> SymTab a | Source
lookupST :: String -> SymTab a -> Maybe a | Source
XML Types
The top-level document container
data Document i | Source
The symbol table stored in a document holds all its general entity reference definitions.
Constructors
Document Prolog (SymTab EntityDef) (Element i) [Misc] |
Instances
Functor Document
Eq i => Eq (Document i)
The main document content
data Element i | Source
Constructors
Elem Name [Attribute] [Content i] |
Instances
Functor Element
Eq i => Eq (Element i)
Verbatim (Element i)
data ElemTag | Source
Constructors
ElemTag Name [Attribute] |
Instances
Eq ElemTag
data Content i | Source
Constructors
CElem (Element i) i |
CString Bool CharData i | bool is whether whitespace is significant
CRef Reference i |
CMisc Misc i |
Instances
Functor Content
Eq i => Eq (Content i)
Verbatim (Content i)
type Attribute = (Name, AttValue) | Source
data AttValue | Source
Constructors
AttValue [Either String Reference] |
Instances
Eq AttValue
Show AttValue
info :: Content t -> t | Source
Administrative parts of the document
data Prolog | Source
Constructors
Prolog (Maybe XMLDecl) [Misc] (Maybe DocTypeDecl) [Misc] |
Instances
Eq Prolog
data XMLDecl | Source
Constructors
XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl) |
Instances
Eq XMLDecl
data Misc | Source
Constructors
Comment Comment |
PI ProcessingInstruction |
Instances
Eq Misc
type ProcessingInstruction = (PITarget, String) | Source
type SDDecl = Bool | Source
type VersionInfo = String | Source
type Comment = String | Source
type PITarget = String | Source
The DTD
content model
data DocTypeDecl | Source
Constructors
DTD Name (Maybe ExternalID) [MarkupDecl] |
Instances
Eq DocTypeDecl
data MarkupDecl | Source
Constructors
Element ElementDecl |
AttList AttListDecl |
Entity EntityDecl |
Notation NotationDecl |
MarkupMisc Misc |
Instances
Eq MarkupDecl
data ExtSubset | Source
Constructors
ExtSubset (Maybe TextDecl) [ExtSubsetDecl] |
Instances
Eq ExtSubset
data ExtSubsetDecl | Source
Constructors
ExtMarkupDecl MarkupDecl |
ExtConditionalSect ConditionalSect |
Instances
Eq ExtSubsetDecl
data ElementDecl | Source
Constructors
ElementDecl Name ContentSpec |
Instances
Eq ElementDecl
data ContentSpec | Source
Constructors
EMPTY |
ANY |
Mixed Mixed |
ContentSpec CP |
Instances
Eq ContentSpec
data CP | Source
Constructors
TagName Name Modifier |
Choice [CP] Modifier |
Seq [CP] Modifier |
Instances
Eq CP
Show CP
data Modifier | Source
Constructors
None | Just One
Query | Zero Or One
Star | Zero Or More
Plus | One Or More
Instances
Eq Modifier
Show Modifier
data Mixed | Source
Constructors
PCDATA |
PCDATAplus [Name] |
Instances
Eq Mixed
attribute model
data AttListDecl | Source
Constructors
AttListDecl Name [AttDef] |
Instances
Eq AttListDecl
data AttDef | Source
Constructors
AttDef Name AttType DefaultDecl |
Instances
Eq AttDef
data AttType | Source
Constructors
StringType |
TokenizedType TokenizedType |
EnumeratedType EnumeratedType |
Instances
Eq AttType
data TokenizedType | Source
Constructors
ID |
IDREF |
IDREFS |
ENTITY |
ENTITIES |
NMTOKEN |
NMTOKENS |
Instances
Eq TokenizedType
data EnumeratedType | Source
Constructors
NotationType NotationType |
Enumeration Enumeration |
Instances
Eq EnumeratedType
type NotationType = [Name] | Source
type Enumeration = [NmToken] | Source
data DefaultDecl | Source
Constructors
REQUIRED |
IMPLIED |
DefaultTo AttValue (Maybe FIXED) |
Instances
Eq DefaultDecl
data FIXED | Source
Constructors
FIXED |
Instances
Eq FIXED
conditional sections
data ConditionalSect | Source
Constructors
IncludeSect IncludeSect |
IgnoreSect IgnoreSect |
Instances
Eq ConditionalSect
type IncludeSect = [ExtSubsetDecl] | Source
type IgnoreSect = [IgnoreSectContents] | Source
data Ignore | Source
Constructors
Ignore |
Instances
Eq Ignore
data IgnoreSectContents | Source
Constructors
IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)] |
Instances
Eq IgnoreSectContents
References
data Reference | Source
Constructors
RefEntity EntityRef |
RefChar CharRef |
Instances
Eq Reference
Show Reference
Verbatim Reference
type EntityRef = Name | Source
type CharRef = Int | Source
type PEReference = Name | Source
Entities
data EntityDecl | Source
Constructors
EntityGEDecl GEDecl |
EntityPEDecl PEDecl |
Instances
Eq EntityDecl
data GEDecl | Source
Constructors
GEDecl Name EntityDef |
Instances
Eq GEDecl
data PEDecl | Source
Constructors
PEDecl Name PEDef |
Instances
Eq PEDecl
data EntityDef | Source
Constructors
DefEntityValue EntityValue |
DefExternalID ExternalID (Maybe NDataDecl) |
Instances
Eq EntityDef
data PEDef | Source
Constructors
PEDefEntityValue EntityValue |
PEDefExternalID ExternalID |
Instances
Eq PEDef
Show PEDef
data ExternalID | Source
Constructors
SYSTEM SystemLiteral |
PUBLIC PubidLiteral SystemLiteral |
Instances
Eq ExternalID
Show ExternalID
newtype NDataDecl | Source
Constructors
NDATA Name |
Instances
Eq NDataDecl
data TextDecl | Source
Constructors
TextDecl (Maybe VersionInfo) EncodingDecl |
Instances
Eq TextDecl
data ExtParsedEnt i | Source
Constructors
ExtParsedEnt (Maybe TextDecl) (Content i) |
Instances
Eq i => Eq (ExtParsedEnt i)
data ExtPE | Source
Constructors
ExtPE (Maybe TextDecl) [ExtSubsetDecl] |
Instances
Eq ExtPE
data NotationDecl | Source
Constructors
NOTATION Name (Either ExternalID PublicID) |
Instances
Eq NotationDecl
newtype PublicID | Source
Constructors
PUBLICID PubidLiteral |
Instances
Eq PublicID
newtype EncodingDecl | Source
Constructors
EncodingDecl String |
Instances
Eq EncodingDecl
data EntityValue | Source
Constructors
EntityValue [EV] |
Instances
Eq EntityValue
Show EntityValue
data EV | Source
Constructors
EVString String |
EVRef Reference |
Instances
Eq EV
Show EV
newtype PubidLiteral | Source
Constructors
PubidLiteral String |
Instances
Eq PubidLiteral
Show PubidLiteral
newtype SystemLiteral | Source
Constructors
SystemLiteral String |
Instances
Eq SystemLiteral
Show SystemLiteral
Basic value types
type Name = String | Source
type Names = [Name] | Source
type NmToken = String | Source
type NmTokens = [NmToken] | Source
type CharData = String | Source
type CDSect = CharData | Source
Produced by Haddock version 2.4.2