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

Portabilityportable
Stabilitystable
MaintainerUwe Schmidt (uwe@fh-wedel.de)
Safe HaskellNone

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

changeErrorStatus :: (Int -> Int -> Int) -> IOStateArrow s Int IntSource

clearErrStatus :: IOStateArrow s b bSource

reset global error variable

setErrStatus :: IOStateArrow s Int IntSource

set global error variable

getErrStatus :: IOStateArrow s XmlTree IntSource

read current global error status

setErrMsgStatus :: IOStateArrow s XmlTree XmlTreeSource

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

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

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

sysErrorMsg :: IOStateArrow s XmlTree XmlTreeSource

error message handler for output to stderr

errorMsgStderr :: IOStateArrow s b bSource

the default error message handler: error output to stderr

errorMsgCollect :: IOStateArrow s b bSource

error message handler for collecting errors

errorMsgStderrAndCollect :: IOStateArrow s b bSource

error message handler for output to stderr and collecting

errorMsgIgnore :: IOStateArrow s b bSource

error message handler for ignoring errors

getErrorMessages :: IOStateArrow s b XmlTreeSource

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 XmlTreeSource

filter error messages from input trees and issue errors

issueWarn :: String -> IOStateArrow s b bSource

generate a warnig message

issueErr :: String -> IOStateArrow s b bSource

generate an error message

issueFatal :: String -> IOStateArrow s b bSource

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

issueExc :: String -> IOStateArrow s SomeException bSource

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 XmlTreeSource

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 XmlTreeSource

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 XmlTreeSource

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

errorOutputToStderr :: String -> IO ()Source