1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/libxml2/libxml2_valid.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,421 @@
1.4 +/*
1.5 + * Summary: The DTD validation
1.6 + * Description: API for the DTD handling and the validity checking
1.7 + *
1.8 + * Copy: See Copyright for the status of this software.
1.9 + *
1.10 + * Author: Daniel Veillard
1.11 + * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.12 + */
1.13 +
1.14 +/** @file
1.15 +@publishedAll
1.16 +@released
1.17 +*/
1.18 +
1.19 +#ifndef XML_VALID_H
1.20 +#define XML_VALID_H
1.21 +
1.22 +#include <stdapis/libxml2/libxml2_xmlerror.h>
1.23 +#include <stdapis/libxml2/libxml2_tree.h>
1.24 +#include <stdapis/libxml2/libxml2_list.h>
1.25 +
1.26 +#ifdef LIBXML_AUTOMATA_ENABLED
1.27 +#include "libxml2_xmlautomata.h"
1.28 +#endif
1.29 +
1.30 +#ifdef LIBXML_REGEXP_ENABLED
1.31 +#include "libxml2_xmlregexp.h"
1.32 +#endif
1.33 +
1.34 +#ifdef __cplusplus
1.35 +extern "C" {
1.36 +#endif
1.37 +
1.38 +/*
1.39 + * Validation state added for non-determinist content model.
1.40 + */
1.41 +typedef struct _xmlValidState xmlValidState;
1.42 +typedef xmlValidState *xmlValidStatePtr;
1.43 +
1.44 +/**
1.45 + * xmlValidityErrorFunc:
1.46 + * @param ctx an xmlValidCtxtPtr validity error context
1.47 + * @param msg the string to format *printf like vararg
1.48 + * @param # remaining arguments to the format
1.49 + *
1.50 + * Callback called when a validity error is found. This is a message
1.51 + * oriented function similar to an *printf function.
1.52 + */
1.53 +typedef void (*xmlValidityErrorFunc) (void *ctx,
1.54 + const char *msg,
1.55 + ...);
1.56 +
1.57 +/**
1.58 + * xmlValidityWarningFunc:
1.59 + * @param ctx an xmlValidCtxtPtr validity error context
1.60 + * @param msg the string to format *printf like vararg
1.61 + * @param # remaining arguments to the format
1.62 + *
1.63 + * Callback called when a validity warning is found. This is a message
1.64 + * oriented function similar to an *printf function.
1.65 + */
1.66 +typedef void (*xmlValidityWarningFunc) (void *ctx,
1.67 + const char *msg,
1.68 + ...);
1.69 +
1.70 +/*
1.71 + * xmlValidCtxt:
1.72 + * An xmlValidCtxt is used for error reporting when validating.
1.73 + */
1.74 +typedef struct _xmlValidCtxt xmlValidCtxt;
1.75 +typedef xmlValidCtxt *xmlValidCtxtPtr;
1.76 +struct _xmlValidCtxt {
1.77 + void *userData; /* user specific data block */
1.78 + xmlValidityErrorFunc error; /* the callback in case of errors */
1.79 + xmlValidityWarningFunc warning; /* the callback in case of warning */
1.80 +
1.81 + /* Node analysis stack used when validating within entities */
1.82 + xmlNodePtr node; /* Current parsed Node */
1.83 + int nodeNr; /* Depth of the parsing stack */
1.84 + int nodeMax; /* Max depth of the parsing stack */
1.85 + xmlNodePtr* nodeTab; /* array of nodes */
1.86 +
1.87 + int finishDtd; /* finished validating the Dtd ? */
1.88 + xmlDocPtr doc; /* the document */
1.89 + int valid; /* temporary validity check result */
1.90 +
1.91 + /* state state used for non-determinist content validation */
1.92 + xmlValidState* vstate; /* current state */
1.93 + int vstateNr; /* Depth of the validation stack */
1.94 + int vstateMax; /* Max depth of the validation stack */
1.95 + xmlValidState* vstateTab; /* array of validation states */
1.96 +
1.97 +#ifdef LIBXML_REGEXP_ENABLED
1.98 + xmlAutomataPtr am; /* the automata */
1.99 + xmlAutomataStatePtr state; /* used to build the automata */
1.100 +#else
1.101 + void *am;
1.102 + void *state;
1.103 +#endif
1.104 +};
1.105 +
1.106 +/*
1.107 + * ALL notation declarations are stored in a table.
1.108 + * There is one table per DTD.
1.109 + */
1.110 +
1.111 +typedef struct _xmlHashTable xmlNotationTable;
1.112 +typedef xmlNotationTable *xmlNotationTablePtr;
1.113 +
1.114 +/*
1.115 + * ALL element declarations are stored in a table.
1.116 + * There is one table per DTD.
1.117 + */
1.118 +
1.119 +typedef struct _xmlHashTable xmlElementTable;
1.120 +typedef xmlElementTable *xmlElementTablePtr;
1.121 +
1.122 +/*
1.123 + * ALL attribute declarations are stored in a table.
1.124 + * There is one table per DTD.
1.125 + */
1.126 +
1.127 +typedef struct _xmlHashTable xmlAttributeTable;
1.128 +typedef xmlAttributeTable *xmlAttributeTablePtr;
1.129 +
1.130 +/*
1.131 + * ALL IDs attributes are stored in a table.
1.132 + * There is one table per document.
1.133 + */
1.134 +
1.135 +typedef struct _xmlHashTable xmlIDTable;
1.136 +typedef xmlIDTable *xmlIDTablePtr;
1.137 +
1.138 +/*
1.139 + * ALL Refs attributes are stored in a table.
1.140 + * There is one table per document.
1.141 + */
1.142 +
1.143 +typedef struct _xmlHashTable xmlRefTable;
1.144 +typedef xmlRefTable *xmlRefTablePtr;
1.145 +
1.146 +/* Allocate/Release Validation Contexts */
1.147 +XMLPUBFUN xmlValidCtxtPtr XMLCALL
1.148 + xmlNewValidCtxt(void);
1.149 +XMLPUBFUN void XMLCALL
1.150 + xmlFreeValidCtxt(xmlValidCtxtPtr);
1.151 +
1.152 +/* Notation */
1.153 +XMLPUBFUN xmlNotationPtr XMLCALL
1.154 + xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
1.155 + xmlDtdPtr dtd,
1.156 + const xmlChar *name,
1.157 + const xmlChar *PublicID,
1.158 + const xmlChar *SystemID);
1.159 +XMLPUBFUN xmlNotationTablePtr XMLCALL
1.160 + xmlCopyNotationTable (xmlNotationTablePtr table);
1.161 +XMLPUBFUN void XMLCALL
1.162 + xmlFreeNotationTable (xmlNotationTablePtr table);
1.163 +#ifdef LIBXML_OUTPUT_ENABLED
1.164 +XMLPUBFUN void XMLCALL
1.165 + xmlDumpNotationDecl (xmlBufferPtr buf,
1.166 + xmlNotationPtr nota);
1.167 +XMLPUBFUN void XMLCALL
1.168 + xmlDumpNotationTable (xmlBufferPtr buf,
1.169 + xmlNotationTablePtr table);
1.170 +#endif /* LIBXML_OUTPUT_ENABLED */
1.171 +
1.172 +/* Element Content */
1.173 +XMLPUBFUN xmlElementContentPtr XMLCALL
1.174 + xmlNewElementContent (const xmlChar *name,
1.175 + xmlElementContentType type);
1.176 +XMLPUBFUN xmlElementContentPtr XMLCALL
1.177 + xmlCopyElementContent (xmlElementContentPtr content);
1.178 +XMLPUBFUN void XMLCALL
1.179 + xmlFreeElementContent (xmlElementContentPtr cur);
1.180 +XMLPUBFUN void XMLCALL
1.181 + xmlSnprintfElementContent(char *buf,
1.182 + int size,
1.183 + xmlElementContentPtr content,
1.184 + int glob);
1.185 +/* DEPRECATED */
1.186 +XMLPUBFUN void XMLCALL
1.187 + xmlSprintfElementContent(char *buf,
1.188 + xmlElementContentPtr content,
1.189 + int glob);
1.190 +/* DEPRECATED */
1.191 +
1.192 +/* Element */
1.193 +XMLPUBFUN xmlElementPtr XMLCALL
1.194 + xmlAddElementDecl (xmlValidCtxtPtr ctxt,
1.195 + xmlDtdPtr dtd,
1.196 + const xmlChar *name,
1.197 + xmlElementTypeVal type,
1.198 + xmlElementContentPtr content);
1.199 +XMLPUBFUN xmlElementTablePtr XMLCALL
1.200 + xmlCopyElementTable (xmlElementTablePtr table);
1.201 +XMLPUBFUN void XMLCALL
1.202 + xmlFreeElementTable (xmlElementTablePtr table);
1.203 +#ifdef LIBXML_OUTPUT_ENABLED
1.204 +XMLPUBFUN void XMLCALL
1.205 + xmlDumpElementTable (xmlBufferPtr buf,
1.206 + xmlElementTablePtr table);
1.207 +XMLPUBFUN void XMLCALL
1.208 + xmlDumpElementDecl (xmlBufferPtr buf,
1.209 + xmlElementPtr elem);
1.210 +#endif /* LIBXML_OUTPUT_ENABLED */
1.211 +
1.212 +/* Enumeration */
1.213 +XMLPUBFUN xmlEnumerationPtr XMLCALL
1.214 + xmlCreateEnumeration (const xmlChar *name);
1.215 +XMLPUBFUN void XMLCALL
1.216 + xmlFreeEnumeration (xmlEnumerationPtr cur);
1.217 +XMLPUBFUN xmlEnumerationPtr XMLCALL
1.218 + xmlCopyEnumeration (xmlEnumerationPtr cur);
1.219 +
1.220 +/* Attribute */
1.221 +XMLPUBFUN xmlAttributePtr XMLCALL
1.222 + xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
1.223 + xmlDtdPtr dtd,
1.224 + const xmlChar *elem,
1.225 + const xmlChar *name,
1.226 + const xmlChar *ns,
1.227 + xmlAttributeType type,
1.228 + xmlAttributeDefault def,
1.229 + const xmlChar *defaultValue,
1.230 + xmlEnumerationPtr tree);
1.231 +XMLPUBFUN xmlAttributeTablePtr XMLCALL
1.232 + xmlCopyAttributeTable (xmlAttributeTablePtr table);
1.233 +XMLPUBFUN void XMLCALL
1.234 + xmlFreeAttributeTable (xmlAttributeTablePtr table);
1.235 +#ifdef LIBXML_OUTPUT_ENABLED
1.236 +XMLPUBFUN void XMLCALL
1.237 + xmlDumpAttributeTable (xmlBufferPtr buf,
1.238 + xmlAttributeTablePtr table);
1.239 +XMLPUBFUN void XMLCALL
1.240 + xmlDumpAttributeDecl (xmlBufferPtr buf,
1.241 + xmlAttributePtr attr);
1.242 +#endif /* LIBXML_OUTPUT_ENABLED */
1.243 +
1.244 +XMLPUBFUN xmlIDPtr XMLCALL
1.245 + xmlAddID (xmlValidCtxtPtr ctxt,
1.246 + xmlDocPtr doc,
1.247 + const xmlChar *value,
1.248 + xmlAttrPtr attr);
1.249 +XMLPUBFUN void XMLCALL
1.250 + xmlFreeIDTable (xmlIDTablePtr table);
1.251 +XMLPUBFUN xmlAttrPtr XMLCALL
1.252 + xmlGetID (xmlDocPtr doc,
1.253 + const xmlChar *ID);
1.254 +XMLPUBFUN int XMLCALL
1.255 + xmlIsID (xmlDocPtr doc,
1.256 + xmlNodePtr elem,
1.257 + xmlAttrPtr attr);
1.258 +XMLPUBFUN int XMLCALL
1.259 + xmlRemoveID (xmlDocPtr doc,
1.260 + xmlAttrPtr attr);
1.261 +
1.262 +
1.263 +/* IDREFs */
1.264 +XMLPUBFUN xmlRefPtr XMLCALL
1.265 + xmlAddRef (xmlValidCtxtPtr ctxt,
1.266 + xmlDocPtr doc,
1.267 + const xmlChar *value,
1.268 + xmlAttrPtr attr);
1.269 +XMLPUBFUN void XMLCALL
1.270 + xmlFreeRefTable (xmlRefTablePtr table);
1.271 +XMLPUBFUN int XMLCALL
1.272 + xmlIsRef (xmlDocPtr doc,
1.273 + xmlNodePtr elem,
1.274 + xmlAttrPtr attr);
1.275 +XMLPUBFUN int XMLCALL
1.276 + xmlRemoveRef (xmlDocPtr doc,
1.277 + xmlAttrPtr attr);
1.278 +
1.279 +#ifndef XMLENGINE_EXCLUDE_UNUSED
1.280 +XMLPUBFUN xmlListPtr XMLCALL
1.281 + xmlGetRefs (xmlDocPtr doc, const xmlChar *ID);
1.282 +#endif /* ifndef XMLENGINE_EXCLUDE_UNUSED */
1.283 +
1.284 +/**
1.285 + * The public function calls related to validity checking.
1.286 + */
1.287 +
1.288 +XMLPUBFUN int XMLCALL
1.289 + xmlValidateRoot (xmlValidCtxtPtr ctxt,
1.290 + xmlDocPtr doc);
1.291 +XMLPUBFUN int XMLCALL
1.292 + xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
1.293 + xmlDocPtr doc,
1.294 + xmlElementPtr elem);
1.295 +XMLPUBFUN xmlChar * XMLCALL
1.296 + xmlValidNormalizeAttributeValue(xmlDocPtr doc,
1.297 + xmlNodePtr elem,
1.298 + const xmlChar *name,
1.299 + const xmlChar *value);
1.300 +XMLPUBFUN xmlChar * XMLCALL
1.301 + xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
1.302 + xmlDocPtr doc,
1.303 + xmlNodePtr elem,
1.304 + const xmlChar *name,
1.305 + const xmlChar *value);
1.306 +XMLPUBFUN int XMLCALL
1.307 + xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
1.308 + xmlDocPtr doc,
1.309 + xmlAttributePtr attr);
1.310 +XMLPUBFUN int XMLCALL
1.311 + xmlValidateAttributeValue(xmlAttributeType type,
1.312 + const xmlChar *value);
1.313 +XMLPUBFUN int XMLCALL
1.314 + xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
1.315 + xmlDocPtr doc,
1.316 + xmlNotationPtr nota);
1.317 +XMLPUBFUN int XMLCALL
1.318 + xmlValidateDtd (xmlValidCtxtPtr ctxt,
1.319 + xmlDocPtr doc,
1.320 + xmlDtdPtr dtd);
1.321 +XMLPUBFUN int XMLCALL
1.322 + xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
1.323 + xmlDocPtr doc);
1.324 +XMLPUBFUN int XMLCALL
1.325 + xmlValidateDocument (xmlValidCtxtPtr ctxt,
1.326 + xmlDocPtr doc);
1.327 +XMLPUBFUN int XMLCALL
1.328 + xmlValidateElement (xmlValidCtxtPtr ctxt,
1.329 + xmlDocPtr doc,
1.330 + xmlNodePtr elem);
1.331 +XMLPUBFUN int XMLCALL
1.332 + xmlValidateOneElement (xmlValidCtxtPtr ctxt,
1.333 + xmlDocPtr doc,
1.334 + xmlNodePtr elem);
1.335 +XMLPUBFUN int XMLCALL
1.336 + xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
1.337 + xmlDocPtr doc,
1.338 + xmlNodePtr elem,
1.339 + xmlAttrPtr attr,
1.340 + const xmlChar *value);
1.341 +XMLPUBFUN int XMLCALL
1.342 + xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
1.343 + xmlDocPtr doc,
1.344 + xmlNodePtr elem,
1.345 + const xmlChar *prefix,
1.346 + xmlNsPtr ns,
1.347 + const xmlChar *value);
1.348 +XMLPUBFUN int XMLCALL
1.349 + xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
1.350 + xmlDocPtr doc);
1.351 +XMLPUBFUN int XMLCALL
1.352 + xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
1.353 + xmlDocPtr doc,
1.354 + const xmlChar *notationName);
1.355 +XMLPUBFUN int XMLCALL
1.356 + xmlIsMixedElement (xmlDocPtr doc,
1.357 + const xmlChar *name);
1.358 +XMLPUBFUN xmlAttributePtr XMLCALL
1.359 + xmlGetDtdAttrDesc (xmlDtdPtr dtd,
1.360 + const xmlChar *elem,
1.361 + const xmlChar *name);
1.362 +XMLPUBFUN xmlAttributePtr XMLCALL
1.363 + xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
1.364 + const xmlChar *elem,
1.365 + const xmlChar *name,
1.366 + const xmlChar *prefix);
1.367 +XMLPUBFUN xmlNotationPtr XMLCALL
1.368 + xmlGetDtdNotationDesc (xmlDtdPtr dtd,
1.369 + const xmlChar *name);
1.370 +XMLPUBFUN xmlElementPtr XMLCALL
1.371 + xmlGetDtdQElementDesc (xmlDtdPtr dtd,
1.372 + const xmlChar *name,
1.373 + const xmlChar *prefix);
1.374 +XMLPUBFUN xmlElementPtr XMLCALL
1.375 + xmlGetDtdElementDesc (xmlDtdPtr dtd,
1.376 + const xmlChar *name);
1.377 +
1.378 +XMLPUBFUN int XMLCALL
1.379 + xmlValidGetValidElements(xmlNode *prev,
1.380 + xmlNode *next,
1.381 + const xmlChar **names,
1.382 + int max);
1.383 +XMLPUBFUN int XMLCALL
1.384 + xmlValidGetPotentialChildren(xmlElementContent *ctree,
1.385 + const xmlChar **list,
1.386 + int *len,
1.387 + int max);
1.388 +XMLPUBFUN int XMLCALL
1.389 + xmlValidateNameValue (const xmlChar *value);
1.390 +XMLPUBFUN int XMLCALL
1.391 + xmlValidateNamesValue (const xmlChar *value);
1.392 +XMLPUBFUN int XMLCALL
1.393 + xmlValidateNmtokenValue (const xmlChar *value);
1.394 +XMLPUBFUN int XMLCALL
1.395 + xmlValidateNmtokensValue(const xmlChar *value);
1.396 +
1.397 +#ifdef LIBXML_REGEXP_ENABLED
1.398 +/*
1.399 + * Validation based on the regexp support
1.400 + */
1.401 +XMLPUBFUN int XMLCALL
1.402 + xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
1.403 + xmlElementPtr elem);
1.404 +
1.405 +XMLPUBFUN int XMLCALL
1.406 + xmlValidatePushElement (xmlValidCtxtPtr ctxt,
1.407 + xmlDocPtr doc,
1.408 + xmlNodePtr elem,
1.409 + const xmlChar *qname);
1.410 +XMLPUBFUN int XMLCALL
1.411 + xmlValidatePushCData (xmlValidCtxtPtr ctxt,
1.412 + const xmlChar *data,
1.413 + int len);
1.414 +XMLPUBFUN int XMLCALL
1.415 + xmlValidatePopElement (xmlValidCtxtPtr ctxt,
1.416 + xmlDocPtr doc,
1.417 + xmlNodePtr elem,
1.418 + const xmlChar *qname);
1.419 +#endif /* LIBXML_REGEXP_ENABLED */
1.420 +#ifdef __cplusplus
1.421 +}
1.422 +#endif
1.423 +#endif /* XML_VALID_H */
1.424 +