VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/include/libxml/valid.h@ 107412

Last change on this file since 107412 was 105420, checked in by vboxsync, 10 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

  • Property svn:eol-style set to native
File size: 13.0 KB
Line 
1/*
2 * Summary: The DTD validation
3 * Description: API for the DTD handling and the validity checking
4 *
5 * Copy: See Copyright for the status of this software.
6 *
7 * Author: Daniel Veillard
8 */
9
10
11#ifndef __XML_VALID_H__
12#define __XML_VALID_H__
13
14/** DOC_DISABLE */
15#include <libxml/xmlversion.h>
16#include <libxml/xmlerror.h>
17#define XML_TREE_INTERNALS
18#include <libxml/tree.h>
19#undef XML_TREE_INTERNALS
20#include <libxml/list.h>
21#include <libxml/xmlautomata.h>
22#include <libxml/xmlregexp.h>
23/** DOC_ENABLE */
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/*
30 * Validation state added for non-determinist content model.
31 */
32typedef struct _xmlValidState xmlValidState;
33typedef xmlValidState *xmlValidStatePtr;
34
35/**
36 * xmlValidityErrorFunc:
37 * @ctx: usually an xmlValidCtxtPtr to a validity error context,
38 * but comes from ctxt->userData (which normally contains such
39 * a pointer); ctxt->userData can be changed by the user.
40 * @msg: the string to format *printf like vararg
41 * @...: remaining arguments to the format
42 *
43 * Callback called when a validity error is found. This is a message
44 * oriented function similar to an *printf function.
45 */
46typedef void (*xmlValidityErrorFunc) (void *ctx,
47 const char *msg,
48 ...) LIBXML_ATTR_FORMAT(2,3);
49
50/**
51 * xmlValidityWarningFunc:
52 * @ctx: usually an xmlValidCtxtPtr to a validity error context,
53 * but comes from ctxt->userData (which normally contains such
54 * a pointer); ctxt->userData can be changed by the user.
55 * @msg: the string to format *printf like vararg
56 * @...: remaining arguments to the format
57 *
58 * Callback called when a validity warning is found. This is a message
59 * oriented function similar to an *printf function.
60 */
61typedef void (*xmlValidityWarningFunc) (void *ctx,
62 const char *msg,
63 ...) LIBXML_ATTR_FORMAT(2,3);
64
65/*
66 * xmlValidCtxt:
67 * An xmlValidCtxt is used for error reporting when validating.
68 */
69typedef struct _xmlValidCtxt xmlValidCtxt;
70typedef xmlValidCtxt *xmlValidCtxtPtr;
71struct _xmlValidCtxt {
72 void *userData; /* user specific data block */
73 xmlValidityErrorFunc error; /* the callback in case of errors */
74 xmlValidityWarningFunc warning; /* the callback in case of warning */
75
76 /* Node analysis stack used when validating within entities */
77 xmlNodePtr node; /* Current parsed Node */
78 int nodeNr; /* Depth of the parsing stack */
79 int nodeMax; /* Max depth of the parsing stack */
80 xmlNodePtr *nodeTab; /* array of nodes */
81
82 unsigned int flags; /* internal flags */
83 xmlDocPtr doc; /* the document */
84 int valid; /* temporary validity check result */
85
86 /* state state used for non-determinist content validation */
87 xmlValidState *vstate; /* current state */
88 int vstateNr; /* Depth of the validation stack */
89 int vstateMax; /* Max depth of the validation stack */
90 xmlValidState *vstateTab; /* array of validation states */
91
92#ifdef LIBXML_REGEXP_ENABLED
93 xmlAutomataPtr am; /* the automata */
94 xmlAutomataStatePtr state; /* used to build the automata */
95#else
96 void *am;
97 void *state;
98#endif
99};
100
101/*
102 * ALL notation declarations are stored in a table.
103 * There is one table per DTD.
104 */
105
106typedef struct _xmlHashTable xmlNotationTable;
107typedef xmlNotationTable *xmlNotationTablePtr;
108
109/*
110 * ALL element declarations are stored in a table.
111 * There is one table per DTD.
112 */
113
114typedef struct _xmlHashTable xmlElementTable;
115typedef xmlElementTable *xmlElementTablePtr;
116
117/*
118 * ALL attribute declarations are stored in a table.
119 * There is one table per DTD.
120 */
121
122typedef struct _xmlHashTable xmlAttributeTable;
123typedef xmlAttributeTable *xmlAttributeTablePtr;
124
125/*
126 * ALL IDs attributes are stored in a table.
127 * There is one table per document.
128 */
129
130typedef struct _xmlHashTable xmlIDTable;
131typedef xmlIDTable *xmlIDTablePtr;
132
133/*
134 * ALL Refs attributes are stored in a table.
135 * There is one table per document.
136 */
137
138typedef struct _xmlHashTable xmlRefTable;
139typedef xmlRefTable *xmlRefTablePtr;
140
141/* Notation */
142XMLPUBFUN xmlNotationPtr
143 xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
144 xmlDtdPtr dtd,
145 const xmlChar *name,
146 const xmlChar *PublicID,
147 const xmlChar *SystemID);
148#ifdef LIBXML_TREE_ENABLED
149XMLPUBFUN xmlNotationTablePtr
150 xmlCopyNotationTable (xmlNotationTablePtr table);
151#endif /* LIBXML_TREE_ENABLED */
152XMLPUBFUN void
153 xmlFreeNotationTable (xmlNotationTablePtr table);
154#ifdef LIBXML_OUTPUT_ENABLED
155XML_DEPRECATED
156XMLPUBFUN void
157 xmlDumpNotationDecl (xmlBufferPtr buf,
158 xmlNotationPtr nota);
159/* XML_DEPRECATED, still used in lxml */
160XMLPUBFUN void
161 xmlDumpNotationTable (xmlBufferPtr buf,
162 xmlNotationTablePtr table);
163#endif /* LIBXML_OUTPUT_ENABLED */
164
165/* Element Content */
166/* the non Doc version are being deprecated */
167XMLPUBFUN xmlElementContentPtr
168 xmlNewElementContent (const xmlChar *name,
169 xmlElementContentType type);
170XMLPUBFUN xmlElementContentPtr
171 xmlCopyElementContent (xmlElementContentPtr content);
172XMLPUBFUN void
173 xmlFreeElementContent (xmlElementContentPtr cur);
174/* the new versions with doc argument */
175XMLPUBFUN xmlElementContentPtr
176 xmlNewDocElementContent (xmlDocPtr doc,
177 const xmlChar *name,
178 xmlElementContentType type);
179XMLPUBFUN xmlElementContentPtr
180 xmlCopyDocElementContent(xmlDocPtr doc,
181 xmlElementContentPtr content);
182XMLPUBFUN void
183 xmlFreeDocElementContent(xmlDocPtr doc,
184 xmlElementContentPtr cur);
185XMLPUBFUN void
186 xmlSnprintfElementContent(char *buf,
187 int size,
188 xmlElementContentPtr content,
189 int englob);
190#ifdef LIBXML_OUTPUT_ENABLED
191XML_DEPRECATED
192XMLPUBFUN void
193 xmlSprintfElementContent(char *buf,
194 xmlElementContentPtr content,
195 int englob);
196#endif /* LIBXML_OUTPUT_ENABLED */
197
198/* Element */
199XMLPUBFUN xmlElementPtr
200 xmlAddElementDecl (xmlValidCtxtPtr ctxt,
201 xmlDtdPtr dtd,
202 const xmlChar *name,
203 xmlElementTypeVal type,
204 xmlElementContentPtr content);
205#ifdef LIBXML_TREE_ENABLED
206XMLPUBFUN xmlElementTablePtr
207 xmlCopyElementTable (xmlElementTablePtr table);
208#endif /* LIBXML_TREE_ENABLED */
209XMLPUBFUN void
210 xmlFreeElementTable (xmlElementTablePtr table);
211#ifdef LIBXML_OUTPUT_ENABLED
212XML_DEPRECATED
213XMLPUBFUN void
214 xmlDumpElementTable (xmlBufferPtr buf,
215 xmlElementTablePtr table);
216XML_DEPRECATED
217XMLPUBFUN void
218 xmlDumpElementDecl (xmlBufferPtr buf,
219 xmlElementPtr elem);
220#endif /* LIBXML_OUTPUT_ENABLED */
221
222/* Enumeration */
223XMLPUBFUN xmlEnumerationPtr
224 xmlCreateEnumeration (const xmlChar *name);
225XMLPUBFUN void
226 xmlFreeEnumeration (xmlEnumerationPtr cur);
227#ifdef LIBXML_TREE_ENABLED
228XMLPUBFUN xmlEnumerationPtr
229 xmlCopyEnumeration (xmlEnumerationPtr cur);
230#endif /* LIBXML_TREE_ENABLED */
231
232/* Attribute */
233XMLPUBFUN xmlAttributePtr
234 xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
235 xmlDtdPtr dtd,
236 const xmlChar *elem,
237 const xmlChar *name,
238 const xmlChar *ns,
239 xmlAttributeType type,
240 xmlAttributeDefault def,
241 const xmlChar *defaultValue,
242 xmlEnumerationPtr tree);
243#ifdef LIBXML_TREE_ENABLED
244XMLPUBFUN xmlAttributeTablePtr
245 xmlCopyAttributeTable (xmlAttributeTablePtr table);
246#endif /* LIBXML_TREE_ENABLED */
247XMLPUBFUN void
248 xmlFreeAttributeTable (xmlAttributeTablePtr table);
249#ifdef LIBXML_OUTPUT_ENABLED
250XML_DEPRECATED
251XMLPUBFUN void
252 xmlDumpAttributeTable (xmlBufferPtr buf,
253 xmlAttributeTablePtr table);
254XML_DEPRECATED
255XMLPUBFUN void
256 xmlDumpAttributeDecl (xmlBufferPtr buf,
257 xmlAttributePtr attr);
258#endif /* LIBXML_OUTPUT_ENABLED */
259
260/* IDs */
261XMLPUBFUN int
262 xmlAddIDSafe (xmlAttrPtr attr,
263 const xmlChar *value);
264XMLPUBFUN xmlIDPtr
265 xmlAddID (xmlValidCtxtPtr ctxt,
266 xmlDocPtr doc,
267 const xmlChar *value,
268 xmlAttrPtr attr);
269XMLPUBFUN void
270 xmlFreeIDTable (xmlIDTablePtr table);
271XMLPUBFUN xmlAttrPtr
272 xmlGetID (xmlDocPtr doc,
273 const xmlChar *ID);
274XMLPUBFUN int
275 xmlIsID (xmlDocPtr doc,
276 xmlNodePtr elem,
277 xmlAttrPtr attr);
278XMLPUBFUN int
279 xmlRemoveID (xmlDocPtr doc,
280 xmlAttrPtr attr);
281
282/* IDREFs */
283XML_DEPRECATED
284XMLPUBFUN xmlRefPtr
285 xmlAddRef (xmlValidCtxtPtr ctxt,
286 xmlDocPtr doc,
287 const xmlChar *value,
288 xmlAttrPtr attr);
289XML_DEPRECATED
290XMLPUBFUN void
291 xmlFreeRefTable (xmlRefTablePtr table);
292XML_DEPRECATED
293XMLPUBFUN int
294 xmlIsRef (xmlDocPtr doc,
295 xmlNodePtr elem,
296 xmlAttrPtr attr);
297XML_DEPRECATED
298XMLPUBFUN int
299 xmlRemoveRef (xmlDocPtr doc,
300 xmlAttrPtr attr);
301XML_DEPRECATED
302XMLPUBFUN xmlListPtr
303 xmlGetRefs (xmlDocPtr doc,
304 const xmlChar *ID);
305
306/**
307 * The public function calls related to validity checking.
308 */
309#ifdef LIBXML_VALID_ENABLED
310/* Allocate/Release Validation Contexts */
311XMLPUBFUN xmlValidCtxtPtr
312 xmlNewValidCtxt(void);
313XMLPUBFUN void
314 xmlFreeValidCtxt(xmlValidCtxtPtr);
315
316XML_DEPRECATED
317XMLPUBFUN int
318 xmlValidateRoot (xmlValidCtxtPtr ctxt,
319 xmlDocPtr doc);
320XML_DEPRECATED
321XMLPUBFUN int
322 xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
323 xmlDocPtr doc,
324 xmlElementPtr elem);
325XML_DEPRECATED
326XMLPUBFUN xmlChar *
327 xmlValidNormalizeAttributeValue(xmlDocPtr doc,
328 xmlNodePtr elem,
329 const xmlChar *name,
330 const xmlChar *value);
331XML_DEPRECATED
332XMLPUBFUN xmlChar *
333 xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
334 xmlDocPtr doc,
335 xmlNodePtr elem,
336 const xmlChar *name,
337 const xmlChar *value);
338XML_DEPRECATED
339XMLPUBFUN int
340 xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
341 xmlDocPtr doc,
342 xmlAttributePtr attr);
343XML_DEPRECATED
344XMLPUBFUN int
345 xmlValidateAttributeValue(xmlAttributeType type,
346 const xmlChar *value);
347XML_DEPRECATED
348XMLPUBFUN int
349 xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
350 xmlDocPtr doc,
351 xmlNotationPtr nota);
352XMLPUBFUN int
353 xmlValidateDtd (xmlValidCtxtPtr ctxt,
354 xmlDocPtr doc,
355 xmlDtdPtr dtd);
356XML_DEPRECATED
357XMLPUBFUN int
358 xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
359 xmlDocPtr doc);
360XMLPUBFUN int
361 xmlValidateDocument (xmlValidCtxtPtr ctxt,
362 xmlDocPtr doc);
363XMLPUBFUN int
364 xmlValidateElement (xmlValidCtxtPtr ctxt,
365 xmlDocPtr doc,
366 xmlNodePtr elem);
367XML_DEPRECATED
368XMLPUBFUN int
369 xmlValidateOneElement (xmlValidCtxtPtr ctxt,
370 xmlDocPtr doc,
371 xmlNodePtr elem);
372XML_DEPRECATED
373XMLPUBFUN int
374 xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
375 xmlDocPtr doc,
376 xmlNodePtr elem,
377 xmlAttrPtr attr,
378 const xmlChar *value);
379XML_DEPRECATED
380XMLPUBFUN int
381 xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
382 xmlDocPtr doc,
383 xmlNodePtr elem,
384 const xmlChar *prefix,
385 xmlNsPtr ns,
386 const xmlChar *value);
387XML_DEPRECATED
388XMLPUBFUN int
389 xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
390 xmlDocPtr doc);
391#endif /* LIBXML_VALID_ENABLED */
392
393#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
394XML_DEPRECATED
395XMLPUBFUN int
396 xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
397 xmlDocPtr doc,
398 const xmlChar *notationName);
399#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
400
401XMLPUBFUN int
402 xmlIsMixedElement (xmlDocPtr doc,
403 const xmlChar *name);
404XMLPUBFUN xmlAttributePtr
405 xmlGetDtdAttrDesc (xmlDtdPtr dtd,
406 const xmlChar *elem,
407 const xmlChar *name);
408XMLPUBFUN xmlAttributePtr
409 xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
410 const xmlChar *elem,
411 const xmlChar *name,
412 const xmlChar *prefix);
413XMLPUBFUN xmlNotationPtr
414 xmlGetDtdNotationDesc (xmlDtdPtr dtd,
415 const xmlChar *name);
416XMLPUBFUN xmlElementPtr
417 xmlGetDtdQElementDesc (xmlDtdPtr dtd,
418 const xmlChar *name,
419 const xmlChar *prefix);
420XMLPUBFUN xmlElementPtr
421 xmlGetDtdElementDesc (xmlDtdPtr dtd,
422 const xmlChar *name);
423
424#ifdef LIBXML_VALID_ENABLED
425
426XMLPUBFUN int
427 xmlValidGetPotentialChildren(xmlElementContent *ctree,
428 const xmlChar **names,
429 int *len,
430 int max);
431
432XMLPUBFUN int
433 xmlValidGetValidElements(xmlNode *prev,
434 xmlNode *next,
435 const xmlChar **names,
436 int max);
437XMLPUBFUN int
438 xmlValidateNameValue (const xmlChar *value);
439XMLPUBFUN int
440 xmlValidateNamesValue (const xmlChar *value);
441XMLPUBFUN int
442 xmlValidateNmtokenValue (const xmlChar *value);
443XMLPUBFUN int
444 xmlValidateNmtokensValue(const xmlChar *value);
445
446#ifdef LIBXML_REGEXP_ENABLED
447/*
448 * Validation based on the regexp support
449 */
450XML_DEPRECATED
451XMLPUBFUN int
452 xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
453 xmlElementPtr elem);
454
455XML_DEPRECATED
456XMLPUBFUN int
457 xmlValidatePushElement (xmlValidCtxtPtr ctxt,
458 xmlDocPtr doc,
459 xmlNodePtr elem,
460 const xmlChar *qname);
461XML_DEPRECATED
462XMLPUBFUN int
463 xmlValidatePushCData (xmlValidCtxtPtr ctxt,
464 const xmlChar *data,
465 int len);
466XML_DEPRECATED
467XMLPUBFUN int
468 xmlValidatePopElement (xmlValidCtxtPtr ctxt,
469 xmlDocPtr doc,
470 xmlNodePtr elem,
471 const xmlChar *qname);
472#endif /* LIBXML_REGEXP_ENABLED */
473#endif /* LIBXML_VALID_ENABLED */
474#ifdef __cplusplus
475}
476#endif
477#endif /* __XML_VALID_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette