| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Text.XML.HaXml.Types
Contents
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 QName [Attribute] [Content i]
- data ElemTag = ElemTag QName [Attribute]
- data Content i
- type Attribute = (QName, 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
- type ProcessingInstruction = (PITarget, String)
- type SDDecl = Bool
- type VersionInfo = String
- type Comment = String
- type PITarget = String
- data DocTypeDecl = DTD QName (Maybe ExternalID) [MarkupDecl]
- data MarkupDecl
- data ExtSubset = ExtSubset (Maybe TextDecl) [ExtSubsetDecl]
- data ExtSubsetDecl
- data ElementDecl = ElementDecl QName ContentSpec
- data ContentSpec
- data CP
- data Modifier
- data Mixed
- = PCDATA
- | PCDATAplus [QName]
- data AttListDecl = AttListDecl QName [AttDef]
- data AttDef = AttDef QName AttType DefaultDecl
- data AttType
- data TokenizedType
- data EnumeratedType
- type NotationType = [Name]
- type Enumeration = [NmToken]
- data DefaultDecl
- data FIXED = FIXED
- data ConditionalSect
- type IncludeSect = [ExtSubsetDecl]
- type IgnoreSect = [IgnoreSectContents]
- data Ignore = Ignore
- data IgnoreSectContents = IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)]
- data Reference
- type EntityRef = Name
- type CharRef = Int
- type PEReference = Name
- data EntityDecl
- data GEDecl = GEDecl Name EntityDef
- data PEDecl = PEDecl Name PEDef
- data EntityDef
- data PEDef
- data ExternalID
- 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
- newtype PubidLiteral = PubidLiteral String
- newtype SystemLiteral = SystemLiteral String
- data QName
- data Namespace = Namespace {}
- 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.
Symbol table operations
XML Types
The top-level document container
The symbol table stored in a document holds all its general entity reference definitions.
The main document content
Constructors
| CElem (Element i) i | |
| CString Bool CharData i | bool is whether whitespace is significant |
| CRef Reference i | |
| CMisc Misc i |
Administrative parts of the document
Constructors
| XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl) |
Constructors
| Comment Comment | |
| PI ProcessingInstruction |
type ProcessingInstruction = (PITarget, String) #
type VersionInfo = String #
The DTD
content model
data DocTypeDecl #
Constructors
| DTD QName (Maybe ExternalID) [MarkupDecl] |
Instances
| Eq DocTypeDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show DocTypeDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> DocTypeDecl -> ShowS # show :: DocTypeDecl -> String # showList :: [DocTypeDecl] -> ShowS # | |
data MarkupDecl #
Constructors
| Element ElementDecl | |
| AttList AttListDecl | |
| Entity EntityDecl | |
| Notation NotationDecl | |
| MarkupMisc Misc |
Instances
| Eq MarkupDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show MarkupDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> MarkupDecl -> ShowS # show :: MarkupDecl -> String # showList :: [MarkupDecl] -> ShowS # | |
data ExtSubsetDecl #
Constructors
| ExtMarkupDecl MarkupDecl | |
| ExtConditionalSect ConditionalSect |
Instances
| Eq ExtSubsetDecl # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool # (/=) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool # | |
| Show ExtSubsetDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ExtSubsetDecl -> ShowS # show :: ExtSubsetDecl -> String # showList :: [ExtSubsetDecl] -> ShowS # | |
data ElementDecl #
Constructors
| ElementDecl QName ContentSpec |
Instances
| Eq ElementDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show ElementDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ElementDecl -> ShowS # show :: ElementDecl -> String # showList :: [ElementDecl] -> ShowS # | |
data ContentSpec #
Instances
| Eq ContentSpec # | |
Defined in Text.XML.HaXml.Types | |
| Show ContentSpec # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ContentSpec -> ShowS # show :: ContentSpec -> String # showList :: [ContentSpec] -> ShowS # | |
Constructors
| PCDATA | |
| PCDATAplus [QName] |
attribute model
data AttListDecl #
Constructors
| AttListDecl QName [AttDef] |
Instances
| Eq AttListDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show AttListDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> AttListDecl -> ShowS # show :: AttListDecl -> String # showList :: [AttListDecl] -> ShowS # | |
Constructors
| AttDef QName AttType DefaultDecl |
Constructors
| StringType | |
| TokenizedType TokenizedType | |
| EnumeratedType EnumeratedType |
data TokenizedType #
Instances
| Eq TokenizedType # | |
Defined in Text.XML.HaXml.Types Methods (==) :: TokenizedType -> TokenizedType -> Bool # (/=) :: TokenizedType -> TokenizedType -> Bool # | |
| Show TokenizedType # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> TokenizedType -> ShowS # show :: TokenizedType -> String # showList :: [TokenizedType] -> ShowS # | |
data EnumeratedType #
Constructors
| NotationType NotationType | |
| Enumeration Enumeration |
Instances
| Eq EnumeratedType # | |
Defined in Text.XML.HaXml.Types Methods (==) :: EnumeratedType -> EnumeratedType -> Bool # (/=) :: EnumeratedType -> EnumeratedType -> Bool # | |
| Show EnumeratedType # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> EnumeratedType -> ShowS # show :: EnumeratedType -> String # showList :: [EnumeratedType] -> ShowS # | |
type NotationType = [Name] #
type Enumeration = [NmToken] #
data DefaultDecl #
Instances
| Eq DefaultDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show DefaultDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> DefaultDecl -> ShowS # show :: DefaultDecl -> String # showList :: [DefaultDecl] -> ShowS # | |
Constructors
| FIXED |
conditional sections
data ConditionalSect #
Constructors
| IncludeSect IncludeSect | |
| IgnoreSect IgnoreSect |
Instances
| Eq ConditionalSect # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ConditionalSect -> ConditionalSect -> Bool # (/=) :: ConditionalSect -> ConditionalSect -> Bool # | |
| Show ConditionalSect # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ConditionalSect -> ShowS # show :: ConditionalSect -> String # showList :: [ConditionalSect] -> ShowS # | |
type IncludeSect = [ExtSubsetDecl] #
type IgnoreSect = [IgnoreSectContents] #
Constructors
| Ignore |
data IgnoreSectContents #
Constructors
| IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)] |
Instances
| Eq IgnoreSectContents # | |
Defined in Text.XML.HaXml.Types Methods (==) :: IgnoreSectContents -> IgnoreSectContents -> Bool # (/=) :: IgnoreSectContents -> IgnoreSectContents -> Bool # | |
| Show IgnoreSectContents # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> IgnoreSectContents -> ShowS # show :: IgnoreSectContents -> String # showList :: [IgnoreSectContents] -> ShowS # | |
References
type PEReference = Name #
Entities
data EntityDecl #
Constructors
| EntityGEDecl GEDecl | |
| EntityPEDecl PEDecl |
Instances
| Eq EntityDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show EntityDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> EntityDecl -> ShowS # show :: EntityDecl -> String # showList :: [EntityDecl] -> ShowS # | |
Constructors
| DefEntityValue EntityValue | |
| DefExternalID ExternalID (Maybe NDataDecl) |
Constructors
| PEDefEntityValue EntityValue | |
| PEDefExternalID ExternalID |
data ExternalID #
Constructors
| SYSTEM SystemLiteral | |
| PUBLIC PubidLiteral SystemLiteral |
Instances
| Eq ExternalID # | |
Defined in Text.XML.HaXml.Types | |
| Show ExternalID # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ExternalID -> ShowS # show :: ExternalID -> String # showList :: [ExternalID] -> ShowS # | |
Constructors
| TextDecl (Maybe VersionInfo) EncodingDecl |
data ExtParsedEnt i #
Constructors
| ExtParsedEnt (Maybe TextDecl) (Content i) |
Instances
| Eq (ExtParsedEnt i) # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool # (/=) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool # | |
| Show i => Show (ExtParsedEnt i) # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> ExtParsedEnt i -> ShowS # show :: ExtParsedEnt i -> String # showList :: [ExtParsedEnt i] -> ShowS # | |
Constructors
| ExtPE (Maybe TextDecl) [ExtSubsetDecl] |
data NotationDecl #
Constructors
| NOTATION Name (Either ExternalID PublicID) |
Instances
| Eq NotationDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show NotationDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> NotationDecl -> ShowS # show :: NotationDecl -> String # showList :: [NotationDecl] -> ShowS # | |
Constructors
| PUBLICID PubidLiteral |
newtype EncodingDecl #
Constructors
| EncodingDecl String |
Instances
| Eq EncodingDecl # | |
Defined in Text.XML.HaXml.Types | |
| Show EncodingDecl # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> EncodingDecl -> ShowS # show :: EncodingDecl -> String # showList :: [EncodingDecl] -> ShowS # | |
data EntityValue #
Constructors
| EntityValue [EV] |
Instances
| Eq EntityValue # | |
Defined in Text.XML.HaXml.Types | |
| Show EntityValue # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> EntityValue -> ShowS # show :: EntityValue -> String # showList :: [EntityValue] -> ShowS # | |
newtype PubidLiteral #
Constructors
| PubidLiteral String |
Instances
| Eq PubidLiteral # | |
Defined in Text.XML.HaXml.Types | |
| Show PubidLiteral # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> PubidLiteral -> ShowS # show :: PubidLiteral -> String # showList :: [PubidLiteral] -> ShowS # | |
newtype SystemLiteral #
Constructors
| SystemLiteral String |
Instances
| Eq SystemLiteral # | |
Defined in Text.XML.HaXml.Types Methods (==) :: SystemLiteral -> SystemLiteral -> Bool # (/=) :: SystemLiteral -> SystemLiteral -> Bool # | |
| Show SystemLiteral # | |
Defined in Text.XML.HaXml.Types Methods showsPrec :: Int -> SystemLiteral -> ShowS # show :: SystemLiteral -> String # showList :: [SystemLiteral] -> ShowS # | |
Namespaces
A QName is a (possibly) qualified name, in the sense of XML namespaces.
Namespaces are not defined in the XML spec itself, but at http://www.w3.org/TR/xml-names