Text.XML.HaXml.Types

| HaXml | Parent | 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 = Document Prolog (SymTab EntityDef) Element
data Element = Elem Name [Attribute] [Content]
data ElemTag = ElemTag Name [Attribute]
data Content
= CElem Element
| CString Bool CharData
| CRef Reference
| CMisc Misc
type Attribute = (Name, AttValue)
data AttValue = AttValue [Either String Reference]
data Prolog = Prolog (Maybe XMLDecl) (Maybe DocTypeDecl)
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
data NDataDecl = NDATA Name
data TextDecl = TextDecl (Maybe VersionInfo) EncodingDecl
data ExtParsedEnt = ExtParsedEnt (Maybe TextDecl) Content
data ExtPE = ExtPE (Maybe TextDecl) [ExtSubsetDecl]
data NotationDecl = NOTATION Name (Either ExternalID PublicID)
data PublicID = PUBLICID PubidLiteral
data EncodingDecl = EncodingDecl String
data EntityValue = EntityValue [EV]
data EV
= EVString String
| EVRef Reference
data PubidLiteral = PubidLiteral String
data 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)]
Symbol table operations
emptyST :: SymTab a
addST :: String -> a -> SymTab a -> SymTab a
lookupST :: String -> SymTab a -> Maybe a
XML Types
The top-level document container
data Document
The symbol table stored in a document holds all its general entity reference definitions.
Constructors
Document Prolog (SymTab EntityDef) Element |
The main document content
data Element
Constructors
Elem Name [Attribute] [Content] |
Instances
Verbatim Element
data ElemTag
Constructors
ElemTag Name [Attribute] | intermediate for parsing
Instances
Eq ElemTag
data Content
Constructors
CElem Element |
CString Bool CharData | bool is whether whitespace is significant
CRef Reference |
CMisc Misc |
Instances
Verbatim Content
type Attribute = (Name, AttValue)
data AttValue
Constructors
AttValue [Either String Reference] |
Administrative parts of the document
data Prolog
Constructors
Prolog (Maybe XMLDecl) (Maybe DocTypeDecl) |
data XMLDecl
Constructors
XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl) |
data Misc
Constructors
Comment Comment |
PI ProcessingInstruction |
type ProcessingInstruction = (PITarget, String)
type SDDecl = Bool
type VersionInfo = String
type Comment = String
type PITarget = String
The DTD
content model
data DocTypeDecl
Constructors
DTD Name (Maybe ExternalID) [MarkupDecl] |
data MarkupDecl
Constructors
Element ElementDecl |
AttList AttListDecl |
Entity EntityDecl |
Notation NotationDecl |
MarkupMisc Misc |
data ExtSubset
Constructors
ExtSubset (Maybe TextDecl) [ExtSubsetDecl] |
data ExtSubsetDecl
Constructors
ExtMarkupDecl MarkupDecl |
ExtConditionalSect ConditionalSect |
data ElementDecl
Constructors
ElementDecl Name ContentSpec |
data ContentSpec
Constructors
EMPTY |
ANY |
Mixed Mixed |
ContentSpec CP |
data CP
Constructors
TagName Name Modifier |
Choice [CP] Modifier |
Seq [CP] Modifier |
Instances
Show CP
data Modifier
Constructors
None | Just One
Query | Zero Or One
Star | Zero Or More
Plus | One Or More
Instances
Show Modifier
data Mixed
Constructors
PCDATA |
PCDATAplus [Name] |
attribute model
data AttListDecl
Constructors
AttListDecl Name [AttDef] |
data AttDef
Constructors
AttDef Name AttType DefaultDecl |
data AttType
Constructors
StringType |
TokenizedType TokenizedType |
EnumeratedType EnumeratedType |
data TokenizedType
Constructors
ID |
IDREF |
IDREFS |
ENTITY |
ENTITIES |
NMTOKEN |
NMTOKENS |
data EnumeratedType
Constructors
NotationType NotationType |
Enumeration Enumeration |
type NotationType = [Name]
type Enumeration = [NmToken]
data DefaultDecl
Constructors
REQUIRED |
IMPLIED |
DefaultTo AttValue (Maybe FIXED) |
data FIXED
Constructors
FIXED |
conditional sections
data ConditionalSect
Constructors
IncludeSect IncludeSect |
IgnoreSect IgnoreSect |
type IncludeSect = [ExtSubsetDecl]
type IgnoreSect = [IgnoreSectContents]
data Ignore
Constructors
Ignore |
data IgnoreSectContents
Constructors
IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)] |
References
data Reference
Constructors
RefEntity EntityRef |
RefChar CharRef |
Instances
Verbatim Reference
type EntityRef = Name
type CharRef = Int
type PEReference = Name
Entities
data EntityDecl
Constructors
EntityGEDecl GEDecl |
EntityPEDecl PEDecl |
data GEDecl
Constructors
GEDecl Name EntityDef |
data PEDecl
Constructors
PEDecl Name PEDef |
data EntityDef
Constructors
DefEntityValue EntityValue |
DefExternalID ExternalID (Maybe NDataDecl) |
data PEDef
Constructors
PEDefEntityValue EntityValue |
PEDefExternalID ExternalID |
data ExternalID
Constructors
SYSTEM SystemLiteral |
PUBLIC PubidLiteral SystemLiteral |
data NDataDecl
Constructors
NDATA Name |
data TextDecl
Constructors
TextDecl (Maybe VersionInfo) EncodingDecl |
data ExtParsedEnt
Constructors
ExtParsedEnt (Maybe TextDecl) Content |
data ExtPE
Constructors
ExtPE (Maybe TextDecl) [ExtSubsetDecl] |
data NotationDecl
Constructors
NOTATION Name (Either ExternalID PublicID) |
data PublicID
Constructors
PUBLICID PubidLiteral |
data EncodingDecl
Constructors
EncodingDecl String |
data EntityValue
Constructors
EntityValue [EV] |
data EV
Constructors
EVString String |
EVRef Reference |
data PubidLiteral
Constructors
PubidLiteral String |
data SystemLiteral
Constructors
SystemLiteral String |
Basic value types
type Name = String
type Names = [Name]
type NmToken = String
type NmTokens = [NmToken]
type CharData = String
type CDSect = CharData
Produced by Haddock version 0.4