X-0.1.0.0: A light-weight XML library

Copyright(c) Galois Inc. 2007
(c) Herbert Valerio Riedel 2019
LicenseBSD-3-Clause AND GPL-3.0-or-later
Safe HaskellNone
LanguageHaskell2010

Text.XML.Input

Contents

Description

Lightweight XML parsing

Synopsis

High-level DOM Parser

parseXML :: XmlSource s => s -> Either (Pos, String) [Content] Source #

parseXML to a list of Content chunks

parseXMLDoc :: XmlSource s => s -> Either (Pos, String) Element Source #

parseXMLDoc, parse a XML document to an Element

Token Scanner

class XmlSource s where Source #

Methods

uncons :: s -> Maybe (Char, s) Source #

Instances
XmlSource String Source # 
Instance details

Defined in Text.XML.Lexer

XmlSource Text Source # 
Instance details

Defined in Text.XML.Lexer

Methods

uncons :: Text -> Maybe (Char, Text) Source #

XmlSource Text Source # 
Instance details

Defined in Text.XML.Lexer

Methods

uncons :: Text -> Maybe (Char, Text) Source #

XmlSource (Scanner s) Source # 
Instance details

Defined in Text.XML.Lexer

Methods

uncons :: Scanner s -> Maybe (Char, Scanner s) Source #

data Scanner s Source #

This type may be used to provide a custom scanning function for extracting characters.

Instances
XmlSource (Scanner s) Source # 
Instance details

Defined in Text.XML.Lexer

Methods

uncons :: Scanner s -> Maybe (Char, Scanner s) Source #

customScanner :: (s -> Maybe (Char, s)) -> s -> Scanner s Source #

This type may be used to provide a custom scanning function for extracting characters.

data Token Source #

XML Lexer token.

Constructors

TokStart !Pos QName [Attr] Bool

opening start-tag (the Bool field denotes whether this is an empty tag)

TokEnd !Pos QName

closing end-tag

TokCRef ShortText

character entity reference

TokText CData

character data

TokError !Pos String

Lexer error

Instances
Data Token Source # 
Instance details

Defined in Text.XML.Lexer

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Token -> c Token #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Token #

toConstr :: Token -> Constr #

dataTypeOf :: Token -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Token) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Token) #

gmapT :: (forall b. Data b => b -> b) -> Token -> Token #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Token -> r #

gmapQ :: (forall d. Data d => d -> u) -> Token -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Token -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Token -> m Token #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Token -> m Token #

Show Token Source # 
Instance details

Defined in Text.XML.Lexer

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Generic Token Source # 
Instance details

Defined in Text.XML.Lexer

Associated Types

type Rep Token :: Type -> Type #

Methods

from :: Token -> Rep Token x #

to :: Rep Token x -> Token #

NFData Token Source # 
Instance details

Defined in Text.XML.Lexer

Methods

rnf :: Token -> () #

type Rep Token Source # 
Instance details

Defined in Text.XML.Lexer

scanXML :: XmlSource source => source -> [Token] Source #

Run XML lexer over XmlSource