Annotation of XML/valid.h, revision 1.23
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.23 ! daniel 13: #include "tree.h"
! 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:
26: typedef struct xmlValidCtxt {
27: void *userData; /* user specific data block */
28: xmlValidityErrorFunc error; /* the callback in case of errors */
29: xmlValidityWarningFunc warning; /* the callback in case of warning */
30: } xmlValidCtxt, *xmlValidCtxtPtr;
31:
1.2 daniel 32: /*
1.5 daniel 33: * ALl notation declarations are stored in a table
34: * there is one table per DTD
35: */
36:
37: #define XML_MIN_NOTATION_TABLE 32
38:
39: typedef struct xmlNotationTable {
40: int nb_notations; /* number of notations stored */
41: int max_notations; /* maximum number of notations */
1.10 daniel 42: xmlNotationPtr *table; /* the table of attributes */
1.6 daniel 43: } xmlNotationTable;
44: typedef xmlNotationTable *xmlNotationTablePtr;
1.5 daniel 45:
46: /*
1.2 daniel 47: * ALl element declarations are stored in a table
48: * there is one table per DTD
49: */
50:
51: #define XML_MIN_ELEMENT_TABLE 32
52:
53: typedef struct xmlElementTable {
54: int nb_elements; /* number of elements stored */
55: int max_elements; /* maximum number of elements */
1.10 daniel 56: xmlElementPtr *table; /* the table of elements */
1.6 daniel 57: } xmlElementTable;
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.4 daniel 65: #define XML_MIN_ATTRIBUTE_TABLE 32
66:
67: typedef struct xmlAttributeTable {
68: int nb_attributes; /* number of attributes stored */
69: int max_attributes; /* maximum number of attributes */
1.10 daniel 70: xmlAttributePtr *table; /* the table of attributes */
1.6 daniel 71: } xmlAttributeTable;
72: typedef xmlAttributeTable *xmlAttributeTablePtr;
1.4 daniel 73:
1.13 daniel 74: /*
75: * ALl IDs attributes are stored in a table
76: * there is one table per document
77: */
78:
79: #define XML_MIN_ID_TABLE 32
80:
81: typedef struct xmlIDTable {
82: int nb_ids; /* number of ids stored */
83: int max_ids; /* maximum number of ids */
84: xmlIDPtr *table; /* the table of ids */
85: } xmlIDTable;
86: typedef xmlIDTable *xmlIDTablePtr;
87:
1.17 daniel 88: /*
89: * ALl Refs attributes are stored in a table
90: * there is one table per document
91: */
92:
93: #define XML_MIN_REF_TABLE 32
94:
95: typedef struct xmlRefTable {
96: int nb_refs; /* number of refs stored */
97: int max_refs; /* maximum number of refs */
98: xmlRefPtr *table; /* the table of refs */
99: } xmlRefTable;
100: typedef xmlRefTable *xmlRefTablePtr;
101:
1.5 daniel 102: /* Notation */
1.14 daniel 103: xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
104: xmlDtdPtr dtd,
1.19 daniel 105: const xmlChar *name,
106: const xmlChar *PublicID,
107: const xmlChar *SystemID);
1.6 daniel 108: xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
1.14 daniel 109: void xmlFreeNotationTable(xmlNotationTablePtr table);
110: void xmlDumpNotationTable(xmlBufferPtr buf,
111: xmlNotationTablePtr table);
1.5 daniel 112:
113: /* Element Content */
1.19 daniel 114: xmlElementContentPtr xmlNewElementContent (xmlChar *name,
1.16 daniel 115: xmlElementContentType type);
1.6 daniel 116: xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
1.14 daniel 117: void xmlFreeElementContent(xmlElementContentPtr cur);
1.2 daniel 118:
1.5 daniel 119: /* Element */
1.14 daniel 120: xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
121: xmlDtdPtr dtd,
1.19 daniel 122: const xmlChar *name,
1.22 daniel 123: xmlElementTypeVal type,
1.14 daniel 124: xmlElementContentPtr content);
125: xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
126: void xmlFreeElementTable (xmlElementTablePtr table);
127: void xmlDumpElementTable (xmlBufferPtr buf,
128: xmlElementTablePtr table);
1.5 daniel 129:
130: /* Enumeration */
1.19 daniel 131: xmlEnumerationPtr xmlCreateEnumeration (xmlChar *name);
1.14 daniel 132: void xmlFreeEnumeration (xmlEnumerationPtr cur);
133: xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur);
1.5 daniel 134:
135: /* Attribute */
1.14 daniel 136: xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
137: xmlDtdPtr dtd,
1.19 daniel 138: const xmlChar *elem,
139: const xmlChar *name,
1.16 daniel 140: xmlAttributeType type,
141: xmlAttributeDefault def,
1.19 daniel 142: const xmlChar *defaultValue,
1.14 daniel 143: xmlEnumerationPtr tree);
144: xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table);
145: void xmlFreeAttributeTable (xmlAttributeTablePtr table);
146: void xmlDumpAttributeTable (xmlBufferPtr buf,
147: xmlAttributeTablePtr table);
1.13 daniel 148:
149: /* IDs */
1.14 daniel 150: xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
151: xmlDocPtr doc,
1.19 daniel 152: const xmlChar *value,
1.14 daniel 153: xmlAttrPtr attr);
154: xmlIDTablePtr xmlCopyIDTable (xmlIDTablePtr table);
155: void xmlFreeIDTable (xmlIDTablePtr table);
156: xmlAttrPtr xmlGetID (xmlDocPtr doc,
1.19 daniel 157: const xmlChar *ID);
1.14 daniel 158: int xmlIsID (xmlDocPtr doc,
1.17 daniel 159: xmlNodePtr elem,
160: xmlAttrPtr attr);
161:
162: /* IDREFs */
163: xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
164: xmlDocPtr doc,
1.19 daniel 165: const xmlChar *value,
1.17 daniel 166: xmlAttrPtr attr);
167: xmlRefTablePtr xmlCopyRefTable (xmlRefTablePtr table);
168: void xmlFreeRefTable (xmlRefTablePtr table);
169: int xmlIsRef (xmlDocPtr doc,
1.14 daniel 170: xmlNodePtr elem,
171: xmlAttrPtr attr);
1.9 daniel 172:
173: /**
174: * The public function calls related to validity checking
175: */
176:
1.14 daniel 177: int xmlValidateRoot (xmlValidCtxtPtr ctxt,
178: xmlDocPtr doc);
179: int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
180: xmlDocPtr doc,
181: xmlElementPtr elem);
182: int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
183: xmlDocPtr doc,
184: xmlAttributePtr attr);
1.15 daniel 185: int xmlValidateAttributeValue(xmlAttributeType type,
1.19 daniel 186: const xmlChar *value);
1.14 daniel 187: int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
188: xmlDocPtr doc,
189: xmlNotationPtr nota);
190: int xmlValidateDtd (xmlValidCtxtPtr ctxt,
191: xmlDocPtr doc,
192: xmlDtdPtr dtd);
193: int xmlValidateDocument (xmlValidCtxtPtr ctxt,
194: xmlDocPtr doc);
195: int xmlValidateElement (xmlValidCtxtPtr ctxt,
196: xmlDocPtr doc,
197: xmlNodePtr elem);
198: int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
199: xmlDocPtr doc,
200: xmlNodePtr elem);
201: int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
202: xmlDocPtr doc,
203: xmlNodePtr elem,
204: xmlAttrPtr attr,
1.19 daniel 205: const xmlChar *value);
1.18 daniel 206: int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
207: xmlDocPtr doc);
1.15 daniel 208: int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
209: xmlDocPtr doc,
1.19 daniel 210: const xmlChar *notationName);
1.14 daniel 211: int xmlIsMixedElement (xmlDocPtr doc,
1.19 daniel 212: const xmlChar *name);
1.14 daniel 213: xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
1.19 daniel 214: const xmlChar *elem,
215: const xmlChar *name);
1.14 daniel 216: xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
1.19 daniel 217: const xmlChar *name);
1.14 daniel 218: xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
1.19 daniel 219: const xmlChar *name);
1.16 daniel 220:
1.21 daniel 221: int xmlValidGetValidElements(xmlNode *prev,
222: xmlNode *next,
223: const xmlChar **list,
224: int max);
225: int xmlValidGetPotentialChildren(xmlElementContent *ctree,
226: const xmlChar **list,
227: int *len,
228: int max);
1.16 daniel 229: #ifdef __cplusplus
230: }
231: #endif
1.1 daniel 232: #endif /* __XML_VALID_H__ */
Webmaster