hxt-9.3.1.16: A collection of tools for processing XML with Haskell.

CopyrightCopyright (C) 2010 Uwe Schmidt
LicenseMIT
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Text.XML.HXT.Arrow.XmlState.ErrorHandling

Description

the basic state arrows for XML processing

A state is needed for global processing options, like encoding options, document base URI, trace levels and error message handling

The state is separated into a user defined state and a system state. The system state contains variables for error message handling, for tracing, for the document base for accessing XML documents with relative references, e.g. DTDs, and a global key value store. This assoc list has strings as keys and lists of XmlTrees as values. It is used to store arbitrary XML and text values, e.g. user defined global options.

The user defined part of the store is in the default case empty, defined as (). It can be extended with an arbitray data type

Synopsis

Documentation

clearErrStatus :: IOStateArrow s b b #

reset global error variable

setErrStatus :: IOStateArrow s Int Int #

set global error variable

getErrStatus :: IOStateArrow s XmlTree Int #

read current global error status

setErrMsgStatus :: IOStateArrow s XmlTree XmlTree #

raise the global error status level to that of the input tree

setErrorMsgHandler :: Bool -> (String -> IO ()) -> IOStateArrow s b b #

set the error message handler and the flag for collecting the errors

sysErrorMsg :: IOStateArrow s XmlTree XmlTree #

error message handler for output to stderr

errorMsgStderr :: IOStateArrow s b b #

the default error message handler: error output to stderr

errorMsgCollect :: IOStateArrow s b b #

error message handler for collecting errors

errorMsgStderrAndCollect :: IOStateArrow s b b #

error message handler for output to stderr and collecting

errorMsgIgnore :: IOStateArrow s b b #

error message handler for ignoring errors

getErrorMessages :: IOStateArrow s b XmlTree #

if error messages are collected by the error handler for processing these messages by the calling application, this arrow reads the stored messages and clears the error message store

filterErrorMsg :: IOStateArrow s XmlTree XmlTree #

filter error messages from input trees and issue errors

issueWarn :: String -> IOStateArrow s b b #

generate a warnig message

issueErr :: String -> IOStateArrow s b b #

generate an error message

issueFatal :: String -> IOStateArrow s b b #

generate a fatal error message, e.g. document not found

issueExc :: String -> IOStateArrow s SomeException b #

Default exception handler: issue a fatal error message and fail.

The parameter can be used to specify where the error occured

setDocumentStatus :: Int -> String -> IOStateArrow s XmlTree XmlTree #

add the error level and the module where the error occured to the attributes of a document root node and remove the children when level is greater or equal to c_err. called by setDocumentStatusFromSystemState when the system state indicates an error

setDocumentStatusFromSystemState :: String -> IOStateArrow s XmlTree XmlTree #

check whether the error level attribute in the system state is set to error, in this case the children of the document root are removed and the module name where the error occured and the error level are added as attributes with setDocumentStatus else nothing is changed

documentStatusOk :: ArrowXml a => a XmlTree XmlTree #

check whether tree is a document root and the status attribute has a value less than c_err