Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

valid.h

Go to the documentation of this file.
00001 /*
00002  * valid.h : interface to the DTD handling and the validity checking
00003  *
00004  * See Copyright for the status of this software.
00005  *
00006  * daniel@veillard.com
00007  */
00008 
00009 
00010 #ifndef __XML_VALID_H__
00011 #define __XML_VALID_H__
00012 
00013 #include <libxml/xmlversion.h>
00014 #include <libxml/xmlerror.h>
00015 #include <libxml/tree.h>
00016 #include <libxml/list.h>
00017 #include <libxml/xmlautomata.h>
00018 #include <libxml/xmlregexp.h>
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 /*
00025  * Validation state added for non-determinist content model.
00026  */
00027 typedef struct _xmlValidState xmlValidState;
00028 typedef xmlValidState *xmlValidStatePtr;
00029 
00039 typedef void (*xmlValidityErrorFunc) (void *ctx,
00040                              const char *msg,
00041                              ...);
00042 
00052 typedef void (*xmlValidityWarningFunc) (void *ctx,
00053                                const char *msg,
00054                                ...);
00055 
00060 typedef struct _xmlValidCtxt xmlValidCtxt;
00061 typedef xmlValidCtxt *xmlValidCtxtPtr;
00062 struct _xmlValidCtxt {
00063     void *userData;                     /* user specific data block */
00064     xmlValidityErrorFunc error;         /* the callback in case of errors */
00065     xmlValidityWarningFunc warning;     /* the callback in case of warning */
00066 
00067     /* Node analysis stack used when validating within entities */
00068     xmlNodePtr         node;          /* Current parsed Node */
00069     int                nodeNr;        /* Depth of the parsing stack */
00070     int                nodeMax;       /* Max depth of the parsing stack */
00071     xmlNodePtr        *nodeTab;       /* array of nodes */
00072 
00073     int              finishDtd;       /* finished validating the Dtd ? */
00074     xmlDocPtr              doc;       /* the document */
00075     int                  valid;       /* temporary validity check result */
00076 
00077     /* state state used for non-determinist content validation */
00078     xmlValidState     *vstate;        /* current state */
00079     int                vstateNr;      /* Depth of the validation stack */
00080     int                vstateMax;     /* Max depth of the validation stack */
00081     xmlValidState     *vstateTab;     /* array of validation states */
00082 
00083 #ifdef LIBXML_REGEXP_ENABLED
00084     xmlAutomataPtr            am;     /* the automata */
00085     xmlAutomataStatePtr    state;     /* used to build the automata */
00086 #else
00087     void                     *am;
00088     void                  *state;
00089 #endif
00090 };
00091 
00092 /*
00093  * ALL notation declarations are stored in a table.
00094  * There is one table per DTD.
00095  */
00096 
00097 typedef struct _xmlHashTable xmlNotationTable;
00098 typedef xmlNotationTable *xmlNotationTablePtr;
00099 
00100 /*
00101  * ALL element declarations are stored in a table.
00102  * There is one table per DTD.
00103  */
00104 
00105 typedef struct _xmlHashTable xmlElementTable;
00106 typedef xmlElementTable *xmlElementTablePtr;
00107 
00108 /*
00109  * ALL attribute declarations are stored in a table.
00110  * There is one table per DTD.
00111  */
00112 
00113 typedef struct _xmlHashTable xmlAttributeTable;
00114 typedef xmlAttributeTable *xmlAttributeTablePtr;
00115 
00116 /*
00117  * ALL IDs attributes are stored in a table.
00118  * There is one table per document.
00119  */
00120 
00121 typedef struct _xmlHashTable xmlIDTable;
00122 typedef xmlIDTable *xmlIDTablePtr;
00123 
00124 /*
00125  * ALL Refs attributes are stored in a table.
00126  * There is one table per document.
00127  */
00128 
00129 typedef struct _xmlHashTable xmlRefTable;
00130 typedef xmlRefTable *xmlRefTablePtr;
00131 
00132 /* Allocate/Release Validation Contexts */
00133 XMLPUBFUN xmlValidCtxtPtr XMLCALL           
00134                 xmlNewValidCtxt(void);
00135 XMLPUBFUN void XMLCALL              
00136                 xmlFreeValidCtxt(xmlValidCtxtPtr);
00137 
00138 /* Notation */
00139 XMLPUBFUN xmlNotationPtr XMLCALL            
00140                 xmlAddNotationDecl      (xmlValidCtxtPtr ctxt,
00141                                          xmlDtdPtr dtd,
00142                                          const xmlChar *name,
00143                                          const xmlChar *PublicID,
00144                                          const xmlChar *SystemID);
00145 XMLPUBFUN xmlNotationTablePtr XMLCALL 
00146                 xmlCopyNotationTable    (xmlNotationTablePtr table);
00147 XMLPUBFUN void XMLCALL              
00148                 xmlFreeNotationTable    (xmlNotationTablePtr table);
00149 #ifdef LIBXML_OUTPUT_ENABLED
00150 XMLPUBFUN void XMLCALL              
00151                 xmlDumpNotationDecl     (xmlBufferPtr buf,
00152                                          xmlNotationPtr nota);
00153 XMLPUBFUN void XMLCALL              
00154                 xmlDumpNotationTable    (xmlBufferPtr buf,
00155                                          xmlNotationTablePtr table);
00156 #endif /* LIBXML_OUTPUT_ENABLED */
00157 
00158 /* Element Content */
00159 XMLPUBFUN xmlElementContentPtr XMLCALL 
00160                 xmlNewElementContent    (const xmlChar *name,
00161                                          xmlElementContentType type);
00162 XMLPUBFUN xmlElementContentPtr XMLCALL 
00163                 xmlCopyElementContent   (xmlElementContentPtr content);
00164 XMLPUBFUN void XMLCALL               
00165                 xmlFreeElementContent   (xmlElementContentPtr cur);
00166 XMLPUBFUN void XMLCALL               
00167                 xmlSnprintfElementContent(char *buf,
00168                                          int size,
00169                                          xmlElementContentPtr content,
00170                                          int glob);
00171 /* DEPRECATED */
00172 XMLPUBFUN void XMLCALL               
00173                 xmlSprintfElementContent(char *buf,
00174                                          xmlElementContentPtr content,
00175                                          int glob);
00176 /* DEPRECATED */
00177 
00178 /* Element */
00179 XMLPUBFUN xmlElementPtr XMLCALL    
00180                 xmlAddElementDecl       (xmlValidCtxtPtr ctxt,
00181                                          xmlDtdPtr dtd,
00182                                          const xmlChar *name,
00183                                          xmlElementTypeVal type,
00184                                          xmlElementContentPtr content);
00185 XMLPUBFUN xmlElementTablePtr XMLCALL 
00186                 xmlCopyElementTable     (xmlElementTablePtr table);
00187 XMLPUBFUN void XMLCALL             
00188                 xmlFreeElementTable     (xmlElementTablePtr table);
00189 #ifdef LIBXML_OUTPUT_ENABLED
00190 XMLPUBFUN void XMLCALL             
00191                 xmlDumpElementTable     (xmlBufferPtr buf,
00192                                          xmlElementTablePtr table);
00193 XMLPUBFUN void XMLCALL             
00194                 xmlDumpElementDecl      (xmlBufferPtr buf,
00195                                          xmlElementPtr elem);
00196 #endif /* LIBXML_OUTPUT_ENABLED */
00197 
00198 /* Enumeration */
00199 XMLPUBFUN xmlEnumerationPtr XMLCALL 
00200                 xmlCreateEnumeration    (const xmlChar *name);
00201 XMLPUBFUN void XMLCALL             
00202                 xmlFreeEnumeration      (xmlEnumerationPtr cur);
00203 XMLPUBFUN xmlEnumerationPtr XMLCALL  
00204                 xmlCopyEnumeration      (xmlEnumerationPtr cur);
00205 
00206 /* Attribute */
00207 XMLPUBFUN xmlAttributePtr XMLCALL           
00208                 xmlAddAttributeDecl     (xmlValidCtxtPtr ctxt,
00209                                          xmlDtdPtr dtd,
00210                                          const xmlChar *elem,
00211                                          const xmlChar *name,
00212                                          const xmlChar *ns,
00213                                          xmlAttributeType type,
00214                                          xmlAttributeDefault def,
00215                                          const xmlChar *defaultValue,
00216                                          xmlEnumerationPtr tree);
00217 XMLPUBFUN xmlAttributeTablePtr XMLCALL 
00218                 xmlCopyAttributeTable  (xmlAttributeTablePtr table);
00219 XMLPUBFUN void XMLCALL               
00220                 xmlFreeAttributeTable  (xmlAttributeTablePtr table);
00221 #ifdef LIBXML_OUTPUT_ENABLED
00222 XMLPUBFUN void XMLCALL               
00223                 xmlDumpAttributeTable  (xmlBufferPtr buf,
00224                                         xmlAttributeTablePtr table);
00225 XMLPUBFUN void XMLCALL               
00226                 xmlDumpAttributeDecl   (xmlBufferPtr buf,
00227                                         xmlAttributePtr attr);
00228 #endif /* LIBXML_OUTPUT_ENABLED */
00229 
00230 /* IDs */
00231 XMLPUBFUN xmlIDPtr XMLCALL      
00232                 xmlAddID               (xmlValidCtxtPtr ctxt,
00233                                         xmlDocPtr doc,
00234                                         const xmlChar *value,
00235                                         xmlAttrPtr attr);
00236 XMLPUBFUN void XMLCALL          
00237                 xmlFreeIDTable         (xmlIDTablePtr table);
00238 XMLPUBFUN xmlAttrPtr XMLCALL    
00239                 xmlGetID               (xmlDocPtr doc,
00240                                         const xmlChar *ID);
00241 XMLPUBFUN int XMLCALL           
00242                 xmlIsID                (xmlDocPtr doc,
00243                                         xmlNodePtr elem,
00244                                         xmlAttrPtr attr);
00245 XMLPUBFUN int XMLCALL           
00246                 xmlRemoveID            (xmlDocPtr doc, 
00247                                         xmlAttrPtr attr);
00248 
00249 /* IDREFs */
00250 XMLPUBFUN xmlRefPtr XMLCALL     
00251                 xmlAddRef              (xmlValidCtxtPtr ctxt,
00252                                         xmlDocPtr doc,
00253                                         const xmlChar *value,
00254                                         xmlAttrPtr attr);
00255 XMLPUBFUN void XMLCALL          
00256                 xmlFreeRefTable        (xmlRefTablePtr table);
00257 XMLPUBFUN int XMLCALL           
00258                 xmlIsRef               (xmlDocPtr doc,
00259                                         xmlNodePtr elem,
00260                                         xmlAttrPtr attr);
00261 XMLPUBFUN int XMLCALL           
00262                 xmlRemoveRef           (xmlDocPtr doc, 
00263                                         xmlAttrPtr attr);
00264 XMLPUBFUN xmlListPtr XMLCALL    
00265                 xmlGetRefs             (xmlDocPtr doc,
00266                                         const xmlChar *ID);
00267 
00272 XMLPUBFUN int XMLCALL           
00273                 xmlValidateRoot         (xmlValidCtxtPtr ctxt,
00274                                          xmlDocPtr doc);
00275 XMLPUBFUN int XMLCALL           
00276                 xmlValidateElementDecl  (xmlValidCtxtPtr ctxt,
00277                                          xmlDocPtr doc,
00278                                          xmlElementPtr elem);
00279 XMLPUBFUN xmlChar * XMLCALL     
00280                 xmlValidNormalizeAttributeValue(xmlDocPtr doc,
00281                                          xmlNodePtr elem,
00282                                          const xmlChar *name,
00283                                          const xmlChar *value);
00284 XMLPUBFUN xmlChar * XMLCALL     
00285                 xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
00286                                          xmlDocPtr doc,
00287                                          xmlNodePtr elem,
00288                                          const xmlChar *name,
00289                                          const xmlChar *value);
00290 XMLPUBFUN int XMLCALL           
00291                 xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
00292                                          xmlDocPtr doc,
00293                                          xmlAttributePtr attr);
00294 XMLPUBFUN int XMLCALL           
00295                 xmlValidateAttributeValue(xmlAttributeType type,
00296                                          const xmlChar *value);
00297 XMLPUBFUN int XMLCALL           
00298                 xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
00299                                          xmlDocPtr doc,
00300                                          xmlNotationPtr nota);
00301 XMLPUBFUN int XMLCALL           
00302                 xmlValidateDtd          (xmlValidCtxtPtr ctxt,
00303                                          xmlDocPtr doc,
00304                                          xmlDtdPtr dtd);
00305 XMLPUBFUN int XMLCALL           
00306                 xmlValidateDtdFinal     (xmlValidCtxtPtr ctxt,
00307                                          xmlDocPtr doc);
00308 XMLPUBFUN int XMLCALL           
00309                 xmlValidateDocument     (xmlValidCtxtPtr ctxt,
00310                                          xmlDocPtr doc);
00311 XMLPUBFUN int XMLCALL           
00312                 xmlValidateElement      (xmlValidCtxtPtr ctxt,
00313                                          xmlDocPtr doc,
00314                                          xmlNodePtr elem);
00315 XMLPUBFUN int XMLCALL           
00316                 xmlValidateOneElement   (xmlValidCtxtPtr ctxt,
00317                                          xmlDocPtr doc,
00318                                          xmlNodePtr elem);
00319 XMLPUBFUN int XMLCALL   
00320                 xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
00321                                          xmlDocPtr doc,
00322                                          xmlNodePtr     elem,
00323                                          xmlAttrPtr attr,
00324                                          const xmlChar *value);
00325 XMLPUBFUN int XMLCALL           
00326                 xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
00327                                          xmlDocPtr doc,
00328                                          xmlNodePtr elem,
00329                                          const xmlChar *prefix,
00330                                          xmlNsPtr ns,
00331                                          const xmlChar *value);
00332 XMLPUBFUN int XMLCALL           
00333                 xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
00334                                          xmlDocPtr doc);
00335 XMLPUBFUN int XMLCALL           
00336                 xmlValidateNotationUse  (xmlValidCtxtPtr ctxt,
00337                                          xmlDocPtr doc,
00338                                          const xmlChar *notationName);
00339 XMLPUBFUN int XMLCALL           
00340                 xmlIsMixedElement       (xmlDocPtr doc,
00341                                          const xmlChar *name);
00342 XMLPUBFUN xmlAttributePtr XMLCALL       
00343                 xmlGetDtdAttrDesc       (xmlDtdPtr dtd,
00344                                          const xmlChar *elem,
00345                                          const xmlChar *name);
00346 XMLPUBFUN xmlAttributePtr XMLCALL       
00347                 xmlGetDtdQAttrDesc      (xmlDtdPtr dtd,
00348                                          const xmlChar *elem,
00349                                          const xmlChar *name,
00350                                          const xmlChar *prefix);
00351 XMLPUBFUN xmlNotationPtr XMLCALL        
00352                 xmlGetDtdNotationDesc   (xmlDtdPtr dtd,
00353                                          const xmlChar *name);
00354 XMLPUBFUN xmlElementPtr XMLCALL 
00355                 xmlGetDtdQElementDesc   (xmlDtdPtr dtd,
00356                                          const xmlChar *name,
00357                                          const xmlChar *prefix);
00358 XMLPUBFUN xmlElementPtr XMLCALL 
00359                 xmlGetDtdElementDesc    (xmlDtdPtr dtd,
00360                                          const xmlChar *name);
00361 
00362 XMLPUBFUN int XMLCALL           
00363                 xmlValidGetValidElements(xmlNode *prev,
00364                                          xmlNode *next,
00365                                          const xmlChar **list,
00366                                          int max);
00367 XMLPUBFUN int XMLCALL           
00368                 xmlValidGetPotentialChildren(xmlElementContent *ctree,
00369                                          const xmlChar **list,
00370                                          int *len,
00371                                          int max);
00372 XMLPUBFUN int XMLCALL           
00373                 xmlValidateNameValue    (const xmlChar *value);
00374 XMLPUBFUN int XMLCALL           
00375                 xmlValidateNamesValue   (const xmlChar *value);
00376 XMLPUBFUN int XMLCALL           
00377                 xmlValidateNmtokenValue (const xmlChar *value);
00378 XMLPUBFUN int XMLCALL           
00379                 xmlValidateNmtokensValue(const xmlChar *value);
00380 
00381 #ifdef LIBXML_REGEXP_ENABLED
00382 /*
00383  * Validation based on the regexp support
00384  */
00385 XMLPUBFUN int XMLCALL           
00386                 xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
00387                                          xmlElementPtr elem);
00388 
00389 XMLPUBFUN int XMLCALL           
00390                 xmlValidatePushElement  (xmlValidCtxtPtr ctxt,
00391                                          xmlDocPtr doc,
00392                                          xmlNodePtr elem,
00393                                          const xmlChar *qname);
00394 XMLPUBFUN int XMLCALL           
00395                 xmlValidatePushCData    (xmlValidCtxtPtr ctxt,
00396                                          const xmlChar *data,
00397                                          int len);
00398 XMLPUBFUN int XMLCALL           
00399                 xmlValidatePopElement   (xmlValidCtxtPtr ctxt,
00400                                          xmlDocPtr doc,
00401                                          xmlNodePtr elem,
00402                                          const xmlChar *qname);
00403 #endif /* LIBXML_REGEXP_ENABLED */
00404 #ifdef __cplusplus
00405 }
00406 #endif
00407 #endif /* __XML_VALID_H__ */
00408 

Generated on Wed Mar 16 00:10:27 2005 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1