| Copyright | (c) Galois Inc. 2007 (c) Herbert Valerio Riedel 2019 |
|---|---|
| License | BSD-3-Clause AND GPL-3.0-or-later |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Text.XML.Input
Description
Lightweight XML parsing
Synopsis
- parseXML :: XmlSource s => s -> Either (Pos, String) [Content]
- parseXMLDoc :: XmlSource s => s -> Either (Pos, String) Element
- parseXMLRoot :: XmlSource s => s -> Either (Pos, String) Root
- class XmlSource s where
- data Scanner s
- customScanner :: (s -> Maybe (Char, s)) -> s -> Scanner s
- data Token
- scanXML :: XmlSource source => source -> [Token]
High-level DOM Parser
parseXML :: XmlSource s => s -> Either (Pos, String) [Content] Source #
parseXML to a list of Content chunks
NOTE: As opposed to parseXMLDoc, this function will not discard any BOM characters.
parseXMLDoc :: XmlSource s => s -> Either (Pos, String) Element Source #
Parse a XML document to an Element
If you need access to the prolog and epilog use parseXMLRoot
An optional (single) leading BOM (U+FEFF) character will be discard (and not counted in the source positions).
parseXMLRoot :: XmlSource s => s -> Either (Pos, String) Root Source #
Parse a XML document
An optional (single) leading BOM (U+FEFF) character will be discard (and not counted in the source positions).
Token Scanner
This type may be used to provide a custom scanning function for extracting characters.
customScanner :: (s -> Maybe (Char, s)) -> s -> Scanner s Source #
This type may be used to provide a custom scanning function for extracting characters.
XML Lexer token.
Constructors
| TokStart !Pos QName [Attr] Bool | opening start-tag (the |
| TokEnd !Pos QName | closing end-tag |
| TokCRef ShortText | character entity reference |
| TokText CData | character data |
| TokError !Pos String | Lexer error |
| TokXmlDecl XmlDeclaration | |
| TokComment Comment | |
| TokPI !Pos PI | |
| TokDTD Text |