| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
exports helper functions for the integration of new datatype-libraries | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Synopsis | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Documentation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgEqual :: DatatypeName -> String -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgDataTypeNotAllowed :: String -> String -> [(String, String)] -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgDataTypeNotAllowed0 :: String -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgDataTypeNotAllowed2 :: String -> String -> String -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgDataLibQName :: String -> String -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
errorMsgParam :: LocalName -> String -> String -> String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Error Message for the equality test of two datatype values
example: errorMsgEqual "Int" "21" "42" -> "Datatype Int with value = 21 expected, but value = 42 found" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_length :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_maxLength :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_minLength :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_maxExclusive :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_minExclusive :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_maxInclusive :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rng_minInclusive :: String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module Text.XML.HXT.DOM.Util | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module Text.XML.HXT.RelaxNG.Utils | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module Text.XML.HXT.RelaxNG.DataTypes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type FunctionTable = [(String, String -> String -> Bool)] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function table type | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stringValidFT :: FunctionTable -> DatatypeName -> Integer -> Integer -> ParamList -> CheckString | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fctTableString :: FunctionTable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function table for string tests, XML document value is first operand, schema value second | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fctTableList :: FunctionTable | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function table for list tests, XML document value is first operand, schema value second | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
stringValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Tests whether a "string" datatype value is between the lower and upper bound of the datatype and matches all parameters. All tests are performed on the string value.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
numberValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Tests whether a "numeric" datatype value is between the lower and upper bound of the datatype and matches all parameters. First, the string value is parsed into a numeric representation. If no error occur, all following tests are performed on the numeric value.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
numParamValid :: (Integer -> Integer -> Bool) -> String -> String -> Bool | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tests whether a string value matches a numeric param valid example: <data type="CHAR"> <param name="maxLength">5</param> </data> invalid example: <data type="CHAR"> <param name="minLength">foo</param> </data> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data CheckA a b | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type CheckString = CheckA String String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type CheckInteger = CheckA Integer Integer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
performCheck :: CheckA a b -> a -> Maybe String | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
run a check and deliver Just an error message or Nothing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ok :: CheckA a a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
every thing is fine | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
failure :: (a -> String) -> CheckA a b | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
always failure | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
assert :: (a -> Bool) -> (a -> String) -> CheckA a a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
perform a simple check with a predicate p, when the predicate holds, assert acts as identity, else an error message is generated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
assertMaybe :: (a -> Maybe b) -> (a -> String) -> CheckA a b | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
perform a simple check with a Maybe function, Nothing indicates error | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
checkWith :: (a -> b) -> CheckA b c -> CheckA a a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
perform a check, but convert the value before checking | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Produced by Haddock version 0.8 |