Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
xmlschemas.h247 linesDownload Raw Back to libxml
1/*2 * Summary: incomplete XML Schemas structure implementation3 * Description: interface to the XML Schemas handling and schema validity4 *              checking, it is incomplete right now.5 *6 * Copy: See Copyright for the status of this software.7 *8 * Author: Daniel Veillard9 */10 11 12#ifndef __XML_SCHEMA_H__13#define __XML_SCHEMA_H__14 15#include <libxml/xmlversion.h>16 17#ifdef LIBXML_SCHEMAS_ENABLED18 19#include <libxml/tree.h>20 21#ifdef __cplusplus22extern "C" {23#endif24 25/**26 * This error codes are obsolete; not used any more.27 */28typedef enum {29    XML_SCHEMAS_ERR_OK		= 0,30    XML_SCHEMAS_ERR_NOROOT	= 1,31    XML_SCHEMAS_ERR_UNDECLAREDELEM,32    XML_SCHEMAS_ERR_NOTTOPLEVEL,33    XML_SCHEMAS_ERR_MISSING,34    XML_SCHEMAS_ERR_WRONGELEM,35    XML_SCHEMAS_ERR_NOTYPE,36    XML_SCHEMAS_ERR_NOROLLBACK,37    XML_SCHEMAS_ERR_ISABSTRACT,38    XML_SCHEMAS_ERR_NOTEMPTY,39    XML_SCHEMAS_ERR_ELEMCONT,40    XML_SCHEMAS_ERR_HAVEDEFAULT,41    XML_SCHEMAS_ERR_NOTNILLABLE,42    XML_SCHEMAS_ERR_EXTRACONTENT,43    XML_SCHEMAS_ERR_INVALIDATTR,44    XML_SCHEMAS_ERR_INVALIDELEM,45    XML_SCHEMAS_ERR_NOTDETERMINIST,46    XML_SCHEMAS_ERR_CONSTRUCT,47    XML_SCHEMAS_ERR_INTERNAL,48    XML_SCHEMAS_ERR_NOTSIMPLE,49    XML_SCHEMAS_ERR_ATTRUNKNOWN,50    XML_SCHEMAS_ERR_ATTRINVALID,51    XML_SCHEMAS_ERR_VALUE,52    XML_SCHEMAS_ERR_FACET,53    XML_SCHEMAS_ERR_,54    XML_SCHEMAS_ERR_XXX55} xmlSchemaValidError;56 57/*58* ATTENTION: Change xmlSchemaSetValidOptions's check59* for invalid values, if adding to the validation60* options below.61*/62/**63 * xmlSchemaValidOption:64 *65 * This is the set of XML Schema validation options.66 */67typedef enum {68    XML_SCHEMA_VAL_VC_I_CREATE			= 1<<069	/* Default/fixed: create an attribute node70	* or an element's text node on the instance.71	*/72} xmlSchemaValidOption;73 74/*75    XML_SCHEMA_VAL_XSI_ASSEMBLE			= 1<<1,76	* assemble schemata using77	* xsi:schemaLocation and78	* xsi:noNamespaceSchemaLocation79*/80 81/**82 * The schemas related types are kept internal83 */84typedef struct _xmlSchema xmlSchema;85typedef xmlSchema *xmlSchemaPtr;86 87/**88 * xmlSchemaValidityErrorFunc:89 * @ctx: the validation context90 * @msg: the message91 * @...: extra arguments92 *93 * Signature of an error callback from an XSD validation94 */95typedef void (*xmlSchemaValidityErrorFunc)96                 (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);97 98/**99 * xmlSchemaValidityWarningFunc:100 * @ctx: the validation context101 * @msg: the message102 * @...: extra arguments103 *104 * Signature of a warning callback from an XSD validation105 */106typedef void (*xmlSchemaValidityWarningFunc)107                 (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);108 109/**110 * A schemas validation context111 */112typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;113typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;114 115typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;116typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;117 118/**119 * xmlSchemaValidityLocatorFunc:120 * @ctx: user provided context121 * @file: returned file information122 * @line: returned line information123 *124 * A schemas validation locator, a callback called by the validator.125 * This is used when file or node information are not available126 * to find out what file and line number are affected127 *128 * Returns: 0 in case of success and -1 in case of error129 */130 131typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx,132                           const char **file, unsigned long *line);133 134/*135 * Interfaces for parsing.136 */137XMLPUBFUN xmlSchemaParserCtxtPtr138	    xmlSchemaNewParserCtxt	(const char *URL);139XMLPUBFUN xmlSchemaParserCtxtPtr140	    xmlSchemaNewMemParserCtxt	(const char *buffer,141					 int size);142XMLPUBFUN xmlSchemaParserCtxtPtr143	    xmlSchemaNewDocParserCtxt	(xmlDocPtr doc);144XMLPUBFUN void145	    xmlSchemaFreeParserCtxt	(xmlSchemaParserCtxtPtr ctxt);146XMLPUBFUN void147	    xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,148					 xmlSchemaValidityErrorFunc err,149					 xmlSchemaValidityWarningFunc warn,150					 void *ctx);151XMLPUBFUN void152	    xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,153					 xmlStructuredErrorFunc serror,154					 void *ctx);155XMLPUBFUN int156		xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,157					xmlSchemaValidityErrorFunc * err,158					xmlSchemaValidityWarningFunc * warn,159					void **ctx);160XMLPUBFUN int161		xmlSchemaIsValid	(xmlSchemaValidCtxtPtr ctxt);162 163XMLPUBFUN xmlSchemaPtr164	    xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt);165XMLPUBFUN void166	    xmlSchemaFree		(xmlSchemaPtr schema);167#ifdef LIBXML_OUTPUT_ENABLED168XMLPUBFUN void169	    xmlSchemaDump		(FILE *output,170					 xmlSchemaPtr schema);171#endif /* LIBXML_OUTPUT_ENABLED */172/*173 * Interfaces for validating174 */175XMLPUBFUN void176	    xmlSchemaSetValidErrors	(xmlSchemaValidCtxtPtr ctxt,177					 xmlSchemaValidityErrorFunc err,178					 xmlSchemaValidityWarningFunc warn,179					 void *ctx);180XMLPUBFUN void181	    xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,182					 xmlStructuredErrorFunc serror,183					 void *ctx);184XMLPUBFUN int185	    xmlSchemaGetValidErrors	(xmlSchemaValidCtxtPtr ctxt,186					 xmlSchemaValidityErrorFunc *err,187					 xmlSchemaValidityWarningFunc *warn,188					 void **ctx);189XMLPUBFUN int190	    xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,191					 int options);192XMLPUBFUN void193            xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,194	                                 const char *filename);195XMLPUBFUN int196	    xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);197 198XMLPUBFUN xmlSchemaValidCtxtPtr199	    xmlSchemaNewValidCtxt	(xmlSchemaPtr schema);200XMLPUBFUN void201	    xmlSchemaFreeValidCtxt	(xmlSchemaValidCtxtPtr ctxt);202XMLPUBFUN int203	    xmlSchemaValidateDoc	(xmlSchemaValidCtxtPtr ctxt,204					 xmlDocPtr instance);205XMLPUBFUN int206            xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,207			                 xmlNodePtr elem);208XMLPUBFUN int209	    xmlSchemaValidateStream	(xmlSchemaValidCtxtPtr ctxt,210					 xmlParserInputBufferPtr input,211					 xmlCharEncoding enc,212					 xmlSAXHandlerPtr sax,213					 void *user_data);214XMLPUBFUN int215	    xmlSchemaValidateFile	(xmlSchemaValidCtxtPtr ctxt,216					 const char * filename,217					 int options);218 219XMLPUBFUN xmlParserCtxtPtr220	    xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);221 222/*223 * Interface to insert Schemas SAX validation in a SAX stream224 */225typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;226typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;227 228XMLPUBFUN xmlSchemaSAXPlugPtr229            xmlSchemaSAXPlug		(xmlSchemaValidCtxtPtr ctxt,230					 xmlSAXHandlerPtr *sax,231					 void **user_data);232XMLPUBFUN int233            xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug);234 235 236XMLPUBFUN void237            xmlSchemaValidateSetLocator	(xmlSchemaValidCtxtPtr vctxt,238					 xmlSchemaValidityLocatorFunc f,239					 void *ctxt);240 241#ifdef __cplusplus242}243#endif244 245#endif /* LIBXML_SCHEMAS_ENABLED */246#endif /* __XML_SCHEMA_H__ */247 
codekingpro/portable-devtools · Team Ai