Annotation of win32/gnome/gnome-xml/include/libxml/valid.h, revision 1.2

1.1       paf         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.com
                      7:  */
                      8: 
                      9: 
                     10: #ifndef __XML_VALID_H__
                     11: #define __XML_VALID_H__
                     12: 
                     13: #include <libxml/tree.h>
                     14: #include <libxml/list.h>
                     15: #include <libxml/xmlautomata.h>
                     16: #include <libxml/xmlregexp.h>
                     17: 
                     18: #ifdef __cplusplus
                     19: extern "C" {
                     20: #endif
                     21: 
                     22: /*
                     23:  * Validation state added for non-determinist content model.
                     24:  */
                     25: typedef struct _xmlValidState xmlValidState;
                     26: typedef xmlValidState *xmlValidStatePtr;
                     27: 
                     28: /**
                     29:  * xmlValidityErrorFunc:
                     30:  * @ctx:  an xmlValidCtxtPtr validity error context
                     31:  * @msg:  the string to format *printf like vararg
                     32:  * @...:  remaining arguments to the format
                     33:  *
                     34:  * Callback called when a validity error is found. This is a message
                     35:  * oriented function similar to an *printf function.
                     36:  */
                     37: typedef void (*xmlValidityErrorFunc) (void *ctx,
                     38:                             const char *msg,
                     39:                             ...);
                     40: 
                     41: /**
                     42:  * xmlValidityWarningFunc:
                     43:  * @ctx:  an xmlValidCtxtPtr validity error context
                     44:  * @msg:  the string to format *printf like vararg
                     45:  * @...:  remaining arguments to the format
                     46:  *
                     47:  * Callback called when a validity warning is found. This is a message
                     48:  * oriented function similar to an *printf function.
                     49:  */
                     50: typedef void (*xmlValidityWarningFunc) (void *ctx,
                     51:                               const char *msg,
                     52:                               ...);
                     53: 
                     54: /**
                     55:  * xmlValidCtxt:
                     56:  * An xmlValidCtxt is used for error reporting when validating.
                     57:  */
                     58: typedef struct _xmlValidCtxt xmlValidCtxt;
                     59: typedef xmlValidCtxt *xmlValidCtxtPtr;
                     60: struct _xmlValidCtxt {
                     61:     void *userData;                    /* user specific data block */
                     62:     xmlValidityErrorFunc error;                /* the callback in case of errors */
                     63:     xmlValidityWarningFunc warning;    /* the callback in case of warning */
                     64: 
                     65:     /* Node analysis stack used when validating within entities */
                     66:     xmlNodePtr         node;          /* Current parsed Node */
                     67:     int                nodeNr;        /* Depth of the parsing stack */
                     68:     int                nodeMax;       /* Max depth of the parsing stack */
                     69:     xmlNodePtr        *nodeTab;       /* array of nodes */
                     70: 
                     71:     int              finishDtd;       /* finished validating the Dtd ? */
                     72:     xmlDocPtr              doc;       /* the document */
                     73:     int                  valid;       /* temporary validity check result */
                     74: 
                     75:     /* state state used for non-determinist content validation */
                     76:     xmlValidState     *vstate;        /* current state */
                     77:     int                vstateNr;      /* Depth of the validation stack */
                     78:     int                vstateMax;     /* Max depth of the validation stack */
                     79:     xmlValidState     *vstateTab;     /* array of validation states */
                     80: 
                     81: #ifdef LIBXML_REGEXP_ENABLED
                     82:     xmlAutomataPtr            am;     /* the automata */
                     83:     xmlAutomataStatePtr    state;     /* used to build the automata */
                     84: #else
                     85:     void                     *am;
                     86:     void                  *state;
                     87: #endif
                     88: };
                     89: 
                     90: /*
                     91:  * ALL notation declarations are stored in a table.
                     92:  * There is one table per DTD.
                     93:  */
                     94: 
                     95: typedef struct _xmlHashTable xmlNotationTable;
                     96: typedef xmlNotationTable *xmlNotationTablePtr;
                     97: 
                     98: /*
                     99:  * ALL element declarations are stored in a table.
                    100:  * There is one table per DTD.
                    101:  */
                    102: 
                    103: typedef struct _xmlHashTable xmlElementTable;
                    104: typedef xmlElementTable *xmlElementTablePtr;
                    105: 
                    106: /*
                    107:  * ALL attribute declarations are stored in a table.
                    108:  * There is one table per DTD.
                    109:  */
                    110: 
                    111: typedef struct _xmlHashTable xmlAttributeTable;
                    112: typedef xmlAttributeTable *xmlAttributeTablePtr;
                    113: 
                    114: /*
                    115:  * ALL IDs attributes are stored in a table.
                    116:  * There is one table per document.
                    117:  */
                    118: 
                    119: typedef struct _xmlHashTable xmlIDTable;
                    120: typedef xmlIDTable *xmlIDTablePtr;
                    121: 
                    122: /*
                    123:  * ALL Refs attributes are stored in a table.
                    124:  * There is one table per document.
                    125:  */
                    126: 
                    127: typedef struct _xmlHashTable xmlRefTable;
                    128: typedef xmlRefTable *xmlRefTablePtr;
                    129: 
                    130: /* Notation */
                    131: xmlNotationPtr     xmlAddNotationDecl  (xmlValidCtxtPtr ctxt,
                    132:                                         xmlDtdPtr dtd,
                    133:                                         const xmlChar *name,
                    134:                                         const xmlChar *PublicID,
                    135:                                         const xmlChar *SystemID);
                    136: xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
                    137: void               xmlFreeNotationTable(xmlNotationTablePtr table);
                    138: void               xmlDumpNotationDecl (xmlBufferPtr buf,
                    139:                                         xmlNotationPtr nota);
                    140: void               xmlDumpNotationTable(xmlBufferPtr buf,
                    141:                                         xmlNotationTablePtr table);
                    142: 
                    143: /* Element Content */
                    144: xmlElementContentPtr xmlNewElementContent (xmlChar *name,
                    145:                                           xmlElementContentType type);
                    146: xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
                    147: void                xmlFreeElementContent(xmlElementContentPtr cur);
                    148: void                xmlSnprintfElementContent(char *buf,
                    149:                                           int size,
                    150:                                           xmlElementContentPtr content,
                    151:                                           int glob);
                    152: /* DEPRECATED */
                    153: void                xmlSprintfElementContent(char *buf,
                    154:                                           xmlElementContentPtr content,
                    155:                                           int glob);
                    156: /* DEPRECATED */
                    157: 
                    158: /* Element */
                    159: xmlElementPtr     xmlAddElementDecl    (xmlValidCtxtPtr ctxt,
                    160:                                         xmlDtdPtr dtd,
                    161:                                         const xmlChar *name,
                    162:                                         xmlElementTypeVal type,
                    163:                                         xmlElementContentPtr content);
                    164: xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
                    165: void              xmlFreeElementTable  (xmlElementTablePtr table);
                    166: void              xmlDumpElementTable  (xmlBufferPtr buf,
                    167:                                         xmlElementTablePtr table);
                    168: void              xmlDumpElementDecl   (xmlBufferPtr buf,
                    169:                                         xmlElementPtr elem);
                    170: 
                    171: /* Enumeration */
                    172: xmlEnumerationPtr  xmlCreateEnumeration        (xmlChar *name);
                    173: void              xmlFreeEnumeration   (xmlEnumerationPtr cur);
                    174: xmlEnumerationPtr  xmlCopyEnumeration  (xmlEnumerationPtr cur);
                    175: 
                    176: /* Attribute */
                    177: xmlAttributePtr            xmlAddAttributeDecl     (xmlValidCtxtPtr ctxt,
                    178:                                             xmlDtdPtr dtd,
                    179:                                             const xmlChar *elem,
                    180:                                             const xmlChar *name,
                    181:                                             const xmlChar *ns,
                    182:                                             xmlAttributeType type,
                    183:                                             xmlAttributeDefault def,
                    184:                                             const xmlChar *defaultValue,
                    185:                                             xmlEnumerationPtr tree);
                    186: xmlAttributeTablePtr xmlCopyAttributeTable  (xmlAttributeTablePtr table);
                    187: void                xmlFreeAttributeTable  (xmlAttributeTablePtr table);
                    188: void                xmlDumpAttributeTable  (xmlBufferPtr buf,
                    189:                                             xmlAttributeTablePtr table);
                    190: void                xmlDumpAttributeDecl   (xmlBufferPtr buf,
                    191:                                             xmlAttributePtr attr);
                    192: 
                    193: /* IDs */
                    194: xmlIDPtr       xmlAddID        (xmlValidCtxtPtr ctxt,
                    195:                                 xmlDocPtr doc,
                    196:                                 const xmlChar *value,
                    197:                                 xmlAttrPtr attr);
                    198: void           xmlFreeIDTable  (xmlIDTablePtr table);
                    199: xmlAttrPtr     xmlGetID        (xmlDocPtr doc,
                    200:                                 const xmlChar *ID);
                    201: int            xmlIsID         (xmlDocPtr doc,
                    202:                                 xmlNodePtr elem,
                    203:                                 xmlAttrPtr attr);
                    204: int            xmlRemoveID     (xmlDocPtr doc, xmlAttrPtr attr);
                    205: 
                    206: /* IDREFs */
                    207: xmlRefPtr      xmlAddRef       (xmlValidCtxtPtr ctxt,
                    208:                                 xmlDocPtr doc,
                    209:                                 const xmlChar *value,
                    210:                                 xmlAttrPtr attr);
                    211: void           xmlFreeRefTable (xmlRefTablePtr table);
                    212: int            xmlIsRef        (xmlDocPtr doc,
                    213:                                 xmlNodePtr elem,
                    214:                                 xmlAttrPtr attr);
                    215: int            xmlRemoveRef    (xmlDocPtr doc, xmlAttrPtr attr);
                    216: xmlListPtr     xmlGetRefs      (xmlDocPtr doc,
                    217:                                 const xmlChar *ID);
                    218: 
                    219: /**
                    220:  * The public function calls related to validity checking.
                    221:  */
                    222: 
                    223: int            xmlValidateRoot         (xmlValidCtxtPtr ctxt,
                    224:                                         xmlDocPtr doc);
                    225: int            xmlValidateElementDecl  (xmlValidCtxtPtr ctxt,
                    226:                                         xmlDocPtr doc,
                    227:                                         xmlElementPtr elem);
                    228: xmlChar *      xmlValidNormalizeAttributeValue(xmlDocPtr doc,
                    229:                                         xmlNodePtr elem,
                    230:                                         const xmlChar *name,
                    231:                                         const xmlChar *value);
                    232: xmlChar *      xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
                    233:                                         xmlDocPtr doc,
                    234:                                         xmlNodePtr elem,
                    235:                                         const xmlChar *name,
                    236:                                         const xmlChar *value);
                    237: int            xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
                    238:                                         xmlDocPtr doc,
                    239:                                         xmlAttributePtr attr);
                    240: int            xmlValidateAttributeValue(xmlAttributeType type,
                    241:                                         const xmlChar *value);
                    242: int            xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
                    243:                                         xmlDocPtr doc,
                    244:                                         xmlNotationPtr nota);
                    245: int            xmlValidateDtd          (xmlValidCtxtPtr ctxt,
                    246:                                         xmlDocPtr doc,
                    247:                                         xmlDtdPtr dtd);
                    248: int            xmlValidateDtdFinal     (xmlValidCtxtPtr ctxt,
                    249:                                         xmlDocPtr doc);
                    250: int            xmlValidateDocument     (xmlValidCtxtPtr ctxt,
                    251:                                         xmlDocPtr doc);
                    252: int            xmlValidateElement      (xmlValidCtxtPtr ctxt,
                    253:                                         xmlDocPtr doc,
                    254:                                         xmlNodePtr elem);
                    255: int            xmlValidateOneElement   (xmlValidCtxtPtr ctxt,
                    256:                                         xmlDocPtr doc,
                    257:                                         xmlNodePtr elem);
                    258: int            xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
                    259:                                         xmlDocPtr doc,
                    260:                                         xmlNodePtr     elem,
                    261:                                         xmlAttrPtr attr,
                    262:                                         const xmlChar *value);
                    263: int            xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
                    264:                                         xmlDocPtr doc,
                    265:                                         xmlNodePtr elem,
                    266:                                         const xmlChar *prefix,
                    267:                                         xmlNsPtr ns,
                    268:                                         const xmlChar *value);
                    269: int            xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
                    270:                                         xmlDocPtr doc);
                    271: int            xmlValidateNotationUse  (xmlValidCtxtPtr ctxt,
                    272:                                         xmlDocPtr doc,
                    273:                                         const xmlChar *notationName);
                    274: int            xmlIsMixedElement       (xmlDocPtr doc,
                    275:                                         const xmlChar *name);
                    276: xmlAttributePtr        xmlGetDtdAttrDesc       (xmlDtdPtr dtd,
                    277:                                         const xmlChar *elem,
                    278:                                         const xmlChar *name);
                    279: xmlAttributePtr        xmlGetDtdQAttrDesc      (xmlDtdPtr dtd,
                    280:                                         const xmlChar *elem,
                    281:                                         const xmlChar *name,
                    282:                                         const xmlChar *prefix);
                    283: xmlNotationPtr xmlGetDtdNotationDesc   (xmlDtdPtr dtd,
                    284:                                         const xmlChar *name);
                    285: xmlElementPtr  xmlGetDtdQElementDesc   (xmlDtdPtr dtd,
                    286:                                         const xmlChar *name,
                    287:                                         const xmlChar *prefix);
                    288: xmlElementPtr  xmlGetDtdElementDesc    (xmlDtdPtr dtd,
                    289:                                         const xmlChar *name);
                    290: 
                    291: int            xmlValidGetValidElements(xmlNode *prev,
                    292:                                         xmlNode *next,
                    293:                                         const xmlChar **list,
                    294:                                         int max);
                    295: int            xmlValidGetPotentialChildren(xmlElementContent *ctree,
                    296:                                         const xmlChar **list,
                    297:                                         int *len,
                    298:                                         int max);
                    299: int            xmlValidateNameValue    (const xmlChar *value);
                    300: int            xmlValidateNamesValue   (const xmlChar *value);
                    301: int            xmlValidateNmtokenValue (const xmlChar *value);
                    302: int            xmlValidateNmtokensValue(const xmlChar *value);
                    303: 
                    304: #ifdef LIBXML_REGEXP_ENABLED
                    305: /*
                    306:  * Validation based on the regexp support
                    307:  */
                    308: int            xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
                    309:                                         xmlElementPtr elem);
                    310: 
                    311: int            xmlValidatePushElement  (xmlValidCtxtPtr ctxt,
                    312:                                         xmlDocPtr doc,
                    313:                                         xmlNodePtr elem,
                    314:                                         const xmlChar *qname);
                    315: int            xmlValidatePushCData    (xmlValidCtxtPtr ctxt,
                    316:                                         const xmlChar *data,
                    317:                                         int len);
                    318: int            xmlValidatePopElement   (xmlValidCtxtPtr ctxt,
                    319:                                         xmlDocPtr doc,
                    320:                                         xmlNodePtr elem,
                    321:                                         const xmlChar *qname);
                    322: #endif /* LIBXML_REGEXP_ENABLED */
                    323: #ifdef __cplusplus
                    324: }
                    325: #endif
                    326: #endif /* __XML_VALID_H__ */

E-mail: