Annotation of win32/gnome/gnome-xml/include/libxml/valid.h, revision 1.1
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: /* helper */
! 131: xmlChar * xmlSplitQName2 (const xmlChar *name,
! 132: xmlChar **prefix);
! 133:
! 134: /* Notation */
! 135: xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
! 136: xmlDtdPtr dtd,
! 137: const xmlChar *name,
! 138: const xmlChar *PublicID,
! 139: const xmlChar *SystemID);
! 140: xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
! 141: void xmlFreeNotationTable(xmlNotationTablePtr table);
! 142: void xmlDumpNotationDecl (xmlBufferPtr buf,
! 143: xmlNotationPtr nota);
! 144: void xmlDumpNotationTable(xmlBufferPtr buf,
! 145: xmlNotationTablePtr table);
! 146:
! 147: /* Element Content */
! 148: xmlElementContentPtr xmlNewElementContent (xmlChar *name,
! 149: xmlElementContentType type);
! 150: xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
! 151: void xmlFreeElementContent(xmlElementContentPtr cur);
! 152: void xmlSnprintfElementContent(char *buf,
! 153: int size,
! 154: xmlElementContentPtr content,
! 155: int glob);
! 156: /* DEPRECATED */
! 157: void xmlSprintfElementContent(char *buf,
! 158: xmlElementContentPtr content,
! 159: int glob);
! 160: /* DEPRECATED */
! 161:
! 162: /* Element */
! 163: xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
! 164: xmlDtdPtr dtd,
! 165: const xmlChar *name,
! 166: xmlElementTypeVal type,
! 167: xmlElementContentPtr content);
! 168: xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
! 169: void xmlFreeElementTable (xmlElementTablePtr table);
! 170: void xmlDumpElementTable (xmlBufferPtr buf,
! 171: xmlElementTablePtr table);
! 172: void xmlDumpElementDecl (xmlBufferPtr buf,
! 173: xmlElementPtr elem);
! 174:
! 175: /* Enumeration */
! 176: xmlEnumerationPtr xmlCreateEnumeration (xmlChar *name);
! 177: void xmlFreeEnumeration (xmlEnumerationPtr cur);
! 178: xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur);
! 179:
! 180: /* Attribute */
! 181: xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
! 182: xmlDtdPtr dtd,
! 183: const xmlChar *elem,
! 184: const xmlChar *name,
! 185: const xmlChar *ns,
! 186: xmlAttributeType type,
! 187: xmlAttributeDefault def,
! 188: const xmlChar *defaultValue,
! 189: xmlEnumerationPtr tree);
! 190: xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table);
! 191: void xmlFreeAttributeTable (xmlAttributeTablePtr table);
! 192: void xmlDumpAttributeTable (xmlBufferPtr buf,
! 193: xmlAttributeTablePtr table);
! 194: void xmlDumpAttributeDecl (xmlBufferPtr buf,
! 195: xmlAttributePtr attr);
! 196:
! 197: /* IDs */
! 198: xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
! 199: xmlDocPtr doc,
! 200: const xmlChar *value,
! 201: xmlAttrPtr attr);
! 202: void xmlFreeIDTable (xmlIDTablePtr table);
! 203: xmlAttrPtr xmlGetID (xmlDocPtr doc,
! 204: const xmlChar *ID);
! 205: int xmlIsID (xmlDocPtr doc,
! 206: xmlNodePtr elem,
! 207: xmlAttrPtr attr);
! 208: int xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr);
! 209:
! 210: /* IDREFs */
! 211: xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
! 212: xmlDocPtr doc,
! 213: const xmlChar *value,
! 214: xmlAttrPtr attr);
! 215: void xmlFreeRefTable (xmlRefTablePtr table);
! 216: int xmlIsRef (xmlDocPtr doc,
! 217: xmlNodePtr elem,
! 218: xmlAttrPtr attr);
! 219: int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr);
! 220: xmlListPtr xmlGetRefs (xmlDocPtr doc,
! 221: const xmlChar *ID);
! 222:
! 223: /**
! 224: * The public function calls related to validity checking.
! 225: */
! 226:
! 227: int xmlValidateRoot (xmlValidCtxtPtr ctxt,
! 228: xmlDocPtr doc);
! 229: int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
! 230: xmlDocPtr doc,
! 231: xmlElementPtr elem);
! 232: xmlChar * xmlValidNormalizeAttributeValue(xmlDocPtr doc,
! 233: xmlNodePtr elem,
! 234: const xmlChar *name,
! 235: const xmlChar *value);
! 236: xmlChar * xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
! 237: xmlDocPtr doc,
! 238: xmlNodePtr elem,
! 239: const xmlChar *name,
! 240: const xmlChar *value);
! 241: int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
! 242: xmlDocPtr doc,
! 243: xmlAttributePtr attr);
! 244: int xmlValidateAttributeValue(xmlAttributeType type,
! 245: const xmlChar *value);
! 246: int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
! 247: xmlDocPtr doc,
! 248: xmlNotationPtr nota);
! 249: int xmlValidateDtd (xmlValidCtxtPtr ctxt,
! 250: xmlDocPtr doc,
! 251: xmlDtdPtr dtd);
! 252: int xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
! 253: xmlDocPtr doc);
! 254: int xmlValidateDocument (xmlValidCtxtPtr ctxt,
! 255: xmlDocPtr doc);
! 256: int xmlValidateElement (xmlValidCtxtPtr ctxt,
! 257: xmlDocPtr doc,
! 258: xmlNodePtr elem);
! 259: int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
! 260: xmlDocPtr doc,
! 261: xmlNodePtr elem);
! 262: int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
! 263: xmlDocPtr doc,
! 264: xmlNodePtr elem,
! 265: xmlAttrPtr attr,
! 266: const xmlChar *value);
! 267: int xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
! 268: xmlDocPtr doc,
! 269: xmlNodePtr elem,
! 270: const xmlChar *prefix,
! 271: xmlNsPtr ns,
! 272: const xmlChar *value);
! 273: int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
! 274: xmlDocPtr doc);
! 275: int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
! 276: xmlDocPtr doc,
! 277: const xmlChar *notationName);
! 278: int xmlIsMixedElement (xmlDocPtr doc,
! 279: const xmlChar *name);
! 280: xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
! 281: const xmlChar *elem,
! 282: const xmlChar *name);
! 283: xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
! 284: const xmlChar *elem,
! 285: const xmlChar *name,
! 286: const xmlChar *prefix);
! 287: xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
! 288: const xmlChar *name);
! 289: xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd,
! 290: const xmlChar *name,
! 291: const xmlChar *prefix);
! 292: xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
! 293: const xmlChar *name);
! 294:
! 295: int xmlValidGetValidElements(xmlNode *prev,
! 296: xmlNode *next,
! 297: const xmlChar **list,
! 298: int max);
! 299: int xmlValidGetPotentialChildren(xmlElementContent *ctree,
! 300: const xmlChar **list,
! 301: int *len,
! 302: int max);
! 303: int xmlValidateNameValue (const xmlChar *value);
! 304: int xmlValidateNamesValue (const xmlChar *value);
! 305: int xmlValidateNmtokenValue (const xmlChar *value);
! 306: int xmlValidateNmtokensValue(const xmlChar *value);
! 307:
! 308: #ifdef LIBXML_REGEXP_ENABLED
! 309: /*
! 310: * Validation based on the regexp support
! 311: */
! 312: int xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
! 313: xmlElementPtr elem);
! 314:
! 315: int xmlValidatePushElement (xmlValidCtxtPtr ctxt,
! 316: xmlDocPtr doc,
! 317: xmlNodePtr elem,
! 318: const xmlChar *qname);
! 319: int xmlValidatePushCData (xmlValidCtxtPtr ctxt,
! 320: const xmlChar *data,
! 321: int len);
! 322: int xmlValidatePopElement (xmlValidCtxtPtr ctxt,
! 323: xmlDocPtr doc,
! 324: xmlNodePtr elem,
! 325: const xmlChar *qname);
! 326: #endif /* LIBXML_REGEXP_ENABLED */
! 327: #ifdef __cplusplus
! 328: }
! 329: #endif
! 330: #endif /* __XML_VALID_H__ */
E-mail: