Annotation of XML/valid.h, revision 1.13

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__
                     12: #include "tree.h"
                     13: 
1.9       daniel     14: /**
                     15:  * an xmlValidCtxt is used for error reporting when validating
                     16:  */
                     17: 
                     18: typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
                     19: typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
                     20: 
                     21: typedef struct xmlValidCtxt {
                     22:     void *userData;                    /* user specific data block */
                     23:     xmlValidityErrorFunc error;                /* the callback in case of errors */
                     24:     xmlValidityWarningFunc warning;    /* the callback in case of warning */
                     25: } xmlValidCtxt, *xmlValidCtxtPtr;
                     26: 
                     27: extern void xmlParserValidityError(void *ctx, const char *msg, ...);
                     28: extern void xmlParserValidityWarning(void *ctx, const char *msg, ...);
                     29: 
1.2       daniel     30: /*
1.5       daniel     31:  * ALl notation declarations are stored in a table
                     32:  * there is one table per DTD
                     33:  */
                     34: 
                     35: #define XML_MIN_NOTATION_TABLE 32
                     36: 
                     37: typedef struct xmlNotationTable {
                     38:     int nb_notations;          /* number of notations stored */
                     39:     int max_notations;         /* maximum number of notations */
1.10      daniel     40:     xmlNotationPtr *table;     /* the table of attributes */
1.6       daniel     41: } xmlNotationTable;
                     42: typedef xmlNotationTable *xmlNotationTablePtr;
1.5       daniel     43: 
                     44: /*
1.2       daniel     45:  * ALl element declarations are stored in a table
                     46:  * there is one table per DTD
                     47:  */
                     48: 
                     49: #define XML_MIN_ELEMENT_TABLE  32
                     50: 
                     51: typedef struct xmlElementTable {
                     52:     int nb_elements;           /* number of elements stored */
                     53:     int max_elements;          /* maximum number of elements */
1.10      daniel     54:     xmlElementPtr *table;      /* the table of elements */
1.6       daniel     55: } xmlElementTable;
                     56: typedef xmlElementTable *xmlElementTablePtr;
1.2       daniel     57: 
1.5       daniel     58: /*
                     59:  * ALl attribute declarations are stored in a table
                     60:  * there is one table per DTD
                     61:  */
                     62: 
1.4       daniel     63: #define XML_MIN_ATTRIBUTE_TABLE        32
                     64: 
                     65: typedef struct xmlAttributeTable {
                     66:     int nb_attributes;         /* number of attributes stored */
                     67:     int max_attributes;                /* maximum number of attributes */
1.10      daniel     68:     xmlAttributePtr *table;    /* the table of attributes */
1.6       daniel     69: } xmlAttributeTable;
                     70: typedef xmlAttributeTable *xmlAttributeTablePtr;
1.4       daniel     71: 
1.13    ! daniel     72: /*
        !            73:  * ALl IDs attributes are stored in a table
        !            74:  * there is one table per document
        !            75:  */
        !            76: 
        !            77: #define XML_MIN_ID_TABLE       32
        !            78: 
        !            79: typedef struct xmlIDTable {
        !            80:     int nb_ids;                        /* number of ids stored */
        !            81:     int max_ids;               /* maximum number of ids */
        !            82:     xmlIDPtr *table;           /* the table of ids */
        !            83: } xmlIDTable;
        !            84: typedef xmlIDTable *xmlIDTablePtr;
        !            85: 
1.5       daniel     86: /* Notation */
1.11      daniel     87: xmlNotationPtr xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
                     88:           const CHAR *name, const CHAR *PublicID, const CHAR *SystemID);
1.6       daniel     89: xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
                     90: void xmlFreeNotationTable(xmlNotationTablePtr table);
1.8       daniel     91: void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table);
1.5       daniel     92: 
                     93: /* Element Content */
1.6       daniel     94: xmlElementContentPtr xmlNewElementContent(CHAR *name, int type);
                     95: xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
                     96: void xmlFreeElementContent(xmlElementContentPtr cur);
1.2       daniel     97: 
1.5       daniel     98: /* Element */
1.11      daniel     99: xmlElementPtr xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
                    100:          const CHAR *name, int type, xmlElementContentPtr content);
1.6       daniel    101: xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
                    102: void xmlFreeElementTable(xmlElementTablePtr table);
1.8       daniel    103: void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table);
1.5       daniel    104: 
                    105: /* Enumeration */
1.6       daniel    106: xmlEnumerationPtr xmlCreateEnumeration(CHAR *name);
                    107: void xmlFreeEnumeration(xmlEnumerationPtr cur);
                    108: xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
1.5       daniel    109: 
                    110: /* Attribute */
1.11      daniel    111: xmlAttributePtr xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
                    112:                const CHAR *elem, const CHAR *name, int type, int def,
1.7       daniel    113:               const CHAR *defaultValue, xmlEnumerationPtr tree);
1.6       daniel    114: xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
                    115: void xmlFreeAttributeTable(xmlAttributeTablePtr table);
1.8       daniel    116: void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table);
1.13    ! daniel    117: 
        !           118: /* IDs */
        !           119: xmlIDPtr xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
        !           120:                const CHAR *value, xmlAttrPtr attr);
        !           121: xmlIDTablePtr xmlCopyIDTable(xmlIDTablePtr table);
        !           122: void xmlFreeIDTable(xmlIDTablePtr table);
1.9       daniel    123: 
                    124: /**
                    125:  * The public function calls related to validity checking
                    126:  */
                    127: 
                    128: int xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc);
1.11      daniel    129: int xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
                    130:                            xmlElementPtr elem);
                    131: int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
                    132:                              xmlAttributePtr attr);
                    133: int xmlValidateNotationDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
                    134:                             xmlNotationPtr nota);
1.12      daniel    135: int xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd);
                    136: 
1.11      daniel    137: int xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc);
1.12      daniel    138: int xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem);
1.11      daniel    139: int xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
1.12      daniel    140:                           xmlNodePtr elem);
1.11      daniel    141: int xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
1.12      daniel    142:                        xmlNodePtr elem, xmlAttrPtr attr, const CHAR *value);
                    143: 
                    144: int xmlIsMixedElement(xmlDocPtr doc, const CHAR *name);
1.1       daniel    145: #endif /* __XML_VALID_H__ */

Webmaster