Annotation of XML/valid.h, revision 1.35

1.1       daniel      1: /*
                      2:  * valid.h : interface to the DTD handling and the validity checking
                      3:  *
                      4:  * See Copyright for the status of this software.
                      5:  *
                      6:  * Daniel.Veillard@w3.org
                      7:  */
                      8: 
                      9: 
                     10: #ifndef __XML_VALID_H__
                     11: #define __XML_VALID_H__
1.16      daniel     12: 
1.30      daniel     13: #include <libxml/tree.h>
1.23      daniel     14: 
1.16      daniel     15: #ifdef __cplusplus
                     16: extern "C" {
                     17: #endif
1.1       daniel     18: 
1.9       daniel     19: /**
                     20:  * an xmlValidCtxt is used for error reporting when validating
                     21:  */
                     22: 
                     23: typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
                     24: typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
                     25: 
1.24      daniel     26: typedef struct _xmlValidCtxt xmlValidCtxt;
                     27: typedef xmlValidCtxt *xmlValidCtxtPtr;
                     28: struct _xmlValidCtxt {
1.9       daniel     29:     void *userData;                    /* user specific data block */
                     30:     xmlValidityErrorFunc error;                /* the callback in case of errors */
                     31:     xmlValidityWarningFunc warning;    /* the callback in case of warning */
1.27      daniel     32: 
                     33:     /* Node analysis stack used when validating within entities */
                     34:     xmlNodePtr         node;          /* Current parsed Node */
                     35:     int                nodeNr;        /* Depth of the parsing stack */
                     36:     int                nodeMax;       /* Max depth of the parsing stack */
                     37:     xmlNodePtr        *nodeTab;       /* array of nodes */
1.28      daniel     38: 
                     39:     int              finishDtd;       /* finished validating the Dtd ? */
1.34      veillard   40:     xmlDocPtr              doc;       /* the document */
                     41:     int                  valid;       /* temporary validity check result */
1.24      daniel     42: };
1.9       daniel     43: 
1.2       daniel     44: /*
1.5       daniel     45:  * ALl notation declarations are stored in a table
                     46:  * there is one table per DTD
                     47:  */
                     48: 
1.33      veillard   49: typedef struct _xmlHashTable xmlNotationTable;
1.24      daniel     50: typedef xmlNotationTable *xmlNotationTablePtr;
1.5       daniel     51: 
                     52: /*
1.2       daniel     53:  * ALl element declarations are stored in a table
                     54:  * there is one table per DTD
                     55:  */
                     56: 
1.33      veillard   57: typedef struct _xmlHashTable xmlElementTable;
1.24      daniel     58: typedef xmlElementTable *xmlElementTablePtr;
1.2       daniel     59: 
1.5       daniel     60: /*
                     61:  * ALl attribute declarations are stored in a table
                     62:  * there is one table per DTD
                     63:  */
                     64: 
1.33      veillard   65: typedef struct _xmlHashTable xmlAttributeTable;
1.24      daniel     66: typedef xmlAttributeTable *xmlAttributeTablePtr;
1.4       daniel     67: 
1.13      daniel     68: /*
                     69:  * ALl IDs attributes are stored in a table
                     70:  * there is one table per document
                     71:  */
                     72: 
1.33      veillard   73: typedef struct _xmlHashTable xmlIDTable;
1.24      daniel     74: typedef xmlIDTable *xmlIDTablePtr;
1.13      daniel     75: 
1.17      daniel     76: /*
                     77:  * ALl Refs attributes are stored in a table
                     78:  * there is one table per document
                     79:  */
                     80: 
1.33      veillard   81: typedef struct _xmlHashTable xmlRefTable;
1.24      daniel     82: typedef xmlRefTable *xmlRefTablePtr;
1.17      daniel     83: 
1.35    ! veillard   84: /* helper */
        !            85: xmlChar *           xmlSplitQName2     (const xmlChar *name,
        !            86:                                         xmlChar **prefix);
        !            87: 
1.5       daniel     88: /* Notation */
1.14      daniel     89: xmlNotationPtr     xmlAddNotationDecl  (xmlValidCtxtPtr ctxt,
                     90:                                         xmlDtdPtr dtd,
1.19      daniel     91:                                         const xmlChar *name,
                     92:                                         const xmlChar *PublicID,
                     93:                                         const xmlChar *SystemID);
1.6       daniel     94: xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
1.14      daniel     95: void               xmlFreeNotationTable(xmlNotationTablePtr table);
1.27      daniel     96: void               xmlDumpNotationDecl (xmlBufferPtr buf,
                     97:                                         xmlNotationPtr nota);
1.14      daniel     98: void               xmlDumpNotationTable(xmlBufferPtr buf,
                     99:                                         xmlNotationTablePtr table);
1.5       daniel    100: 
                    101: /* Element Content */
1.19      daniel    102: xmlElementContentPtr xmlNewElementContent (xmlChar *name,
1.16      daniel    103:                                           xmlElementContentType type);
1.6       daniel    104: xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
1.14      daniel    105: void                xmlFreeElementContent(xmlElementContentPtr cur);
1.25      daniel    106: void                xmlSprintfElementContent(char *buf,
                    107:                                           xmlElementContentPtr content,
                    108:                                           int glob);
1.2       daniel    109: 
1.5       daniel    110: /* Element */
1.14      daniel    111: xmlElementPtr     xmlAddElementDecl    (xmlValidCtxtPtr ctxt,
                    112:                                         xmlDtdPtr dtd,
1.19      daniel    113:                                         const xmlChar *name,
1.22      daniel    114:                                         xmlElementTypeVal type,
1.14      daniel    115:                                         xmlElementContentPtr content);
                    116: xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
                    117: void              xmlFreeElementTable  (xmlElementTablePtr table);
                    118: void              xmlDumpElementTable  (xmlBufferPtr buf,
                    119:                                         xmlElementTablePtr table);
1.27      daniel    120: void              xmlDumpElementDecl   (xmlBufferPtr buf,
                    121:                                         xmlElementPtr elem);
1.5       daniel    122: 
                    123: /* Enumeration */
1.19      daniel    124: xmlEnumerationPtr  xmlCreateEnumeration        (xmlChar *name);
1.14      daniel    125: void              xmlFreeEnumeration   (xmlEnumerationPtr cur);
                    126: xmlEnumerationPtr  xmlCopyEnumeration  (xmlEnumerationPtr cur);
1.5       daniel    127: 
                    128: /* Attribute */
1.14      daniel    129: xmlAttributePtr            xmlAddAttributeDecl     (xmlValidCtxtPtr ctxt,
                    130:                                             xmlDtdPtr dtd,
1.19      daniel    131:                                             const xmlChar *elem,
                    132:                                             const xmlChar *name,
1.31      daniel    133:                                             const xmlChar *ns,
1.16      daniel    134:                                             xmlAttributeType type,
                    135:                                             xmlAttributeDefault def,
1.19      daniel    136:                                             const xmlChar *defaultValue,
1.14      daniel    137:                                             xmlEnumerationPtr tree);
                    138: xmlAttributeTablePtr xmlCopyAttributeTable  (xmlAttributeTablePtr table);
                    139: void                xmlFreeAttributeTable  (xmlAttributeTablePtr table);
                    140: void                xmlDumpAttributeTable  (xmlBufferPtr buf,
                    141:                                             xmlAttributeTablePtr table);
1.27      daniel    142: void                xmlDumpAttributeDecl   (xmlBufferPtr buf,
                    143:                                             xmlAttributePtr attr);
1.13      daniel    144: 
                    145: /* IDs */
1.14      daniel    146: xmlIDPtr       xmlAddID        (xmlValidCtxtPtr ctxt,
                    147:                                 xmlDocPtr doc,
1.19      daniel    148:                                 const xmlChar *value,
1.14      daniel    149:                                 xmlAttrPtr attr);
                    150: xmlIDTablePtr  xmlCopyIDTable  (xmlIDTablePtr table);
                    151: void           xmlFreeIDTable  (xmlIDTablePtr table);
                    152: xmlAttrPtr     xmlGetID        (xmlDocPtr doc,
1.19      daniel    153:                                 const xmlChar *ID);
1.14      daniel    154: int            xmlIsID         (xmlDocPtr doc,
1.17      daniel    155:                                 xmlNodePtr elem,
                    156:                                 xmlAttrPtr attr);
1.24      daniel    157: int            xmlRemoveID     (xmlDocPtr doc, xmlAttrPtr attr);
1.17      daniel    158: 
                    159: /* IDREFs */
                    160: xmlRefPtr      xmlAddRef       (xmlValidCtxtPtr ctxt,
                    161:                                 xmlDocPtr doc,
1.19      daniel    162:                                 const xmlChar *value,
1.17      daniel    163:                                 xmlAttrPtr attr);
                    164: xmlRefTablePtr xmlCopyRefTable (xmlRefTablePtr table);
                    165: void           xmlFreeRefTable (xmlRefTablePtr table);
                    166: int            xmlIsRef        (xmlDocPtr doc,
1.14      daniel    167:                                 xmlNodePtr elem,
                    168:                                 xmlAttrPtr attr);
1.24      daniel    169: int            xmlRemoveRef    (xmlDocPtr doc, xmlAttrPtr attr);
1.9       daniel    170: 
                    171: /**
                    172:  * The public function calls related to validity checking
                    173:  */
                    174: 
1.14      daniel    175: int            xmlValidateRoot         (xmlValidCtxtPtr ctxt,
                    176:                                         xmlDocPtr doc);
                    177: int            xmlValidateElementDecl  (xmlValidCtxtPtr ctxt,
                    178:                                         xmlDocPtr doc,
                    179:                                         xmlElementPtr elem);
1.29      daniel    180: xmlChar *      xmlValidNormalizeAttributeValue(xmlDocPtr doc,
                    181:                                         xmlNodePtr elem,
                    182:                                         const xmlChar *name,
                    183:                                         const xmlChar *value);
1.14      daniel    184: int            xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
                    185:                                         xmlDocPtr doc,
                    186:                                         xmlAttributePtr attr);
1.15      daniel    187: int            xmlValidateAttributeValue(xmlAttributeType type,
1.19      daniel    188:                                         const xmlChar *value);
1.14      daniel    189: int            xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
                    190:                                         xmlDocPtr doc,
                    191:                                         xmlNotationPtr nota);
                    192: int            xmlValidateDtd          (xmlValidCtxtPtr ctxt,
                    193:                                         xmlDocPtr doc,
                    194:                                         xmlDtdPtr dtd);
1.28      daniel    195: int            xmlValidateDtdFinal     (xmlValidCtxtPtr ctxt,
                    196:                                         xmlDocPtr doc);
1.14      daniel    197: int            xmlValidateDocument     (xmlValidCtxtPtr ctxt,
                    198:                                         xmlDocPtr doc);
                    199: int            xmlValidateElement      (xmlValidCtxtPtr ctxt,
                    200:                                         xmlDocPtr doc,
                    201:                                         xmlNodePtr elem);
                    202: int            xmlValidateOneElement   (xmlValidCtxtPtr ctxt,
                    203:                                         xmlDocPtr doc,
                    204:                                         xmlNodePtr elem);
                    205: int            xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
                    206:                                         xmlDocPtr doc,
                    207:                                         xmlNodePtr     elem,
                    208:                                         xmlAttrPtr attr,
1.19      daniel    209:                                         const xmlChar *value);
1.18      daniel    210: int            xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
                    211:                                         xmlDocPtr doc);
1.15      daniel    212: int            xmlValidateNotationUse  (xmlValidCtxtPtr ctxt,
                    213:                                         xmlDocPtr doc,
1.19      daniel    214:                                         const xmlChar *notationName);
1.14      daniel    215: int            xmlIsMixedElement       (xmlDocPtr doc,
1.19      daniel    216:                                         const xmlChar *name);
1.14      daniel    217: xmlAttributePtr        xmlGetDtdAttrDesc       (xmlDtdPtr dtd,
1.19      daniel    218:                                         const xmlChar *elem,
                    219:                                         const xmlChar *name);
1.14      daniel    220: xmlNotationPtr xmlGetDtdNotationDesc   (xmlDtdPtr dtd,
1.19      daniel    221:                                         const xmlChar *name);
1.14      daniel    222: xmlElementPtr  xmlGetDtdElementDesc    (xmlDtdPtr dtd,
1.19      daniel    223:                                         const xmlChar *name);
1.16      daniel    224: 
1.21      daniel    225: int            xmlValidGetValidElements(xmlNode *prev,
                    226:                                         xmlNode *next,
                    227:                                         const xmlChar **list,
                    228:                                         int max);
                    229: int            xmlValidGetPotentialChildren(xmlElementContent *ctree,
                    230:                                         const xmlChar **list,
                    231:                                         int *len,
                    232:                                         int max);
1.16      daniel    233: #ifdef __cplusplus
                    234: }
                    235: #endif
1.1       daniel    236: #endif /* __XML_VALID_H__ */

Webmaster