HaXml-1.25.4: Utilities for manipulating XML documents

Safe HaskellSafe
LanguageHaskell98

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

A simple symbol table mapping strings (references) to values.

type SymTab a = [(String, a)] #

Symbol table operations

addST :: String -> a -> SymTab a -> SymTab a #

XML Types

The top-level document container

data Document i #

The symbol table stored in a document holds all its general entity reference definitions.

Constructors

Document Prolog (SymTab EntityDef) (Element i) [Misc] 

Instances

Functor Document # 

Methods

fmap :: (a -> b) -> Document a -> Document b #

(<$) :: a -> Document b -> Document a #

Eq (Document i) # 

Methods

(==) :: Document i -> Document i -> Bool #

(/=) :: Document i -> Document i -> Bool #

Show i => Show (Document i) # 

Methods

showsPrec :: Int -> Document i -> ShowS #

show :: Document i -> String #

showList :: [Document i] -> ShowS #

The main document content

data Element i #

Constructors

Elem QName [Attribute] [Content i] 

Instances

Functor Element # 

Methods

fmap :: (a -> b) -> Element a -> Element b #

(<$) :: a -> Element b -> Element a #

Eq (Element i) # 

Methods

(==) :: Element i -> Element i -> Bool #

(/=) :: Element i -> Element i -> Bool #

Show i => Show (Element i) # 

Methods

showsPrec :: Int -> Element i -> ShowS #

show :: Element i -> String #

showList :: [Element i] -> ShowS #

Verbatim (Element i) # 

Methods

verbatim :: Element i -> String #

data ElemTag #

Constructors

ElemTag QName [Attribute] 

Instances

Eq ElemTag # 

Methods

(==) :: ElemTag -> ElemTag -> Bool #

(/=) :: ElemTag -> ElemTag -> Bool #

data Content i #

Constructors

CElem (Element i) i 
CString Bool CharData i

bool is whether whitespace is significant

CRef Reference i 
CMisc Misc i 

Instances

Functor Content # 

Methods

fmap :: (a -> b) -> Content a -> Content b #

(<$) :: a -> Content b -> Content a #

Eq (Content i) # 

Methods

(==) :: Content i -> Content i -> Bool #

(/=) :: Content i -> Content i -> Bool #

Show i => Show (Content i) # 

Methods

showsPrec :: Int -> Content i -> ShowS #

show :: Content i -> String #

showList :: [Content i] -> ShowS #

Verbatim (Content i) # 

Methods

verbatim :: Content i -> String #

info :: Content t -> t #

Administrative parts of the document

data Prolog #

Constructors

Prolog (Maybe XMLDecl) [Misc] (Maybe DocTypeDecl) [Misc] 

Instances

Eq Prolog # 

Methods

(==) :: Prolog -> Prolog -> Bool #

(/=) :: Prolog -> Prolog -> Bool #

Show Prolog # 

data Misc #

Instances

Eq Misc # 

Methods

(==) :: Misc -> Misc -> Bool #

(/=) :: Misc -> Misc -> Bool #

Show Misc # 

Methods

showsPrec :: Int -> Misc -> ShowS #

show :: Misc -> String #

showList :: [Misc] -> ShowS #

type SDDecl = Bool #

The DTD

content model

data CP #

Instances

Eq CP # 

Methods

(==) :: CP -> CP -> Bool #

(/=) :: CP -> CP -> Bool #

Show CP # 

Methods

showsPrec :: Int -> CP -> ShowS #

show :: CP -> String #

showList :: [CP] -> ShowS #

data Modifier #

Constructors

None

Just One

Query

Zero Or One

Star

Zero Or More

Plus

One Or More

data Mixed #

Constructors

PCDATA 
PCDATAplus [QName] 

Instances

Eq Mixed # 

Methods

(==) :: Mixed -> Mixed -> Bool #

(/=) :: Mixed -> Mixed -> Bool #

Show Mixed # 

Methods

showsPrec :: Int -> Mixed -> ShowS #

show :: Mixed -> String #

showList :: [Mixed] -> ShowS #

attribute model

data AttDef #

Instances

Eq AttDef # 

Methods

(==) :: AttDef -> AttDef -> Bool #

(/=) :: AttDef -> AttDef -> Bool #

Show AttDef # 

data FIXED #

Constructors

FIXED 

Instances

Eq FIXED # 

Methods

(==) :: FIXED -> FIXED -> Bool #

(/=) :: FIXED -> FIXED -> Bool #

Show FIXED # 

Methods

showsPrec :: Int -> FIXED -> ShowS #

show :: FIXED -> String #

showList :: [FIXED] -> ShowS #

conditional sections

data Ignore #

Constructors

Ignore 

Instances

Eq Ignore # 

Methods

(==) :: Ignore -> Ignore -> Bool #

(/=) :: Ignore -> Ignore -> Bool #

Show Ignore # 

References

type CharRef = Int #

Entities

data GEDecl #

Constructors

GEDecl Name EntityDef 

Instances

Eq GEDecl # 

Methods

(==) :: GEDecl -> GEDecl -> Bool #

(/=) :: GEDecl -> GEDecl -> Bool #

Show GEDecl # 

data PEDecl #

Constructors

PEDecl Name PEDef 

Instances

Eq PEDecl # 

Methods

(==) :: PEDecl -> PEDecl -> Bool #

(/=) :: PEDecl -> PEDecl -> Bool #

Show PEDecl # 

data PEDef #

Instances

Eq PEDef # 

Methods

(==) :: PEDef -> PEDef -> Bool #

(/=) :: PEDef -> PEDef -> Bool #

Show PEDef # 

Methods

showsPrec :: Int -> PEDef -> ShowS #

show :: PEDef -> String #

showList :: [PEDef] -> ShowS #

newtype NDataDecl #

Constructors

NDATA Name 

data ExtParsedEnt i #

Constructors

ExtParsedEnt (Maybe TextDecl) (Content i) 

data ExtPE #

Constructors

ExtPE (Maybe TextDecl) [ExtSubsetDecl] 

Instances

Eq ExtPE # 

Methods

(==) :: ExtPE -> ExtPE -> Bool #

(/=) :: ExtPE -> ExtPE -> Bool #

Show ExtPE # 

Methods

showsPrec :: Int -> ExtPE -> ShowS #

show :: ExtPE -> String #

showList :: [ExtPE] -> ShowS #

newtype PublicID #

Constructors

PUBLICID PubidLiteral 

data EV #

Instances

Eq EV # 

Methods

(==) :: EV -> EV -> Bool #

(/=) :: EV -> EV -> Bool #

Show EV # 

Methods

showsPrec :: Int -> EV -> ShowS #

show :: EV -> String #

showList :: [EV] -> ShowS #

Namespaces

data QName #

A QName is a (possibly) qualified name, in the sense of XML namespaces.

Constructors

N Name 
QN Namespace Name 

Instances

Eq QName # 

Methods

(==) :: QName -> QName -> Bool #

(/=) :: QName -> QName -> Bool #

Ord QName # 

Methods

compare :: QName -> QName -> Ordering #

(<) :: QName -> QName -> Bool #

(<=) :: QName -> QName -> Bool #

(>) :: QName -> QName -> Bool #

(>=) :: QName -> QName -> Bool #

max :: QName -> QName -> QName #

min :: QName -> QName -> QName #

Show QName # 

Methods

showsPrec :: Int -> QName -> ShowS #

show :: QName -> String #

showList :: [QName] -> ShowS #

data Namespace #

Namespaces are not defined in the XML spec itself, but at http://www.w3.org/TR/xml-names

Constructors

Namespace 

Fields

Basic value types

type Name = String #

type Names = [Name] #

type NmTokens = [NmToken] #