Data.XML.Types

xml-types-0.3.8: Basic types for representing XML

Copyright | 2010-2011 John Millikin
License | MIT
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.XML.Types

Contents

- Types
  - Document prologue
  - Document body
  - Doctypes
  - Incremental processing
- Combinators
  - Filters
  - Element traversal
  - Node traversal
  - Attributes

Description

Basic types for representing XML.

The idea is to have a full set of appropriate types, which various XML libraries can share. Instead of having equivalent-but-incompatible types for every binding, parser, or client, they all share the same types can can thus interoperate easily.

This library contains complete types for most parts of an XML document, including the prologue, node tree, and doctype. Some basic combinators are included for common tasks, including traversing the node tree and filtering children.

Synopsis

- data Document = Document {
  - documentPrologue :: Prologue
  - documentRoot :: Element
  - documentEpilogue :: [Miscellaneous]
  }
- data Prologue = Prologue {
  - prologueBefore :: [Miscellaneous]
  - prologueDoctype :: Maybe Doctype
  - prologueAfter :: [Miscellaneous]
  }
- data Instruction = Instruction {
  - instructionTarget :: Text
  - instructionData :: Text
  }
- data Miscellaneous
  - = MiscInstruction Instruction
  - | MiscComment Text
- data Node
  - = NodeElement Element
  - | NodeInstruction Instruction
  - | NodeContent Content
  - | NodeComment Text
- data Element = Element {
  - elementName :: Name
  - elementAttributes :: [(Name, [Content])]
  - elementNodes :: [Node]
  }
- data Content
  - = ContentText Text
  - | ContentEntity Text
- data Name = Name {
  - nameLocalName :: Text
  - nameNamespace :: Maybe Text
  - namePrefix :: Maybe Text
  }
- data Doctype = Doctype {
  - doctypeName :: Text
  - doctypeID :: Maybe ExternalID
  }
- data ExternalID
  - = SystemID Text
  - | PublicID Text Text
- data Event
  - = EventBeginDocument
  - | EventEndDocument
  - | EventBeginDoctype Text (Maybe ExternalID)
  - | EventEndDoctype
  - | EventInstruction Instruction
  - | EventBeginElement Name [(Name, [Content])]
  - | EventEndElement Name
  - | EventContent Content
  - | EventComment Text
  - | EventCDATA Text
- isElement :: Node -> [Element]
- isInstruction :: Node -> [Instruction]
- isContent :: Node -> [Content]
- isComment :: Node -> [Text]
- isNamed :: Name -> Element -> [Element]
- elementChildren :: Element -> [Element]
- elementContent :: Element -> [Content]
- elementText :: Element -> [Text]
- nodeChildren :: Node -> [Node]
- nodeContent :: Node -> [Content]
- nodeText :: Node -> [Text]
- hasAttribute :: Name -> Element -> [Element]
- hasAttributeText :: Name -> (Text -> Bool) -> Element -> [Element]
- attributeContent :: Name -> Element -> Maybe [Content]
- attributeText :: Name -> Element -> Maybe Text

# Types

## Document prologue

data Document #

Constructors

Document |
Fields documentPrologue :: Prologue documentRoot :: Element documentEpilogue :: [Miscellaneous]

#### Instances

Instances details

Data Document # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Document -> c Document gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Document toConstr :: Document -> Constr dataTypeOf :: Document -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Document) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Document) gmapT :: (forall b. Data b => b -> b) -> Document -> Document gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Document -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Document -> r gmapQ :: (forall d. Data d => d -> u) -> Document -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Document -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Document -> m Document gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Document -> m Document gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Document -> m Document
Generic Document # |
Instance details Defined in Data.XML.Types Associated Types type Rep Document :: Type -> Type Methods from :: Document -> Rep Document x to :: Rep Document x -> Document
Show Document # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Document -> ShowS show :: Document -> String showList :: [Document] -> ShowS
NFData Document # |
Instance details Defined in Data.XML.Types Methods rnf :: Document -> ()
Eq Document # |
Instance details Defined in Data.XML.Types Methods (==) :: Document -> Document -> Bool (/=) :: Document -> Document -> Bool
Ord Document # |
Instance details Defined in Data.XML.Types Methods compare :: Document -> Document -> Ordering (<) :: Document -> Document -> Bool (<=) :: Document -> Document -> Bool (>) :: Document -> Document -> Bool (>=) :: Document -> Document -> Bool max :: Document -> Document -> Document min :: Document -> Document -> Document
type Rep Document # |
Instance details Defined in Data.XML.Types type Rep Document = D1 ('MetaData "Document" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Document" 'PrefixI 'True) (S1 ('MetaSel ('Just "documentPrologue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prologue) :*: (S1 ('MetaSel ('Just "documentRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Element) :*: S1 ('MetaSel ('Just "documentEpilogue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Miscellaneous]))))

data Prologue #

Constructors

Prologue |
Fields prologueBefore :: [Miscellaneous] prologueDoctype :: Maybe Doctype prologueAfter :: [Miscellaneous]

#### Instances

Instances details

Data Prologue # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Prologue -> c Prologue gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Prologue toConstr :: Prologue -> Constr dataTypeOf :: Prologue -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Prologue) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Prologue) gmapT :: (forall b. Data b => b -> b) -> Prologue -> Prologue gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Prologue -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Prologue -> r gmapQ :: (forall d. Data d => d -> u) -> Prologue -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Prologue -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Prologue -> m Prologue gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Prologue -> m Prologue gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Prologue -> m Prologue
Generic Prologue # |
Instance details Defined in Data.XML.Types Associated Types type Rep Prologue :: Type -> Type Methods from :: Prologue -> Rep Prologue x to :: Rep Prologue x -> Prologue
Show Prologue # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Prologue -> ShowS show :: Prologue -> String showList :: [Prologue] -> ShowS
NFData Prologue # |
Instance details Defined in Data.XML.Types Methods rnf :: Prologue -> ()
Eq Prologue # |
Instance details Defined in Data.XML.Types Methods (==) :: Prologue -> Prologue -> Bool (/=) :: Prologue -> Prologue -> Bool
Ord Prologue # |
Instance details Defined in Data.XML.Types Methods compare :: Prologue -> Prologue -> Ordering (<) :: Prologue -> Prologue -> Bool (<=) :: Prologue -> Prologue -> Bool (>) :: Prologue -> Prologue -> Bool (>=) :: Prologue -> Prologue -> Bool max :: Prologue -> Prologue -> Prologue min :: Prologue -> Prologue -> Prologue
type Rep Prologue # |
Instance details Defined in Data.XML.Types type Rep Prologue = D1 ('MetaData "Prologue" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Prologue" 'PrefixI 'True) (S1 ('MetaSel ('Just "prologueBefore") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Miscellaneous]) :*: (S1 ('MetaSel ('Just "prologueDoctype") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Doctype)) :*: S1 ('MetaSel ('Just "prologueAfter") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Miscellaneous]))))

data Instruction #

Constructors

Instruction |
Fields instructionTarget :: Text instructionData :: Text

#### Instances

Instances details

Data Instruction # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Instruction -> c Instruction gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Instruction toConstr :: Instruction -> Constr dataTypeOf :: Instruction -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Instruction) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Instruction) gmapT :: (forall b. Data b => b -> b) -> Instruction -> Instruction gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Instruction -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Instruction -> r gmapQ :: (forall d. Data d => d -> u) -> Instruction -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Instruction -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Instruction -> m Instruction gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Instruction -> m Instruction gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Instruction -> m Instruction
Generic Instruction # |
Instance details Defined in Data.XML.Types Associated Types type Rep Instruction :: Type -> Type Methods from :: Instruction -> Rep Instruction x to :: Rep Instruction x -> Instruction
Show Instruction # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Instruction -> ShowS show :: Instruction -> String showList :: [Instruction] -> ShowS
NFData Instruction # |
Instance details Defined in Data.XML.Types Methods rnf :: Instruction -> ()
Eq Instruction # |
Instance details Defined in Data.XML.Types Methods (==) :: Instruction -> Instruction -> Bool (/=) :: Instruction -> Instruction -> Bool
Ord Instruction # |
Instance details Defined in Data.XML.Types Methods compare :: Instruction -> Instruction -> Ordering (<) :: Instruction -> Instruction -> Bool (<=) :: Instruction -> Instruction -> Bool (>) :: Instruction -> Instruction -> Bool (>=) :: Instruction -> Instruction -> Bool max :: Instruction -> Instruction -> Instruction min :: Instruction -> Instruction -> Instruction
type Rep Instruction # |
Instance details Defined in Data.XML.Types type Rep Instruction = D1 ('MetaData "Instruction" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Instruction" 'PrefixI 'True) (S1 ('MetaSel ('Just "instructionTarget") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "instructionData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Miscellaneous #

Constructors

MiscInstruction Instruction |
MiscComment Text |

#### Instances

Instances details

Data Miscellaneous # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Miscellaneous -> c Miscellaneous gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Miscellaneous toConstr :: Miscellaneous -> Constr dataTypeOf :: Miscellaneous -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Miscellaneous) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Miscellaneous) gmapT :: (forall b. Data b => b -> b) -> Miscellaneous -> Miscellaneous gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Miscellaneous -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Miscellaneous -> r gmapQ :: (forall d. Data d => d -> u) -> Miscellaneous -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Miscellaneous -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Miscellaneous -> m Miscellaneous gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Miscellaneous -> m Miscellaneous gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Miscellaneous -> m Miscellaneous
Generic Miscellaneous # |
Instance details Defined in Data.XML.Types Associated Types type Rep Miscellaneous :: Type -> Type Methods from :: Miscellaneous -> Rep Miscellaneous x to :: Rep Miscellaneous x -> Miscellaneous
Show Miscellaneous # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Miscellaneous -> ShowS show :: Miscellaneous -> String showList :: [Miscellaneous] -> ShowS
NFData Miscellaneous # |
Instance details Defined in Data.XML.Types Methods rnf :: Miscellaneous -> ()
Eq Miscellaneous # |
Instance details Defined in Data.XML.Types Methods (==) :: Miscellaneous -> Miscellaneous -> Bool (/=) :: Miscellaneous -> Miscellaneous -> Bool
Ord Miscellaneous # |
Instance details Defined in Data.XML.Types Methods compare :: Miscellaneous -> Miscellaneous -> Ordering (<) :: Miscellaneous -> Miscellaneous -> Bool (<=) :: Miscellaneous -> Miscellaneous -> Bool (>) :: Miscellaneous -> Miscellaneous -> Bool (>=) :: Miscellaneous -> Miscellaneous -> Bool max :: Miscellaneous -> Miscellaneous -> Miscellaneous min :: Miscellaneous -> Miscellaneous -> Miscellaneous
type Rep Miscellaneous # |
Instance details Defined in Data.XML.Types type Rep Miscellaneous = D1 ('MetaData "Miscellaneous" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "MiscInstruction" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Instruction)) :+: C1 ('MetaCons "MiscComment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

## Document body

data Node #

Constructors

NodeElement Element |
NodeInstruction Instruction |
NodeContent Content |
NodeComment Text |

#### Instances

Instances details

Data Node # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Node -> c Node gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Node toConstr :: Node -> Constr dataTypeOf :: Node -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Node) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Node) gmapT :: (forall b. Data b => b -> b) -> Node -> Node gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Node -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Node -> r gmapQ :: (forall d. Data d => d -> u) -> Node -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Node -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Node -> m Node gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Node -> m Node gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Node -> m Node
IsString Node # |
Instance details Defined in Data.XML.Types Methods fromString :: String -> Node
Generic Node # |
Instance details Defined in Data.XML.Types Associated Types type Rep Node :: Type -> Type Methods from :: Node -> Rep Node x to :: Rep Node x -> Node
Show Node # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Node -> ShowS show :: Node -> String showList :: [Node] -> ShowS
NFData Node # |
Instance details Defined in Data.XML.Types Methods rnf :: Node -> ()
Eq Node # |
Instance details Defined in Data.XML.Types Methods (==) :: Node -> Node -> Bool (/=) :: Node -> Node -> Bool
Ord Node # |
Instance details Defined in Data.XML.Types Methods compare :: Node -> Node -> Ordering (<) :: Node -> Node -> Bool (<=) :: Node -> Node -> Bool (>) :: Node -> Node -> Bool (>=) :: Node -> Node -> Bool max :: Node -> Node -> Node min :: Node -> Node -> Node
type Rep Node # |
Instance details Defined in Data.XML.Types type Rep Node = D1 ('MetaData "Node" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) ((C1 ('MetaCons "NodeElement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Element)) :+: C1 ('MetaCons "NodeInstruction" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Instruction))) :+: (C1 ('MetaCons "NodeContent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Content)) :+: C1 ('MetaCons "NodeComment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))

data Element #

Constructors

Element |
Fields elementName :: Name elementAttributes :: [(Name, [Content])] elementNodes :: [Node]

#### Instances

Instances details

Data Element # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Element -> c Element gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Element toConstr :: Element -> Constr dataTypeOf :: Element -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Element) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Element) gmapT :: (forall b. Data b => b -> b) -> Element -> Element gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Element -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Element -> r gmapQ :: (forall d. Data d => d -> u) -> Element -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Element -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Element -> m Element gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Element -> m Element gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Element -> m Element
Generic Element # |
Instance details Defined in Data.XML.Types Associated Types type Rep Element :: Type -> Type Methods from :: Element -> Rep Element x to :: Rep Element x -> Element
Show Element # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Element -> ShowS show :: Element -> String showList :: [Element] -> ShowS
NFData Element # |
Instance details Defined in Data.XML.Types Methods rnf :: Element -> ()
Eq Element # |
Instance details Defined in Data.XML.Types Methods (==) :: Element -> Element -> Bool (/=) :: Element -> Element -> Bool
Ord Element # |
Instance details Defined in Data.XML.Types Methods compare :: Element -> Element -> Ordering (<) :: Element -> Element -> Bool (<=) :: Element -> Element -> Bool (>) :: Element -> Element -> Bool (>=) :: Element -> Element -> Bool max :: Element -> Element -> Element min :: Element -> Element -> Element
type Rep Element # |
Instance details Defined in Data.XML.Types type Rep Element = D1 ('MetaData "Element" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Element" 'PrefixI 'True) (S1 ('MetaSel ('Just "elementName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: (S1 ('MetaSel ('Just "elementAttributes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Name, [Content])]) :*: S1 ('MetaSel ('Just "elementNodes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Node]))))

data Content #

Constructors

ContentText Text |
ContentEntity Text | For pass-through parsing

#### Instances

Instances details

Data Content # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Content -> c Content gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Content toConstr :: Content -> Constr dataTypeOf :: Content -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Content) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Content) gmapT :: (forall b. Data b => b -> b) -> Content -> Content gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Content -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Content -> r gmapQ :: (forall d. Data d => d -> u) -> Content -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Content -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Content -> m Content gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Content -> m Content gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Content -> m Content
IsString Content # |
Instance details Defined in Data.XML.Types Methods fromString :: String -> Content
Generic Content # |
Instance details Defined in Data.XML.Types Associated Types type Rep Content :: Type -> Type Methods from :: Content -> Rep Content x to :: Rep Content x -> Content
Show Content # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Content -> ShowS show :: Content -> String showList :: [Content] -> ShowS
NFData Content # |
Instance details Defined in Data.XML.Types Methods rnf :: Content -> ()
Eq Content # |
Instance details Defined in Data.XML.Types Methods (==) :: Content -> Content -> Bool (/=) :: Content -> Content -> Bool
Ord Content # |
Instance details Defined in Data.XML.Types Methods compare :: Content -> Content -> Ordering (<) :: Content -> Content -> Bool (<=) :: Content -> Content -> Bool (>) :: Content -> Content -> Bool (>=) :: Content -> Content -> Bool max :: Content -> Content -> Content min :: Content -> Content -> Content
type Rep Content # |
Instance details Defined in Data.XML.Types type Rep Content = D1 ('MetaData "Content" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "ContentText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "ContentEntity" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Name #

A fully qualified name.

Prefixes are not semantically important; they are included only to simplify pass-through parsing. When comparing names with `Eq` or `Ord` methods, prefixes are ignored.

The `IsString` instance supports Clark notation; see http://www.jclark.com/xml/xmlns.htm and http://infohost.nmt.edu/tcc/help/pubs/pylxml/etree-QName.html. Use the `OverloadedStrings` language extension for very simple `Name` construction:

    myname :: Name
    myname = "{http://example.com/ns/my-namespace}my-name"

Constructors

Name |
Fields nameLocalName :: Text nameNamespace :: Maybe Text namePrefix :: Maybe Text

#### Instances

Instances details

Data Name # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name toConstr :: Name -> Constr dataTypeOf :: Name -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) gmapT :: (forall b. Data b => b -> b) -> Name -> Name gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name
IsString Name # |
Instance details Defined in Data.XML.Types Methods fromString :: String -> Name
Generic Name # |
Instance details Defined in Data.XML.Types Associated Types type Rep Name :: Type -> Type Methods from :: Name -> Rep Name x to :: Rep Name x -> Name
Show Name # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Name -> ShowS show :: Name -> String showList :: [Name] -> ShowS
NFData Name # |
Instance details Defined in Data.XML.Types Methods rnf :: Name -> ()
Eq Name # |
Instance details Defined in Data.XML.Types Methods (==) :: Name -> Name -> Bool (/=) :: Name -> Name -> Bool
Ord Name # |
Instance details Defined in Data.XML.Types Methods compare :: Name -> Name -> Ordering (<) :: Name -> Name -> Bool (<=) :: Name -> Name -> Bool (>) :: Name -> Name -> Bool (>=) :: Name -> Name -> Bool max :: Name -> Name -> Name min :: Name -> Name -> Name
type Rep Name # |
Instance details Defined in Data.XML.Types type Rep Name = D1 ('MetaData "Name" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "nameLocalName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "nameNamespace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "namePrefix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))

## Doctypes

data Doctype #

Note: due to the incredible complexity of DTDs, this type only supports external subsets. I've tried adding internal subset types, but they quickly gain more code than the rest of this module put together.

It is possible that some future version of this library might support internal subsets, but I am no longer actively working on adding them.

Constructors

Doctype |
Fields doctypeName :: Text doctypeID :: Maybe ExternalID

#### Instances

Instances details

Data Doctype # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Doctype -> c Doctype gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Doctype toConstr :: Doctype -> Constr dataTypeOf :: Doctype -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Doctype) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Doctype) gmapT :: (forall b. Data b => b -> b) -> Doctype -> Doctype gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Doctype -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Doctype -> r gmapQ :: (forall d. Data d => d -> u) -> Doctype -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Doctype -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Doctype -> m Doctype gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Doctype -> m Doctype gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Doctype -> m Doctype
Generic Doctype # |
Instance details Defined in Data.XML.Types Associated Types type Rep Doctype :: Type -> Type Methods from :: Doctype -> Rep Doctype x to :: Rep Doctype x -> Doctype
Show Doctype # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Doctype -> ShowS show :: Doctype -> String showList :: [Doctype] -> ShowS
NFData Doctype # |
Instance details Defined in Data.XML.Types Methods rnf :: Doctype -> ()
Eq Doctype # |
Instance details Defined in Data.XML.Types Methods (==) :: Doctype -> Doctype -> Bool (/=) :: Doctype -> Doctype -> Bool
Ord Doctype # |
Instance details Defined in Data.XML.Types Methods compare :: Doctype -> Doctype -> Ordering (<) :: Doctype -> Doctype -> Bool (<=) :: Doctype -> Doctype -> Bool (>) :: Doctype -> Doctype -> Bool (>=) :: Doctype -> Doctype -> Bool max :: Doctype -> Doctype -> Doctype min :: Doctype -> Doctype -> Doctype
type Rep Doctype # |
Instance details Defined in Data.XML.Types type Rep Doctype = D1 ('MetaData "Doctype" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "Doctype" 'PrefixI 'True) (S1 ('MetaSel ('Just "doctypeName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "doctypeID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ExternalID))))

data ExternalID #

Constructors

SystemID Text |
PublicID Text Text |

#### Instances

Instances details

Data ExternalID # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ExternalID -> c ExternalID gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ExternalID toConstr :: ExternalID -> Constr dataTypeOf :: ExternalID -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ExternalID) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ExternalID) gmapT :: (forall b. Data b => b -> b) -> ExternalID -> ExternalID gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ExternalID -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ExternalID -> r gmapQ :: (forall d. Data d => d -> u) -> ExternalID -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> ExternalID -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> ExternalID -> m ExternalID gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ExternalID -> m ExternalID gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ExternalID -> m ExternalID
Generic ExternalID # |
Instance details Defined in Data.XML.Types Associated Types type Rep ExternalID :: Type -> Type Methods from :: ExternalID -> Rep ExternalID x to :: Rep ExternalID x -> ExternalID
Show ExternalID # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> ExternalID -> ShowS show :: ExternalID -> String showList :: [ExternalID] -> ShowS
NFData ExternalID # |
Instance details Defined in Data.XML.Types Methods rnf :: ExternalID -> ()
Eq ExternalID # |
Instance details Defined in Data.XML.Types Methods (==) :: ExternalID -> ExternalID -> Bool (/=) :: ExternalID -> ExternalID -> Bool
Ord ExternalID # |
Instance details Defined in Data.XML.Types Methods compare :: ExternalID -> ExternalID -> Ordering (<) :: ExternalID -> ExternalID -> Bool (<=) :: ExternalID -> ExternalID -> Bool (>) :: ExternalID -> ExternalID -> Bool (>=) :: ExternalID -> ExternalID -> Bool max :: ExternalID -> ExternalID -> ExternalID min :: ExternalID -> ExternalID -> ExternalID
type Rep ExternalID # |
Instance details Defined in Data.XML.Types type Rep ExternalID = D1 ('MetaData "ExternalID" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (C1 ('MetaCons "SystemID" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "PublicID" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

## Incremental processing

data Event #

Some XML processing tools are incremental, and work in terms of events rather than node trees. The `Event` type allows a document to be fully specified as a sequence of events.

Event-based XML libraries include:

- http://hackage.haskell.org/package/xml-enumerator
- http://hackage.haskell.org/package/libxml-enumerator
- http://hackage.haskell.org/package/expat-enumerator

Constructors

EventBeginDocument |
EventEndDocument |
EventBeginDoctype Text (Maybe ExternalID) |
EventEndDoctype |
EventInstruction Instruction |
EventBeginElement Name [(Name, [Content])] |
EventEndElement Name |
EventContent Content |
EventComment Text |
EventCDATA Text |

#### Instances

Instances details

Data Event # |
Instance details Defined in Data.XML.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Event -> c Event gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Event toConstr :: Event -> Constr dataTypeOf :: Event -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Event) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Event) gmapT :: (forall b. Data b => b -> b) -> Event -> Event gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Event -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Event -> r gmapQ :: (forall d. Data d => d -> u) -> Event -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Event -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Event -> m Event gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Event -> m Event gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Event -> m Event
Generic Event # |
Instance details Defined in Data.XML.Types Associated Types type Rep Event :: Type -> Type Methods from :: Event -> Rep Event x to :: Rep Event x -> Event
Show Event # |
Instance details Defined in Data.XML.Types Methods showsPrec :: Int -> Event -> ShowS show :: Event -> String showList :: [Event] -> ShowS
NFData Event # |
Instance details Defined in Data.XML.Types Methods rnf :: Event -> ()
Eq Event # |
Instance details Defined in Data.XML.Types Methods (==) :: Event -> Event -> Bool (/=) :: Event -> Event -> Bool
Ord Event # |
Instance details Defined in Data.XML.Types Methods compare :: Event -> Event -> Ordering (<) :: Event -> Event -> Bool (<=) :: Event -> Event -> Bool (>) :: Event -> Event -> Bool (>=) :: Event -> Event -> Bool max :: Event -> Event -> Event min :: Event -> Event -> Event
type Rep Event # |
Instance details Defined in Data.XML.Types type Rep Event = D1 ('MetaData "Event" "Data.XML.Types" "xml-types-0.3.8-8EXwO43JCbrC00VO4U1sKq" 'False) (((C1 ('MetaCons "EventBeginDocument" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EventEndDocument" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "EventBeginDoctype" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ExternalID))) :+: (C1 ('MetaCons "EventEndDoctype" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EventInstruction" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Instruction))))) :+: ((C1 ('MetaCons "EventBeginElement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Name, [Content])])) :+: C1 ('MetaCons "EventEndElement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name))) :+: (C1 ('MetaCons "EventContent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Content)) :+: (C1 ('MetaCons "EventComment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "EventCDATA" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))))

# Combinators

## Filters

isElement :: Node -> [Element] #

isInstruction :: Node -> [Instruction] #

isContent :: Node -> [Content] #

isComment :: Node -> [Text] #

isNamed :: Name -> Element -> [Element] #

## Element traversal

elementChildren :: Element -> [Element] #

elementContent :: Element -> [Content] #

elementText :: Element -> [Text] #

## Node traversal

nodeChildren :: Node -> [Node] #

nodeContent :: Node -> [Content] #

nodeText :: Node -> [Text] #

## Attributes

hasAttribute :: Name -> Element -> [Element] #

hasAttributeText :: Name -> (Text -> Bool) -> Element -> [Element] #

attributeContent :: Name -> Element -> Maybe [Content] #

attributeText :: Name -> Element -> Maybe Text #