Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
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
- = DefEntityValue EntityValue
- | DefExternalID ExternalID (Maybe NDataDecl)
- 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
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
Prolog (Maybe XMLDecl) [Misc] (Maybe DocTypeDecl) [Misc] |
XMLDecl VersionInfo (Maybe EncodingDecl) (Maybe SDDecl) |
type ProcessingInstruction = (PITarget, String) Source #
type VersionInfo = String Source #
The DTD
content model
data DocTypeDecl Source #
DTD QName (Maybe ExternalID) [MarkupDecl] |
Instances
Eq DocTypeDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: DocTypeDecl -> DocTypeDecl -> Bool (/=) :: DocTypeDecl -> DocTypeDecl -> Bool | |
Show DocTypeDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> DocTypeDecl -> ShowS show :: DocTypeDecl -> String showList :: [DocTypeDecl] -> ShowS |
data MarkupDecl Source #
Instances
Eq MarkupDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: MarkupDecl -> MarkupDecl -> Bool (/=) :: MarkupDecl -> MarkupDecl -> Bool | |
Show MarkupDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> MarkupDecl -> ShowS show :: MarkupDecl -> String showList :: [MarkupDecl] -> ShowS |
ExtSubset (Maybe TextDecl) [ExtSubsetDecl] |
data ExtSubsetDecl Source #
Instances
Eq ExtSubsetDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool (/=) :: ExtSubsetDecl -> ExtSubsetDecl -> Bool | |
Show ExtSubsetDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ExtSubsetDecl -> ShowS show :: ExtSubsetDecl -> String showList :: [ExtSubsetDecl] -> ShowS |
data ElementDecl Source #
Instances
Eq ElementDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: ElementDecl -> ElementDecl -> Bool (/=) :: ElementDecl -> ElementDecl -> Bool | |
Show ElementDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ElementDecl -> ShowS show :: ElementDecl -> String showList :: [ElementDecl] -> ShowS |
data ContentSpec Source #
Instances
Eq ContentSpec Source # | |
Defined in Text.XML.HaXml.Types (==) :: ContentSpec -> ContentSpec -> Bool (/=) :: ContentSpec -> ContentSpec -> Bool | |
Show ContentSpec Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ContentSpec -> ShowS show :: ContentSpec -> String showList :: [ContentSpec] -> ShowS |
attribute model
data AttListDecl Source #
Instances
Eq AttListDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: AttListDecl -> AttListDecl -> Bool (/=) :: AttListDecl -> AttListDecl -> Bool | |
Show AttListDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> AttListDecl -> ShowS show :: AttListDecl -> String showList :: [AttListDecl] -> ShowS |
data TokenizedType Source #
Instances
Eq TokenizedType Source # | |
Defined in Text.XML.HaXml.Types (==) :: TokenizedType -> TokenizedType -> Bool (/=) :: TokenizedType -> TokenizedType -> Bool | |
Show TokenizedType Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> TokenizedType -> ShowS show :: TokenizedType -> String showList :: [TokenizedType] -> ShowS |
data EnumeratedType Source #
Instances
Eq EnumeratedType Source # | |
Defined in Text.XML.HaXml.Types (==) :: EnumeratedType -> EnumeratedType -> Bool (/=) :: EnumeratedType -> EnumeratedType -> Bool | |
Show EnumeratedType Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> EnumeratedType -> ShowS show :: EnumeratedType -> String showList :: [EnumeratedType] -> ShowS |
type NotationType = [Name] Source #
type Enumeration = [NmToken] Source #
data DefaultDecl Source #
Instances
Eq DefaultDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: DefaultDecl -> DefaultDecl -> Bool (/=) :: DefaultDecl -> DefaultDecl -> Bool | |
Show DefaultDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> DefaultDecl -> ShowS show :: DefaultDecl -> String showList :: [DefaultDecl] -> ShowS |
conditional sections
data ConditionalSect Source #
Instances
Eq ConditionalSect Source # | |
Defined in Text.XML.HaXml.Types (==) :: ConditionalSect -> ConditionalSect -> Bool (/=) :: ConditionalSect -> ConditionalSect -> Bool | |
Show ConditionalSect Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ConditionalSect -> ShowS show :: ConditionalSect -> String showList :: [ConditionalSect] -> ShowS |
type IncludeSect = [ExtSubsetDecl] Source #
type IgnoreSect = [IgnoreSectContents] Source #
data IgnoreSectContents Source #
Instances
Eq IgnoreSectContents Source # | |
Defined in Text.XML.HaXml.Types (==) :: IgnoreSectContents -> IgnoreSectContents -> Bool (/=) :: IgnoreSectContents -> IgnoreSectContents -> Bool | |
Show IgnoreSectContents Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> IgnoreSectContents -> ShowS show :: IgnoreSectContents -> String showList :: [IgnoreSectContents] -> ShowS |
References
type PEReference = Name Source #
Entities
data EntityDecl Source #
Instances
Eq EntityDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: EntityDecl -> EntityDecl -> Bool (/=) :: EntityDecl -> EntityDecl -> Bool | |
Show EntityDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> EntityDecl -> ShowS show :: EntityDecl -> String showList :: [EntityDecl] -> ShowS |
data ExternalID Source #
Instances
Eq ExternalID Source # | |
Defined in Text.XML.HaXml.Types (==) :: ExternalID -> ExternalID -> Bool (/=) :: ExternalID -> ExternalID -> Bool | |
Show ExternalID Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ExternalID -> ShowS show :: ExternalID -> String showList :: [ExternalID] -> ShowS |
TextDecl (Maybe VersionInfo) EncodingDecl |
data ExtParsedEnt i Source #
ExtParsedEnt (Maybe TextDecl) (Content i) |
Instances
Eq (ExtParsedEnt i) Source # | |
Defined in Text.XML.HaXml.Types (==) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool (/=) :: ExtParsedEnt i -> ExtParsedEnt i -> Bool | |
Show i => Show (ExtParsedEnt i) Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> ExtParsedEnt i -> ShowS show :: ExtParsedEnt i -> String showList :: [ExtParsedEnt i] -> ShowS |
ExtPE (Maybe TextDecl) [ExtSubsetDecl] |
data NotationDecl Source #
NOTATION Name (Either ExternalID PublicID) |
Instances
Eq NotationDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: NotationDecl -> NotationDecl -> Bool (/=) :: NotationDecl -> NotationDecl -> Bool | |
Show NotationDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> NotationDecl -> ShowS show :: NotationDecl -> String showList :: [NotationDecl] -> ShowS |
newtype EncodingDecl Source #
EncodingDecl String |
Instances
Eq EncodingDecl Source # | |
Defined in Text.XML.HaXml.Types (==) :: EncodingDecl -> EncodingDecl -> Bool (/=) :: EncodingDecl -> EncodingDecl -> Bool | |
Show EncodingDecl Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> EncodingDecl -> ShowS show :: EncodingDecl -> String showList :: [EncodingDecl] -> ShowS |
data EntityValue Source #
Instances
Eq EntityValue Source # | |
Defined in Text.XML.HaXml.Types (==) :: EntityValue -> EntityValue -> Bool (/=) :: EntityValue -> EntityValue -> Bool | |
Show EntityValue Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> EntityValue -> ShowS show :: EntityValue -> String showList :: [EntityValue] -> ShowS |
newtype PubidLiteral Source #
PubidLiteral String |
Instances
Eq PubidLiteral Source # | |
Defined in Text.XML.HaXml.Types (==) :: PubidLiteral -> PubidLiteral -> Bool (/=) :: PubidLiteral -> PubidLiteral -> Bool | |
Show PubidLiteral Source # | |
Defined in Text.XML.HaXml.Types showsPrec :: Int -> PubidLiteral -> ShowS show :: PubidLiteral -> String showList :: [PubidLiteral] -> ShowS |
newtype SystemLiteral Source #
SystemLiteral String |
Instances
Eq SystemLiteral Source # | |
Defined in Text.XML.HaXml.Types (==) :: SystemLiteral -> SystemLiteral -> Bool (/=) :: SystemLiteral -> SystemLiteral -> Bool | |
Show SystemLiteral Source # | |
Defined in Text.XML.HaXml.Types 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