HaXml-1.19.1: Utilities for manipulating XML documentsContentsIndex
Text.XML.HaXml.SAX
Description
A streaming XML parser, using a method known as SAX. SAX isn't really a standard, but an implementation, so it's just an "SAX-like" parser. This module allows you parse an XML document without having to evaluate it as a whole. This is needed for protocols like jabber, which use xml streams for communication.
Synopsis
data SaxElement
= SaxDocTypeDecl DocTypeDecl
| SaxProcessingInstruction ProcessingInstruction
| SaxComment String
| SaxElementOpen Name [Attribute]
| SaxElementClose Name
| SaxElementTag Name [Attribute]
| SaxCharData CharData
| SaxReference Reference
saxParse :: String -> String -> ([SaxElement], Maybe String)
Documentation
data SaxElement
Constructors
SaxDocTypeDecl DocTypeDeclA doctype declaration occured(<!DOCTYPE>)
SaxProcessingInstruction ProcessingInstructionA processing instruction occured (<??>)
SaxComment StringA comment occured (<!-- -->)
SaxElementOpen Name [Attribute]An element was opened (<>)
SaxElementClose NameAn element was closed (</>)
SaxElementTag Name [Attribute]An element without content occured (</>)
SaxCharData CharDataSome string data occured
SaxReference ReferenceA reference occured
saxParse
:: StringThe filename
-> StringThe content of the file
-> ([SaxElement], Maybe String)A tuple of the parsed elements and Nothing, if no error occured, or Just String if an error occured.
saxParse file content takes a filename and the string content of that file and generates a stream of SaxElements. If an error occurs, the parsing stops and a string is returned using the Maybe type.
Produced by Haddock version 0.8