module Text.XML.HaXml.Types
(
SymTab
, emptyST
, addST
, lookupST
, Document(..)
, Element(..)
, ElemTag(..)
, Content(..)
, Attribute
, AttValue(..)
, Prolog(..)
, XMLDecl(..)
, Misc(..)
, ProcessingInstruction
, SDDecl
, VersionInfo
, Comment
, PITarget
, DocTypeDecl(..)
, MarkupDecl(..)
, ExtSubset(..)
, ExtSubsetDecl(..)
, ElementDecl(..)
, ContentSpec(..)
, CP(..)
, Modifier(..)
, Mixed(..)
, AttListDecl(..)
, AttDef(..)
, AttType(..)
, TokenizedType(..)
, EnumeratedType(..)
, NotationType
, Enumeration
, DefaultDecl(..)
, FIXED(..)
, ConditionalSect(..)
, IncludeSect
, IgnoreSect
, Ignore(..)
, IgnoreSectContents(..)
, Reference(..)
, EntityRef
, CharRef
, PEReference
, EntityDecl(..)
, GEDecl(..)
, PEDecl(..)
, EntityDef(..)
, PEDef(..)
, ExternalID(..)
, NDataDecl(..)
, TextDecl(..)
, ExtParsedEnt(..)
, ExtPE(..)
, NotationDecl(..)
, PublicID(..)
, EncodingDecl(..)
, EntityValue(..)
, EV(..)
, PubidLiteral(..)
, SystemLiteral(..)
, Name
, Names
, NmToken
, NmTokens
, CharData
, CDSect
) where
type SymTab a = [(String,a)]
emptyST :: SymTab a
emptyST = []
addST :: String -> a -> SymTab a -> SymTab a
addST n v = ((n,v):)
lookupST :: String -> SymTab a -> Maybe a
lookupST = lookup
data Document = Document Prolog (SymTab EntityDef) Element [Misc]
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 Element = Elem Name [Attribute] [Content]
data ElemTag = ElemTag Name [Attribute]
type Attribute = (Name, AttValue)
data Content = CElem Element
| CString Bool CharData
| CRef Reference
| CMisc Misc
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
deriving Eq
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 = ExtParsedEnt (Maybe TextDecl) Content
data ExtPE = ExtPE (Maybe TextDecl) [ExtSubsetDecl]
data NotationDecl = NOTATION Name (Either ExternalID PublicID)
newtype PublicID = PUBLICID PubidLiteral
newtype EncodingDecl = EncodingDecl String
type Name = String
type Names = [Name]
type NmToken = String
type NmTokens = [NmToken]
data AttValue = AttValue [Either String Reference]
deriving Eq
data EntityValue = EntityValue [EV]
data EV = EVString String
| EVRef Reference
newtype PubidLiteral = PubidLiteral String
newtype SystemLiteral = SystemLiteral String
type CharData = String
type CDSect = CharData
instance Eq ElemTag where
(ElemTag n _) == (ElemTag m _) = n==m