This file is indexed.

/usr/share/doc/libghc-hxt-relaxng-doc/html/hxt-relaxng.txt is in libghc-hxt-relaxng-doc 9.1.4-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The HXT RelaxNG validator
--   
--   The HXT RelaxNG validator
@package hxt-relaxng
@version 9.1.4


-- | Don't edit this module, it's generated by RelaxSchemaToXmlTree
module Text.XML.HXT.RelaxNG.SchemaGrammar
relaxSchemaTree :: XmlTree
relaxSchemaArrow :: ArrowList a => a b XmlTree


-- | Don't edit this module, it's generated by RelaxSchemaToXmlTree
module Text.XML.HXT.RelaxNG.Schema
relaxSchemaTree :: XmlTree
relaxSchemaArrow :: ArrowList a => a b XmlTree


-- | Helper functions for RelaxNG validation
module Text.XML.HXT.RelaxNG.Utils

-- | Tests whether a URI matches the Relax NG anyURI symbol
isRelaxAnyURI :: String -> Bool

-- | Tests whether two URIs are equal after <a>normalizeURI</a> is
--   performed
compareURI :: String -> String -> Bool

-- | Converts all letters to the corresponding lower-case letter and
--   removes a trailing "/"
normalizeURI :: String -> String

-- | Tests whether a string matches a number [-](0-9)*
isNumber :: String -> Bool
isNmtoken :: String -> Bool
isName :: String -> Bool
formatStringList :: (String -> String) -> String -> [String] -> String

-- | Formats a list of strings into a single string. The first parameter
--   formats the elements, the 2. is inserted between two elements.
--   
--   example:
--   
--   <pre>
--   formatStringList show ", " ["foo", "bar", "baz"] -&gt; "foo", "bar", "baz"
--   </pre>
formatStringListPatt :: [String] -> String
formatStringListId :: [String] -> String
formatStringListQuot :: [String] -> String
formatStringListPairs :: [(String, String)] -> String
formatStringListArr :: [String] -> String

module Text.XML.HXT.RelaxNG.DataTypes
relaxSchemaFile :: String
relaxSchemaGrammarFile :: String
a_numberOfErrors :: String
defineOrigName :: String
a_output_changes :: String
a_relaxSimplificationChanges :: String
type Env = [(String, XmlTree)]

-- | Start of a context attribute value (see also:
--   <a>simplificationStep1</a>)
--   
--   The value is always followed by the original attribute name and value
contextAttributes :: String
contextAttributesDefault :: String

-- | Start of base uri attribute value (see also:
--   <tt>simplificationStep1</tt> in
--   <a>Text.XML.HXT.RelaxNG.Simplification</a>)
contextBaseAttr :: String
type OldName = String
type NewName = String
type NamePair = (OldName, NewName)
type RefList = [NamePair]

-- | Type of all datatype libraries functions that tests whether a XML
--   instance value matches a value-pattern.
--   
--   Returns Just "errorMessage" in case of an error else Nothing.
type DatatypeEqual = DatatypeName -> String -> Context -> String -> Context -> Maybe String

-- | Type of all datatype libraries functions that tests whether a XML
--   instance value matches a data-pattern.
--   
--   Returns Just "errorMessage" in case of an error else Nothing.
type DatatypeAllows = DatatypeName -> ParamList -> String -> Context -> Maybe String

-- | List of all supported datatype libraries
type DatatypeLibraries = [DatatypeLibrary]

-- | Each datatype library is identified by a URI.
type DatatypeLibrary = (Uri, DatatypeCheck)
type DatatypeName = String
type ParamName = String

-- | List of all supported params for a datatype
type AllowedParams = [ParamName]

-- | List of all supported datatypes and there allowed params
type AllowedDatatypes = [(DatatypeName, AllowedParams)]

-- | The Constructor exports the list of supported datatypes for a library.
--   It also exports the specialized datatype library functions to validate
--   a XML instance value with respect to a datatype.
data DatatypeCheck
DTC :: DatatypeAllows -> DatatypeEqual -> AllowedDatatypes -> DatatypeCheck

-- | function to test whether a value matches a data-pattern
dtAllowsFct :: DatatypeCheck -> DatatypeAllows

-- | function to test whether a value matches a value-pattern
dtEqualFct :: DatatypeCheck -> DatatypeEqual

-- | list of all supported params for a datatype
dtAllowedTypes :: DatatypeCheck -> AllowedDatatypes
type Uri = String
type LocalName = String

-- | List of parameters; each parameter is a pair consisting of a local
--   name and a value.
type ParamList = [(LocalName, String)]
type Prefix = String

-- | A Context represents the context of an XML element. It consists of a
--   base URI and a mapping from prefixes to namespace URIs.
type Context = (Uri, [(Prefix, Uri)])

-- | A Datatype identifies a datatype by a datatype library name and a
--   local name.
type Datatype = (Uri, LocalName)
showDatatype :: Datatype -> String

-- | Represents a name class
data NameClass
AnyName :: NameClass
AnyNameExcept :: NameClass -> NameClass
Name :: Uri -> LocalName -> NameClass
NsName :: Uri -> NameClass
NsNameExcept :: Uri -> NameClass -> NameClass
NameClassChoice :: NameClass -> NameClass -> NameClass
NCError :: String -> NameClass

-- | Represents a pattern after simplification
data Pattern
Empty :: Pattern
NotAllowed :: ErrMessage -> Pattern
Text :: Pattern
Choice :: Pattern -> Pattern -> Pattern
Interleave :: Pattern -> Pattern -> Pattern
Group :: Pattern -> Pattern -> Pattern
OneOrMore :: Pattern -> Pattern
List :: Pattern -> Pattern
Data :: Datatype -> ParamList -> Pattern
DataExcept :: Datatype -> ParamList -> Pattern -> Pattern
Value :: Datatype -> String -> Context -> Pattern
Attribute :: NameClass -> Pattern -> Pattern
Element :: NameClass -> Pattern -> Pattern
After :: Pattern -> Pattern -> Pattern
data ErrMessage
ErrMsg :: ErrLevel -> [String] -> ErrMessage
type ErrLevel = Int

-- | smart constructor for NotAllowed
notAllowed :: String -> Pattern
notAllowed1 :: String -> Pattern
notAllowed2 :: String -> Pattern
notAllowedN :: ErrLevel -> String -> Pattern

-- | merge error messages
--   
--   If error levels are different, the more important is taken, if level
--   is 2 (max level) both error messages are taken else the 1. error
--   mesage is taken
mergeNotAllowed :: Pattern -> Pattern -> Pattern

-- | smart constructor for Choice
choice :: Pattern -> Pattern -> Pattern

-- | smart constructor for Group
group :: Pattern -> Pattern -> Pattern

-- | smart constructor for OneOrMore
oneOrMore :: Pattern -> Pattern

-- | smart constructor for Interleave
interleave :: Pattern -> Pattern -> Pattern

-- | smart constructor for After
after :: Pattern -> Pattern -> Pattern

-- | Possible content types of a Relax NG pattern. (see also chapter 7.2 in
--   Relax NG specification)
data ContentType
CTEmpty :: ContentType
CTComplex :: ContentType
CTSimple :: ContentType
CTNone :: ContentType
instance Eq NameClass
instance Show ContentType
instance Eq ContentType
instance Ord ContentType
instance Show ErrMessage
instance Show Pattern
instance Show NameClass


-- | Constants and basic arrows for Relax NG
module Text.XML.HXT.RelaxNG.BasicArrows
hasRngAttName :: ArrowXml a => String -> a XmlTree XmlTree
hasRngElemName :: ArrowXml a => String -> a XmlTree XmlTree
checkRngName :: ArrowXml a => [String] -> a XmlTree XmlTree
noOfChildren :: ArrowXml a => (Int -> Bool) -> a XmlTree XmlTree
isAttributeRef :: ArrowXml a => a XmlTree XmlTree
isAttributeRefTextListGroupInterleaveOneOrMoreEmpty :: ArrowXml a => a XmlTree XmlTree
isAttributeRefTextListInterleave :: ArrowXml a => a XmlTree XmlTree
isAttributeListGroupInterleaveOneOrMore :: ArrowXml a => a XmlTree XmlTree
isExternalRefInclude :: ArrowXml a => a XmlTree XmlTree
isNameNsNameValue :: ArrowXml a => a XmlTree XmlTree
isNameNsName :: ArrowXml a => a XmlTree XmlTree
isNameAnyNameNsName :: ArrowXml a => a XmlTree XmlTree
isDefineOneOrMoreZeroOrMoreOptionalListMixed :: ArrowXml a => a XmlTree XmlTree
isChoiceGroupInterleave :: ArrowXml a => a XmlTree XmlTree
isChoiceGroupInterleaveOneOrMore :: ArrowXml a => a XmlTree XmlTree
isGroupInterleave :: ArrowXml a => a XmlTree XmlTree
isRngAnyName :: ArrowXml a => a XmlTree XmlTree
isRngAttribute :: ArrowXml a => a XmlTree XmlTree
isRngChoice :: ArrowXml a => a XmlTree XmlTree
isRngCombine :: ArrowXml a => a XmlTree XmlTree
isRngData :: ArrowXml a => a XmlTree XmlTree
isRngDefine :: ArrowXml a => a XmlTree XmlTree
isRngDiv :: ArrowXml a => a XmlTree XmlTree
isRngElement :: ArrowXml a => a XmlTree XmlTree
isRngEmpty :: ArrowXml a => a XmlTree XmlTree
isRngExcept :: ArrowXml a => a XmlTree XmlTree
isRngExternalRef :: ArrowXml a => a XmlTree XmlTree
isRngGrammar :: ArrowXml a => a XmlTree XmlTree
isRngGroup :: ArrowXml a => a XmlTree XmlTree
isRngInclude :: ArrowXml a => a XmlTree XmlTree
isRngInterleave :: ArrowXml a => a XmlTree XmlTree
isRngList :: ArrowXml a => a XmlTree XmlTree
isRngMixed :: ArrowXml a => a XmlTree XmlTree
isRngName :: ArrowXml a => a XmlTree XmlTree
isRngNotAllowed :: ArrowXml a => a XmlTree XmlTree
isRngNsName :: ArrowXml a => a XmlTree XmlTree
isRngOneOrMore :: ArrowXml a => a XmlTree XmlTree
isRngOptional :: ArrowXml a => a XmlTree XmlTree
isRngParam :: ArrowXml a => a XmlTree XmlTree
isRngParentRef :: ArrowXml a => a XmlTree XmlTree
isRngRef :: ArrowXml a => a XmlTree XmlTree
isRngRelaxError :: ArrowXml a => a XmlTree XmlTree
isRngStart :: ArrowXml a => a XmlTree XmlTree
isRngText :: ArrowXml a => a XmlTree XmlTree
isRngType :: ArrowXml a => a XmlTree XmlTree
isRngValue :: ArrowXml a => a XmlTree XmlTree
isRngZeroOrMore :: ArrowXml a => a XmlTree XmlTree
mkRngElement :: ArrowXml a => String -> a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngChoice :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngDefine :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngEmpty :: ArrowXml a => a n XmlTree -> a n XmlTree
mkRngGrammar :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngGroup :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngInterleave :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngName :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngNotAllowed :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngOneOrMore :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngRef :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngRelaxError :: ArrowXml a => a n XmlTree
mkRngStart :: ArrowXml a => a n XmlTree -> a n XmlTree -> a n XmlTree
mkRngText :: ArrowXml a => a n XmlTree -> a n XmlTree
setRngName :: ArrowXml a => String -> a XmlTree XmlTree
setRngNameDiv :: ArrowXml a => a XmlTree XmlTree
setRngNameRef :: ArrowXml a => a XmlTree XmlTree
isRngAttrAttribute :: ArrowXml a => a XmlTree XmlTree
isRngAttrCombine :: ArrowXml a => a XmlTree XmlTree
isRngAttrDatatypeLibrary :: ArrowXml a => a XmlTree XmlTree
isRngAttrHref :: ArrowXml a => a XmlTree XmlTree
isRngAttrName :: ArrowXml a => a XmlTree XmlTree
isRngAttrNs :: ArrowXml a => a XmlTree XmlTree
isRngAttrType :: ArrowXml a => a XmlTree XmlTree
isRngAttrRelaxSimplificationChanges :: ArrowXml a => a XmlTree XmlTree
mkRngAttr :: ArrowXml a => String -> a b String -> a b XmlTree
mkRngAttrName :: ArrowXml a => String -> a b XmlTree
mkRngAttrRelaxSimplificationChanges :: ArrowXml a => String -> a b XmlTree
mkRngAttrDefineOrigName :: ArrowXml a => String -> a b XmlTree
mkRngAttrContextBase :: ArrowXml a => a b String -> a b XmlTree
addRngAttrName :: ArrowXml a => String -> a XmlTree XmlTree
addRngAttrDescr :: ArrowXml a => String -> a XmlTree XmlTree
addRngAttrChanges :: ArrowXml a => String -> a XmlTree XmlTree
addRngAttrNs :: ArrowXml a => String -> a XmlTree XmlTree
rmRngAttrNs :: ArrowXml a => a XmlTree XmlTree
hasRngAttrRelaxSimplificationChanges :: ArrowXml a => a XmlTree XmlTree
hasRngAttrAttribute :: ArrowXml a => a XmlTree XmlTree
hasRngAttrCombine :: ArrowXml a => a XmlTree XmlTree
hasRngAttrDatatypeLibrary :: ArrowXml a => a XmlTree XmlTree
hasRngAttrHref :: ArrowXml a => a XmlTree XmlTree
hasRngAttrName :: ArrowXml a => a XmlTree XmlTree
hasRngAttrNs :: ArrowXml a => a XmlTree XmlTree
hasRngAttrType :: ArrowXml a => a XmlTree XmlTree
getRngAttrAttribute :: ArrowXml a => a XmlTree String
getRngAttrCombine :: ArrowXml a => a XmlTree String
getRngAttrDatatypeLibrary :: ArrowXml a => a XmlTree String
getRngAttrDescr :: ArrowXml a => a XmlTree String
getRngAttrHref :: ArrowXml a => a XmlTree String
getRngAttrName :: ArrowXml a => a XmlTree String
getRngAttrNs :: ArrowXml a => a XmlTree String
getRngAttrType :: ArrowXml a => a XmlTree String


-- | basic <a>Pattern</a> functions
module Text.XML.HXT.RelaxNG.PatternFunctions
isRelaxEmpty :: Pattern -> Bool
isRelaxNotAllowed :: Pattern -> Bool
isRelaxText :: Pattern -> Bool
isRelaxChoice :: Pattern -> Bool
isRelaxInterleave :: Pattern -> Bool
isRelaxGroup :: Pattern -> Bool
isRelaxOneOrMore :: Pattern -> Bool
isRelaxList :: Pattern -> Bool
isRelaxData :: Pattern -> Bool
isRelaxDataExcept :: Pattern -> Bool
isRelaxValue :: Pattern -> Bool
isRelaxAttribute :: Pattern -> Bool
isRelaxElement :: Pattern -> Bool
isRelaxAfter :: Pattern -> Bool

-- | Returns a list of children pattern for each pattern, e.g. (Choice p1
--   p2) = [p1, p2]
getChildrenPattern :: Pattern -> [Pattern]

-- | Returns the nameclass of a element- or attribute pattern. Otherwise
--   <a>NCError</a> is returned.
getNameClassFromPattern :: Pattern -> NameClass

-- | Returns a string representation of the pattern name
getPatternName :: Pattern -> String


-- | Creates the <a>Pattern</a> datastructure from a simplified Relax NG
--   schema. The created datastructure is used in the validation algorithm
--   (see also: <a>Text.XML.HXT.RelaxNG.Validation</a>)
module Text.XML.HXT.RelaxNG.CreatePattern

-- | Creates the <a>Pattern</a> datastructure from a simplified Relax NG
--   schema.
createPatternFromXmlTree :: LA XmlTree Pattern

-- | Creates a <a>NameClass</a> from an "anyName"-, "nsName"- or
--   "name"-Pattern,
createNameClass :: LA XmlTree NameClass

-- | Simple access arrows
firstChild :: (ArrowTree a, Tree t) => a (t b) (t b)
lastChild :: (ArrowTree a, Tree t) => a (t b) (t b)


-- | exports helper functions for the integration of new datatype-libraries
module Text.XML.HXT.RelaxNG.DataTypeLibUtils
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

-- | Error Message for the equality test of two datatype values
--   
--   <ul>
--   <li>1.parameter : datatype</li>
--   <li>2.parameter : datatype value</li>
--   <li>3.parameter : datatype value</li>
--   </ul>
--   
--   example:
--   
--   <pre>
--   errorMsgEqual "Int" "21" "42" -&gt; "Datatype Int with value = 21 expected, but value = 42 found"
--   </pre>
errorMsgParam :: LocalName -> String -> String -> String
rng_length :: String
rng_maxLength :: String
rng_minLength :: String
rng_maxExclusive :: String
rng_minExclusive :: String
rng_maxInclusive :: String
rng_minInclusive :: String

-- | Function table type
type FunctionTable = [(String, String -> String -> Bool)]
stringValidFT :: FunctionTable -> DatatypeName -> Integer -> Integer -> ParamList -> CheckString

-- | Function table for string tests, XML document value is first operand,
--   schema value second
fctTableString :: FunctionTable

-- | Function table for list tests, XML document value is first operand,
--   schema value second
fctTableList :: FunctionTable

-- | 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.
--   
--   <ul>
--   <li>1.parameter : datatype</li>
--   <li>2.parameter : lower bound of the datatype range</li>
--   <li>3.parameter : upper bound of the datatype range (-1 = no upper
--   bound)</li>
--   <li>4.parameter : list of parameters</li>
--   <li>5.parameter : datatype value to be checked</li>
--   <li>return : Just "Errormessage" in case of an error, else
--   Nothing</li>
--   </ul>
stringValid :: 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.
--   
--   <ul>
--   <li>1.parameter : datatype</li>
--   <li>2.parameter : lower bound of the datatype range</li>
--   <li>3.parameter : upper bound of the datatype range (-1 = no upper
--   bound)</li>
--   <li>4.parameter : list of parameters</li>
--   <li>5.parameter : datatype value to be checked</li>
--   <li>return : Just "Errormessage" in case of an error, else
--   Nothing</li>
--   </ul>
numberValid :: DatatypeName -> Integer -> Integer -> ParamList -> CheckString

-- | tests whether a string value matches a numeric param
--   
--   valid example:
--   
--   <pre>
--   &lt;data type="CHAR"&gt; &lt;param name="maxLength"&gt;5&lt;/param&gt; &lt;/data&gt;
--   </pre>
--   
--   invalid example:
--   
--   <pre>
--   &lt;data type="CHAR"&gt; &lt;param name="minLength"&gt;foo&lt;/param&gt; &lt;/data&gt;
--   </pre>
numParamValid :: (Integer -> Integer -> Bool) -> String -> String -> Bool
data CheckA a b
type CheckString = CheckA String String
type CheckInteger = CheckA Integer Integer

-- | run a check and deliver Just an error message or Nothing
performCheck :: CheckA a b -> a -> Maybe String

-- | every thing is fine
ok :: CheckA a a

-- | always failure
failure :: (a -> String) -> CheckA a b

-- | perform a simple check with a predicate p, when the predicate holds,
--   assert acts as identity, else an error message is generated
assert :: (a -> Bool) -> (a -> String) -> CheckA a a

-- | perform a simple check with a Maybe function, Nothing indicates error
assertMaybe :: (a -> Maybe b) -> (a -> String) -> CheckA a b

-- | perform a check, but convert the value before checking
checkWith :: (a -> b) -> CheckA b c -> CheckA a a
instance ArrowPlus CheckA
instance ArrowZero CheckA
instance Arrow CheckA
instance Category CheckA


-- | Datatype library for the MySQL datatypes
module Text.XML.HXT.RelaxNG.DataTypeLibMysql

-- | Namespace of the MySQL datatype library
mysqlNS :: String

-- | The main entry point to the MySQL datatype library.
--   
--   The <a>DTC</a> constructor exports the list of supported datatypes and
--   params. It also exports the specialized functions to validate a XML
--   instance value with respect to a datatype.
mysqlDatatypeLib :: DatatypeLibrary


-- | Version : $Id$
--   
--   Datatype library for the W3C XML schema datatypes
module Text.XML.HXT.RelaxNG.XMLSchema.DataTypeLibW3C

-- | The main entry point to the W3C XML schema datatype library.
--   
--   The <a>DTC</a> constructor exports the list of supported datatypes and
--   params. It also exports the specialized functions to validate a XML
--   instance value with respect to a datatype.
w3cDatatypeLib :: DatatypeLibrary


-- | This modul exports the list of supported datatype libraries. It also
--   exports the main functions to validate an XML instance value with
--   respect to a datatype.
module Text.XML.HXT.RelaxNG.DataTypeLibraries

-- | List of all supported datatype libraries which can be used within the
--   Relax NG validator modul.
datatypeLibraries :: DatatypeLibraries

-- | Tests whether a XML instance value matches a value-pattern.
--   
--   The following tests are performed:
--   
--   <ul>
--   <li>1. : does the uri exist in the list of supported datatype
--   libraries</li>
--   <li>2. : does the library support the datatype</li>
--   <li>3. : does the XML instance value match the value-pattern</li>
--   </ul>
--   
--   The hard work is done by the specialized <a>DatatypeEqual</a> function
--   (see also: <a>DatatypeCheck</a>) of the datatype library.
datatypeEqual :: Uri -> DatatypeEqual

-- | Tests whether a XML instance value matches a data-pattern.
--   
--   The following tests are performed:
--   
--   <ul>
--   <li>1. : does the uri exist in the list of supported datatype
--   libraries</li>
--   <li>2. : does the library support the datatype</li>
--   <li>3. : does the XML instance value match the data-pattern</li>
--   <li>4. : does the XML instance value match all params</li>
--   </ul>
--   
--   The hard work is done by the specialized <a>DatatypeAllows</a>
--   function (see also: <a>DatatypeCheck</a>) of the datatype library.
datatypeAllows :: Uri -> DatatypeAllows

module Text.XML.HXT.RelaxNG.PatternToString

-- | Returns a tree representation of the pattern structure. The hard work
--   is done by <a>formatTree</a>.
--   
--   Example:
--   
--   <pre>
--   +---element {}bar
--       |
--       +---group
--           |
--           +---oneOrMore
--           |   |
--           |   +---attribute AnyName
--           |       |
--           |       +---text
--           |
--           +---text
--   </pre>
--   
--   The function can be used to display circular ref-pattern structures.
--   
--   Example:
--   
--   <pre>
--   &lt;define name="baz"&gt;
--     &lt;element name="baz"&gt;
--       ... &lt;ref name="baz"/&gt; ...
--     &lt;/element&gt;
--   &lt;/define&gt;
--   </pre>
patternToStringTree :: LA Pattern String

-- | Returns a formated string representation of the pattern structure.
--   
--   Example:
--   
--   <pre>
--   Element {}foo (Choice (Choice ( Value = abc,
--   datatypelibrary = http://relaxng.org/ns/structure/1.0, type = token,
--   context (base-uri =file://test.rng,
--   parameter: xml = http://www.w3.org/XML/1998/namespaces, foo = www.bar.baz),
--   </pre>
--   
--   The function can be used to display circular ref-pattern structures.
patternToFormatedString :: SLA [NameClass] Pattern String

-- | Returns a tree representation of the pattern structure. (see also:
--   <a>createPatternFromXmlTree</a> and <a>patternToStringTree</a>)
xmlTreeToPatternStringTree :: LA XmlTree String

-- | Returns a formated string representation of the pattern structure.
--   (see also: <a>createPatternFromXmlTree</a> and
--   <a>patternToFormatedString</a>)
xmlTreeToPatternFormatedString :: LA XmlTree String

-- | Returns a string representation of the pattern structure. (see also:
--   <a>createPatternFromXmlTree</a>)
--   
--   Example:
--   
--   <pre>
--   Element {}foo (Choice (Choice (Value ("","token") "abc"
--   ("foo","www.bar.baz")]))(Data ("http://www.mysql.com","VARCHAR")
--   [("length","2"),("maxLength","5")])) (Element {}bar (Group (Element {}baz
--   </pre>
--   
--   The function can <tt>not</tt> be used to display circular ref-pattern
--   structures.
xmlTreeToPatternString :: LA XmlTree String

-- | Returns a string representation of a nameclass.
nameClassToString :: NameClass -> String


-- | Validation of a XML document with respect to a valid Relax NG schema
--   in simple form. Copied and modified from "An algorithm for RELAX NG
--   validation" by James Clark
--   (<a>http://www.thaiopensource.com/relaxng/derivative.html</a>).
module Text.XML.HXT.RelaxNG.Validation
validateWithRelax :: IOSArrow XmlTree XmlTree -> IOSArrow XmlTree XmlTree

-- | Validates a xml document with respect to a Relax NG schema
--   
--   <ul>
--   <li>1.parameter : the arrow for computing the Relax NG schema</li>
--   <li>2.parameter : list of configuration options for reading and
--   validating</li>
--   <li>3.parameter : XML document URI</li>
--   <li>arrow-input : ignored</li>
--   <li>arrow-output : list of errors or <a>none</a></li>
--   </ul>
validateDocWithRelax :: IOSArrow XmlTree XmlTree -> SysConfigList -> String -> IOSArrow XmlTree XmlTree

-- | Validates an XML document with respect to a Relax NG schema and issues
--   error messages.
--   
--   See also: <a>validateRelax'</a>
--   
--   <ul>
--   <li>1.parameter : Relax NG schema</li>
--   <li>arrow-input : XML document</li>
--   <li>arrow-output : the document or in case of errors none</li>
--   </ul>
validateRelax :: XmlTree -> IOSArrow XmlTree XmlTree

-- | Validates an XML document with respect to a Relax NG schema This arrow
--   is pure. It does not need IO or any configuration parameters.
--   
--   <ul>
--   <li>1.parameter : Relax NG schema</li>
--   <li>arrow-input : XML document</li>
--   <li>arrow-output : the unchanged document or an error message</li>
--   </ul>
validateRelax' :: XmlTree -> LA XmlTree XmlTree
readForRelax :: String -> IOSArrow b XmlTree

-- | normalize a document for validation with Relax NG: remove all
--   namespace declaration attributes, remove all processing instructions
--   and merge all sequences of text nodes into a single text node
normalizeForRelaxValidation :: ArrowXml a => a XmlTree XmlTree

-- | tests whether a <a>NameClass</a> contains a particular <a>QName</a>
contains :: NameClass -> QName -> Bool


-- | The modul creates the simplified form of a Relax NG schema. See also
--   chapter 4 of the Relax NG specification.
module Text.XML.HXT.RelaxNG.Simplification

-- | Creates the simple form of a Relax NG schema
--   
--   The schema document has to be parsed with namespace propagation
createSimpleForm :: Bool -> Bool -> Bool -> IOSArrow XmlTree XmlTree

-- | Returns the list of simplification errors or <a>none</a>
getErrors :: IOSArrow XmlTree XmlTree
resetStates :: IOSArrow XmlTree XmlTree


-- | This module exports the core functions from the basic validation und
--   simplification libraries. It also exports some helper functions for
--   easier access to the validation functionality.
module Text.XML.HXT.RelaxNG.Validator

-- | validate a document with a Relax NG schema
--   
--   <ul>
--   <li>1.parameter : the system configuration option list for
--   validation</li>
--   <li>2.parameter : the URI of the Relax NG Schema</li>
--   <li>arrow-input : the document to be validated, namespaces must have
--   been processed</li>
--   <li>arrow-output : the input document, or in case of validation
--   errors, an empty document with status information in the root</li>
--   </ul>
--   
--   configuration options evaluated by validateDocumentWithRelaxSchema:
--   
--   <ul>
--   <li><tt>withRelaxCheckRestr</tt> : check Relax NG schema restrictions
--   when simplifying the schema (default: on)</li>
--   <li><tt>withRelaxValidateExtRef</tt> : validate a Relax NG schema
--   referenced by a externalRef-Pattern (default: on)</li>
--   <li><tt>withRelaxValidateInclude</tt> : validate a Relax NG schema
--   referenced by a include-Pattern (default: on)</li>
--   </ul>
--   
--   example:
--   
--   <pre>
--   validateDocumentWithRelaxSchema [withRelaxCheckRestr yes, withRelaxValidateExtRef no] "testSchema.rng"
--   </pre>
validateDocumentWithRelaxSchema :: SysConfigList -> String -> IOStateArrow s XmlTree XmlTree

-- | validate an XML document with respect to a Relax NG schema
--   
--   <ul>
--   <li>1.parameter : the valid and simplified schema as XML tree</li>
--   <li>arrow-input : the document to be validated</li>
--   <li>arrow-output : the validated and unchanged document or the empty
--   document with status information set in the root node</li>
--   </ul>
validateDocumentWithRelax :: XmlTree -> IOSArrow XmlTree XmlTree
validateSchemaWithRelax :: String -> IOSArrow XmlTree XmlTree

-- | Document validation
--   
--   Validates a xml document with respect to a Relax NG schema
--   
--   <ul>
--   <li>1.parameter : XML document</li>
--   <li>2.parameter : Relax NG schema file</li>
--   </ul>
validateWithSpezification :: String -> String -> IOSArrow XmlTree XmlTree

-- | Relax NG schema validation
--   
--   see <a>validateSchemaWithRelax</a> and
--   <a>validateWithSpezification</a>
--   
--   <ul>
--   <li>1.parameter : Relax NG schema file</li>
--   <li>arrow-input : Relax NG Specification in simple form</li>
--   </ul>
validateSchemaWithSpezification :: String -> IOSArrow XmlTree XmlTree


-- | This helper module exports elements from the basic Relax NG libraries:
--   Validator, CreatePattern, PatternToString and DataTypes. It is the
--   main entry point to the Relax NG schema validator of the Haskell XML
--   Toolbox.
module Text.XML.HXT.RelaxNG.SystemConfig
withRelaxNG :: String -> SysConfig
withRelaxCheckRestr :: Bool -> SysConfig
withRelaxValidateExtRef :: Bool -> SysConfig
withRelaxValidateInclude :: Bool -> SysConfig
withRelaxCollectErrors :: Bool -> SysConfig

-- | available Relax NG validation options
--   
--   defines options <a>a_check_restrictions</a>,
--   <a>a_validate_externalRef</a>, <a>a_validate_include</a>,
--   <a>a_do_not_check_restrictions</a>,
--   <a>a_do_not_validate_externalRef</a>, <a>a_do_not_validate_include</a>
relaxOptions :: [OptDescr SysConfig]
a_relax_schema :: String
a_do_not_collect_errors :: String
a_validate_include :: String
a_do_not_validate_include :: String
a_validate_externalRef :: String
a_do_not_validate_externalRef :: String
a_check_restrictions :: String
a_do_not_check_restrictions :: String


-- | This helper module exports elements from the basic Relax NG libraries:
--   Validator, CreatePattern, PatternToString and DataTypes. It is the
--   main entry point to the Relax NG schema validator of the Haskell XML
--   Toolbox.
module Text.XML.HXT.RelaxNG