Home | History | Annotate | Download | only in libxmlrpg
      1       * Summary: implementation of the Relax-NG validation
      2       * Description: implementation of the Relax-NG validation
      3       *
      4       * Copy: See Copyright for the status of this software.
      5       *
      6       * Author: Patrick Monnerat <pm (a] datasphere.ch>, DATASPHERE S.A.
      7 
      8       /if not defined(XML_RELAX_NG__)
      9       /define XML_RELAX_NG__
     10 
     11       /include "libxmlrpg/xmlversion"
     12 
     13       /if defined(LIBXML_SCHEMAS_ENABLED)
     14 
     15       /include "libxmlrpg/xmlTypesC"
     16       /include "libxmlrpg/hash"
     17       /include "libxmlrpg/xmlstring"
     18 
     19      d xmlRelaxNGPtr   s               *   based(######typedef######)
     20 
     21       * xmlRelaxNGValidityErrorFunc:
     22       * @ctx: the validation context
     23       * @msg: the message
     24       * @...: extra arguments
     25       *
     26       * Signature of an error callback from a Relax-NG validation
     27 
     28      d xmlRelaxNGValidityErrorFunc...
     29      d                 s               *   based(######typedef######)
     30      d                                     procptr
     31 
     32       * xmlRelaxNGValidityWarningFunc:
     33       * @ctx: the validation context
     34       * @msg: the message
     35       * @...: extra arguments
     36       *
     37       * Signature of a warning callback from a Relax-NG validation
     38 
     39      d xmlRelaxNGValidityWarningFunc...
     40      d                 s               *   based(######typedef######)
     41      d                                     procptr
     42 
     43       * A schemas validation context
     44 
     45      d xmlRelaxNGParserCtxtPtr...
     46      d                 s               *   based(######typedef######)
     47 
     48      d xmlRelaxNGValidCtxtPtr...
     49      d                 s               *   based(######typedef######)
     50 
     51       * xmlRelaxNGValidErr:
     52       *
     53       * List of possible Relax NG validation errors
     54 
     55      d xmlRelaxNGValidErr...
     56      d                 s                   based(######typedef######)
     57      d                                     like(xmlCenum)
     58      d  XML_RELAXNG_OK...
     59      d                 c                   0
     60      d  XML_RELAXNG_ERR_MEMORY...
     61      d                 c                   1
     62      d  XML_RELAXNG_ERR_TYPE...
     63      d                 c                   2
     64      d  XML_RELAXNG_ERR_TYPEVAL...
     65      d                 c                   3
     66      d  XML_RELAXNG_ERR_DUPID...
     67      d                 c                   4
     68      d  XML_RELAXNG_ERR_TYPECMP...
     69      d                 c                   5
     70      d  XML_RELAXNG_ERR_NOSTATE...
     71      d                 c                   6
     72      d  XML_RELAXNG_ERR_NODEFINE...
     73      d                 c                   7
     74      d  XML_RELAXNG_ERR_LISTEXTRA...
     75      d                 c                   8
     76      d  XML_RELAXNG_ERR_LISTEMPTY...
     77      d                 c                   9
     78      d  XML_RELAXNG_ERR_INTERNODATA...
     79      d                 c                   10
     80      d  XML_RELAXNG_ERR_INTERSEQ...
     81      d                 c                   11
     82      d  XML_RELAXNG_ERR_INTEREXTRA...
     83      d                 c                   12
     84      d  XML_RELAXNG_ERR_ELEMNAME...
     85      d                 c                   13
     86      d  XML_RELAXNG_ERR_ATTRNAME...
     87      d                 c                   14
     88      d  XML_RELAXNG_ERR_ELEMNONS...
     89      d                 c                   15
     90      d  XML_RELAXNG_ERR_ATTRNONS...
     91      d                 c                   16
     92      d  XML_RELAXNG_ERR_ELEMWRONGNS...
     93      d                 c                   17
     94      d  XML_RELAXNG_ERR_ATTRWRONGNS...
     95      d                 c                   18
     96      d  XML_RELAXNG_ERR_ELEMEXTRANS...
     97      d                 c                   19
     98      d  XML_RELAXNG_ERR_ATTREXTRANS...
     99      d                 c                   20
    100      d  XML_RELAXNG_ERR_ELEMNOTEMPTY...
    101      d                 c                   21
    102      d  XML_RELAXNG_ERR_NOELEM...
    103      d                 c                   22
    104      d  XML_RELAXNG_ERR_NOTELEM...
    105      d                 c                   23
    106      d  XML_RELAXNG_ERR_ATTRVALID...
    107      d                 c                   24
    108      d  XML_RELAXNG_ERR_CONTENTVALID...
    109      d                 c                   25
    110      d  XML_RELAXNG_ERR_EXTRACONTENT...
    111      d                 c                   26
    112      d  XML_RELAXNG_ERR_INVALIDATTR...
    113      d                 c                   27
    114      d  XML_RELAXNG_ERR_DATAELEM...
    115      d                 c                   28
    116      d  XML_RELAXNG_ERR_VALELEM...
    117      d                 c                   29
    118      d  XML_RELAXNG_ERR_LISTELEM...
    119      d                 c                   30
    120      d  XML_RELAXNG_ERR_DATATYPE...
    121      d                 c                   31
    122      d  XML_RELAXNG_ERR_VALUE...
    123      d                 c                   32
    124      d  XML_RELAXNG_ERR_LIST...
    125      d                 c                   33
    126      d  XML_RELAXNG_ERR_NOGRAMMAR...
    127      d                 c                   34
    128      d  XML_RELAXNG_ERR_EXTRADATA...
    129      d                 c                   35
    130      d  XML_RELAXNG_ERR_LACKDATA...
    131      d                 c                   36
    132      d  XML_RELAXNG_ERR_INTERNAL...
    133      d                 c                   37
    134      d  XML_RELAXNG_ERR_ELEMWRONG...
    135      d                 c                   38
    136      d  XML_RELAXNG_ERR_TEXTWRONG...
    137      d                 c                   39
    138 
    139       * xmlRelaxNGParserFlags:
    140       *
    141       * List of possible Relax NG Parser flags
    142 
    143      d xmlRelaxNGParserFlag...
    144      d                 s                   based(######typedef######)
    145      d                                     like(xmlCenum)
    146      d  XML_RELAXNGP_NONE...
    147      d                 c                   0
    148      d  XML_RELAXNGP_FREE_DOC...
    149      d                 c                   1
    150      d  XML_RELAXNGP_CRNG...
    151      d                 c                   2
    152 
    153      d xmlRelaxNGInitTypes...
    154      d                 pr                  extproc('xmlRelaxNGInitTypes')
    155      d                                     like(xmlCint)
    156 
    157      d xmlRelaxNGCleanupTypes...
    158      d                 pr                  extproc('xmlRelaxNGCleanupTypes')
    159 
    160 
    161       * Interfaces for parsing.
    162 
    163      d xmlRelaxNGNewParserCtxt...
    164      d                 pr                  extproc('xmlRelaxNGNewParserCtxt')
    165      d                                     like(xmlRelaxNGParserCtxtPtr)
    166      d  URL                            *   value options(*string)               const char *
    167 
    168      d xmlRelaxNGNewMemParserCtxt...
    169      d                 pr                  extproc('xmlRelaxNGNewMemParserCtxt')
    170      d                                     like(xmlRelaxNGParserCtxtPtr)
    171      d  buffer                         *   value options(*string)               const char *
    172      d  size                               value like(xmlCint)
    173 
    174      d xmlRelaxNGNewDocParserCtxt...
    175      d                 pr                  extproc('xmlRelaxNGNewDocParserCtxt')
    176      d                                     like(xmlRelaxNGParserCtxtPtr)
    177      d  doc                                value like(xmlDocPtr)
    178 
    179      d xmlRelaxParserSetFlag...
    180      d                 pr                  extproc('xmlRelaxParserSetFlag')
    181      d                                     like(xmlCint)
    182      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    183      d  flag                               value like(xmlCint)
    184 
    185      d xmlRelaxNGFreeParserCtxt...
    186      d                 pr                  extproc('xmlRelaxNGFreeParserCtxt')
    187      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    188 
    189      d xmlRelaxNGSetParserErrors...
    190      d                 pr                  extproc('xmlRelaxNGSetParserErrors')
    191      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    192      d  err                                value
    193      d                                     like(xmlRelaxNGValidityErrorFunc)
    194      d  warn                               value
    195      d                                     like(xmlRelaxNGValidityWarningFunc)
    196      d  ctx                            *   value                                void *
    197 
    198      d xmlRelaxNGGetParserErrors...
    199      d                 pr                  extproc('xmlRelaxNGGetParserErrors')
    200      d                                     like(xmlCint)
    201      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    202      d  err                                like(xmlRelaxNGValidityErrorFunc)
    203      d  warn                               like(xmlRelaxNGValidityWarningFunc)
    204      d  ctx                            *                                        void *(*)
    205 
    206      d xmlRelaxNGSetParserStructuredErrors...
    207      d                 pr                  extproc(
    208      d                                     'xmlRelaxNGSetParserStructuredErrors'
    209      d                                     )
    210      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    211      d  serror                             value like(xmlStructuredErrorFunc)
    212      d  ctx                            *   value                                void *
    213 
    214      d xmlRelaxNGParse...
    215      d                 pr                  extproc('xmlRelaxNGParse')
    216      d                                     like(xmlRelaxNGPtr)
    217      d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
    218 
    219      d xmlRelaxNGFree  pr                  extproc('xmlRelaxNGFree')
    220      d  schema                             value like(xmlRelaxNGPtr)
    221 
    222 
    223       /if defined(LIBXML_OUTPUT_ENABLED)
    224      d xmlRelaxNGDump  pr                  extproc('xmlRelaxNGDump')
    225      d  output                         *   value                                FILE *
    226      d  schema                             value like(xmlRelaxNGPtr)
    227 
    228      d xmlRelaxNGDumpTree...
    229      d                 pr                  extproc('xmlRelaxNGDumpTree')
    230      d  output                         *   value                                FILE *
    231      d  schema                             value like(xmlRelaxNGPtr)
    232       /endif                                                                    LIBXML_OUTPUT_ENABLD
    233 
    234       * Interfaces for validating
    235 
    236      d xmlRelaxNGSetValidErrors...
    237      d                 pr                  extproc('xmlRelaxNGSetValidErrors')
    238      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    239      d  err                                value
    240      d                                     like(xmlRelaxNGValidityErrorFunc)
    241      d  warn                               value
    242      d                                     like(xmlRelaxNGValidityWarningFunc)
    243      d  ctx                            *   value                                void *
    244 
    245      d xmlRelaxNGGetValidErrors...
    246      d                 pr                  extproc('xmlRelaxNGGetValidErrors')
    247      d                                     like(xmlCint)
    248      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    249      d  err                                like(xmlRelaxNGValidityErrorFunc)
    250      d  warn                               like(xmlRelaxNGValidityWarningFunc)
    251      d  ctx                            *   value                                void * *
    252 
    253      d xmlRelaxNGSetValidStructuredErrors...
    254      d                 pr                  extproc(
    255      d                                     'xmlRelaxNGSetValidStructuredErrors')
    256      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    257      d  serror                             value like(xmlStructuredErrorFunc)
    258      d  ctx                            *   value                                void *
    259 
    260      d xmlRelaxNGNewValidCtxt...
    261      d                 pr                  extproc('xmlRelaxNGNewValidCtxt')
    262      d                                     like(xmlRelaxNGValidCtxtPtr)
    263      d  schema                             value like(xmlRelaxNGPtr)
    264 
    265      d xmlRelaxNGFreeValidCtxt...
    266      d                 pr                  extproc('xmlRelaxNGFreeValidCtxt')
    267      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    268 
    269      d xmlRelaxNGValidateDoc...
    270      d                 pr                  extproc('xmlRelaxNGValidateDoc')
    271      d                                     like(xmlCint)
    272      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    273      d  doc                                value like(xmlDocPtr)
    274 
    275       * Interfaces for progressive validation when possible
    276 
    277      d xmlRelaxNGValidatePushElement...
    278      d                 pr                  extproc(
    279      d                                     'xmlRelaxNGValidatePushElement')
    280      d                                     like(xmlCint)
    281      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    282      d  doc                                value like(xmlDocPtr)
    283      d  elem                               value like(xmlNodePtr)
    284 
    285      d xmlRelaxNGValidatePushCData...
    286      d                 pr                  extproc(
    287      d                                     'xmlRelaxNGValidatePushCData')
    288      d                                     like(xmlCint)
    289      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    290      d  data                           *   value options(*string)               const xmlChar *
    291      d  len                                value like(xmlCint)
    292 
    293      d xmlRelaxNGValidatePopElement...
    294      d                 pr                  extproc(
    295      d                                     'xmlRelaxNGValidatePopElement')
    296      d                                     like(xmlCint)
    297      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    298      d  doc                                value like(xmlDocPtr)
    299      d  elem                               value like(xmlNodePtr)
    300 
    301      d xmlRelaxNGValidateFullElement...
    302      d                 pr                  extproc(
    303      d                                     'xmlRelaxNGValidateFullElement')
    304      d                                     like(xmlCint)
    305      d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
    306      d  doc                                value like(xmlDocPtr)
    307      d  elem                               value like(xmlNodePtr)
    308 
    309       /endif                                                                    LIBXML_SCHEMAS_ENBLD
    310       /endif                                                                    XML_RELAX_NG__
    311