| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Text.XML.HaXml.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 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 |
Instances
type ProcessingInstruction = (PITarget, String) Source #
type VersionInfo = String Source #
The DTD
content model
data DocTypeDecl Source #
Constructors
| DTD QName (Maybe ExternalID) [MarkupDecl] |
Instances
| Show DocTypeDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq DocTypeDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: DocTypeDecl -> DocTypeDecl -> Bool Source # (/=) :: DocTypeDecl -> DocTypeDecl -> Bool Source # | |
data MarkupDecl Source #
Constructors
| Element ElementDecl | |
| AttList AttListDecl | |
| Entity EntityDecl | |
| Notation NotationDecl | |
| MarkupMisc Misc |
Instances
| Show MarkupDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq MarkupDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: MarkupDecl -> MarkupDecl -> Bool Source # (/=) :: MarkupDecl -> MarkupDecl -> Bool Source # | |
Constructors
| ExtSubset (Maybe TextDecl) [ExtSubsetDecl] |
data ExtSubsetDecl Source #
Constructors
| ExtMarkupDecl MarkupDecl | |
| ExtConditionalSect ConditionalSect |
Instances
| Show ExtSubsetDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq ExtSubsetDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool Source # (/=) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool Source # | |
data ElementDecl Source #
Constructors
| ElementDecl QName ContentSpec |
Instances
| Show ElementDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq ElementDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ElementDecl -> ElementDecl -> Bool Source # (/=) :: ElementDecl -> ElementDecl -> Bool Source # | |
data ContentSpec Source #
Instances
| Show ContentSpec Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq ContentSpec Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ContentSpec -> ContentSpec -> Bool Source # (/=) :: ContentSpec -> ContentSpec -> Bool Source # | |
attribute model
data AttListDecl Source #
Constructors
| AttListDecl QName [AttDef] |
Instances
| Show AttListDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq AttListDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: AttListDecl -> AttListDecl -> Bool Source # (/=) :: AttListDecl -> AttListDecl -> Bool Source # | |
Constructors
| StringType | |
| TokenizedType TokenizedType | |
| EnumeratedType EnumeratedType |
data TokenizedType Source #
Instances
| Show TokenizedType Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq TokenizedType Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: TokenizedType -> TokenizedType -> Bool Source # (/=) :: TokenizedType -> TokenizedType -> Bool Source # | |
data EnumeratedType Source #
Constructors
| NotationType NotationType | |
| Enumeration Enumeration |
Instances
| Show EnumeratedType Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq EnumeratedType Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: EnumeratedType -> EnumeratedType -> Bool Source # (/=) :: EnumeratedType -> EnumeratedType -> Bool Source # | |
type NotationType = [Name] Source #
type Enumeration = [NmToken] Source #
data DefaultDecl Source #
Instances
| Show DefaultDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq DefaultDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: DefaultDecl -> DefaultDecl -> Bool Source # (/=) :: DefaultDecl -> DefaultDecl -> Bool Source # | |
conditional sections
data ConditionalSect Source #
Constructors
| IncludeSect IncludeSect | |
| IgnoreSect IgnoreSect |
Instances
| Show ConditionalSect Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq ConditionalSect Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ConditionalSect -> ConditionalSect -> Bool Source # (/=) :: ConditionalSect -> ConditionalSect -> Bool Source # | |
type IncludeSect = [ExtSubsetDecl] Source #
type IgnoreSect = [IgnoreSectContents] Source #
data IgnoreSectContents Source #
Constructors
| IgnoreSectContents Ignore [(IgnoreSectContents, Ignore)] |
Instances
| Show IgnoreSectContents Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq IgnoreSectContents Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: IgnoreSectContents -> IgnoreSectContents -> Bool Source # (/=) :: IgnoreSectContents -> IgnoreSectContents -> Bool Source # | |
References
type PEReference = Name Source #
Entities
data EntityDecl Source #
Constructors
| EntityGEDecl GEDecl | |
| EntityPEDecl PEDecl |
Instances
| Show EntityDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq EntityDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: EntityDecl -> EntityDecl -> Bool Source # (/=) :: EntityDecl -> EntityDecl -> Bool Source # | |
Constructors
| DefEntityValue EntityValue | |
| DefExternalID ExternalID (Maybe NDataDecl) |
Constructors
| PEDefEntityValue EntityValue | |
| PEDefExternalID ExternalID |
data ExternalID Source #
Constructors
| SYSTEM SystemLiteral | |
| PUBLIC PubidLiteral SystemLiteral |
Instances
| Show ExternalID Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq ExternalID Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ExternalID -> ExternalID -> Bool Source # (/=) :: ExternalID -> ExternalID -> Bool Source # | |
Constructors
| TextDecl (Maybe VersionInfo) EncodingDecl |
data ExtParsedEnt i Source #
Constructors
| ExtParsedEnt (Maybe TextDecl) (Content i) |
Instances
| Show i => Show (ExtParsedEnt i) Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq (ExtParsedEnt i) Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool Source # (/=) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool Source # | |
data NotationDecl Source #
Constructors
| NOTATION Name (Either ExternalID PublicID) |
Instances
| Show NotationDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq NotationDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: NotationDecl -> NotationDecl -> Bool Source # (/=) :: NotationDecl -> NotationDecl -> Bool Source # | |
newtype EncodingDecl Source #
Constructors
| EncodingDecl String |
Instances
| Show EncodingDecl Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq EncodingDecl Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: EncodingDecl -> EncodingDecl -> Bool Source # (/=) :: EncodingDecl -> EncodingDecl -> Bool Source # | |
data EntityValue Source #
Constructors
| EntityValue [EV] |
Instances
| Show EntityValue Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq EntityValue Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: EntityValue -> EntityValue -> Bool Source # (/=) :: EntityValue -> EntityValue -> Bool Source # | |
newtype PubidLiteral Source #
Constructors
| PubidLiteral String |
Instances
| Show PubidLiteral Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq PubidLiteral Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: PubidLiteral -> PubidLiteral -> Bool Source # (/=) :: PubidLiteral -> PubidLiteral -> Bool Source # | |
newtype SystemLiteral Source #
Constructors
| SystemLiteral String |
Instances
| Show SystemLiteral Source # | |
Defined in Text.XML.HaXml.Types | |
| Eq SystemLiteral Source # | |
Defined in Text.XML.HaXml.Types Methods (==) :: SystemLiteral -> SystemLiteral -> Bool Source # (/=) :: SystemLiteral -> SystemLiteral -> Bool Source # | |
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