# ## Module xmlschemas from libxml2

API Menu
Main Menu Developer Menu Code Examples API Menu Parser API Tree API Reader API XML Guidelines ChangeLog
API Indexes
Alphabetic Constructors Functions/Types Modules Symbols
Related links
Mail archive XSLT libxslt DOM gdome2 XML-DSig xmlsec FTP Windows binaries Solaris binaries MacOsX binaries C++ bindings PHP bindings Pascal bindings Ruby bindings Tcl bindings Bug Tracker
interface to the XML Schemas handling and schema validity checking, it is incomplete right now. ## Table of Contents
    Structure xmlSchema
    struct _xmlSchema
    Structure xmlSchemaParserCtxt
    struct _xmlSchemaParserCtxt
    The content of this structure is not made public by the API.
    Typedef xmlSchemaParserCtxt * xmlSchemaParserCtxtPtr
    Typedef xmlSchema * xmlSchemaPtr
    Typedef xmlSchemaSAXPlugStruct * xmlSchemaSAXPlugPtr
    Structure xmlSchemaSAXPlugStruct
    struct _xmlSchemaSAXPlug
    The content of this structure is not made public by the API.
    Structure xmlSchemaValidCtxt
    struct _xmlSchemaValidCtxt
    The content of this structure is not made public by the API.
    Typedef xmlSchemaValidCtxt * xmlSchemaValidCtxtPtr
    Enum xmlSchemaValidError
    Enum xmlSchemaValidOption
    void	xmlSchemaDump			(FILE * output,
    					 xmlSchemaPtr schema)
    void	xmlSchemaFree			(xmlSchemaPtr schema)
    void	xmlSchemaFreeParserCtxt		(xmlSchemaParserCtxtPtr ctxt)
    void	xmlSchemaFreeValidCtxt		(xmlSchemaValidCtxtPtr ctxt)
    int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc * err,
    					 xmlSchemaValidityWarningFunc * warn,
    					 void ** ctx)
    int	xmlSchemaGetValidErrors		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc * err,
    					 xmlSchemaValidityWarningFunc * warn,
    					 void ** ctx)
    int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
    xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)
    xmlSchemaParserCtxtPtr	xmlSchemaNewMemParserCtxt	(const char * buffer,
    							 int size)
    xmlSchemaParserCtxtPtr	xmlSchemaNewParserCtxt	(const char * URL)
    xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
    xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
    xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt,
    						 xmlSAXHandlerPtr * sax,
    						 void ** user_data)
    int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
    void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc err,
    					 xmlSchemaValidityWarningFunc warn,
    					 void * ctx)
    void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt,
    						 xmlStructuredErrorFunc serror,
    						 void * ctx)
    void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc err,
    					 xmlSchemaValidityWarningFunc warn,
    					 void * ctx)
    int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,
    					 int options)
    void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt,
    						 xmlStructuredErrorFunc serror,
    						 void * ctx)
    int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlDocPtr instance)
    int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt,
    					 const char * filename,
    					 int options)
    int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt,
    					 xmlNodePtr elem)
    int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlParserInputBufferPtr input,
    					 xmlCharEncoding enc,
    					 xmlSAXHandlerPtr sax,
    					 void * user_data)
    Function type: xmlSchemaValidityErrorFunc
    void	xmlSchemaValidityErrorFunc	(void * ctx,
    					 const char * msg,
    					 ... ...)
    Function type: xmlSchemaValidityWarningFunc
    void	xmlSchemaValidityWarningFunc	(void * ctx,
    					 const char * msg,
    					 ... ...)
## Description ### Structure xmlSchema
    Structure xmlSchema
    struct _xmlSchema {
        const xmlChar *	name	: schema name
        const xmlChar *	targetNamespace	: the target namespace
        const xmlChar *	version
        const xmlChar *	id	: Obsolete
        xmlDocPtr	doc
        xmlSchemaAnnotPtr	annot
        int	flags
        xmlHashTablePtr	typeDecl
        xmlHashTablePtr	attrDecl
        xmlHashTablePtr	attrgrpDecl
        xmlHashTablePtr	elemDecl
        xmlHashTablePtr	notaDecl
        xmlHashTablePtr	schemasImports
        void *	_private	: unused by the library for users or bind
        xmlHashTablePtr	groupDecl
        xmlDictPtr	dict
        void *	includes	: the includes, this is opaque for now
        int	preserve	: whether to free the document
        int	counter	: used to give ononymous components uniqu
        xmlHashTablePtr	idcDef	: All identity-constraint defs.
        void *	volatiles	: Obsolete
    }
### Structure xmlSchemaParserCtxt
    Structure xmlSchemaParserCtxt
    struct _xmlSchemaParserCtxt {
    The content of this structure is not made public by the API.
    }
### Structure xmlSchemaSAXPlugStruct
    Structure xmlSchemaSAXPlugStruct
    struct _xmlSchemaSAXPlug {
    The content of this structure is not made public by the API.
    }
### Structure xmlSchemaValidCtxt
    Structure xmlSchemaValidCtxt
    struct _xmlSchemaValidCtxt {
    The content of this structure is not made public by the API.
    }
### Enum xmlSchemaValidError
    Enum xmlSchemaValidError {
        XML_SCHEMAS_ERR_OK = 0
        XML_SCHEMAS_ERR_NOROOT = 1
        XML_SCHEMAS_ERR_UNDECLAREDELEM = 2
        XML_SCHEMAS_ERR_NOTTOPLEVEL = 3
        XML_SCHEMAS_ERR_MISSING = 4
        XML_SCHEMAS_ERR_WRONGELEM = 5
        XML_SCHEMAS_ERR_NOTYPE = 6
        XML_SCHEMAS_ERR_NOROLLBACK = 7
        XML_SCHEMAS_ERR_ISABSTRACT = 8
        XML_SCHEMAS_ERR_NOTEMPTY = 9
        XML_SCHEMAS_ERR_ELEMCONT = 10
        XML_SCHEMAS_ERR_HAVEDEFAULT = 11
        XML_SCHEMAS_ERR_NOTNILLABLE = 12
        XML_SCHEMAS_ERR_EXTRACONTENT = 13
        XML_SCHEMAS_ERR_INVALIDATTR = 14
        XML_SCHEMAS_ERR_INVALIDELEM = 15
        XML_SCHEMAS_ERR_NOTDETERMINIST = 16
        XML_SCHEMAS_ERR_CONSTRUCT = 17
        XML_SCHEMAS_ERR_INTERNAL = 18
        XML_SCHEMAS_ERR_NOTSIMPLE = 19
        XML_SCHEMAS_ERR_ATTRUNKNOWN = 20
        XML_SCHEMAS_ERR_ATTRINVALID = 21
        XML_SCHEMAS_ERR_VALUE = 22
        XML_SCHEMAS_ERR_FACET = 23
        XML_SCHEMAS_ERR_ = 24
        XML_SCHEMAS_ERR_XXX = 25
    }
### Enum xmlSchemaValidOption
    Enum xmlSchemaValidOption {
        XML_SCHEMA_VAL_VC_I_CREATE = 1 : Default/fixed: create an attribute node * or an element's text node on the instance. *
    }
### Function: xmlSchemaDump
    void	xmlSchemaDump			(FILE * output,
    					 xmlSchemaPtr schema)
Dump a Schema structure.
`output`: | the file output
`schema`: | a schema structure
### Function: xmlSchemaFree
    void	xmlSchemaFree			(xmlSchemaPtr schema)
Deallocate a Schema structure.
`schema`: | a schema structure
### Function: xmlSchemaFreeParserCtxt
    void	xmlSchemaFreeParserCtxt		(xmlSchemaParserCtxtPtr ctxt)
Free the resources associated to the schema parser context
`ctxt`: | the schema parser context
### Function: xmlSchemaFreeValidCtxt
    void	xmlSchemaFreeValidCtxt		(xmlSchemaValidCtxtPtr ctxt)
`ctxt`: |
### Function: xmlSchemaGetParserErrors
    int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc * err,
    					 xmlSchemaValidityWarningFunc * warn,
    					 void ** ctx)
Get the callback information used to handle errors for a parser context
`ctxt`: | a XMl-Schema parser context
`err`: | the error callback result
`warn`: | the warning callback result
`ctx`: | contextual data for the callbacks result
`Returns`: | -1 in case of failure, 0 otherwise
### Function: xmlSchemaGetValidErrors
    int	xmlSchemaGetValidErrors		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc * err,
    					 xmlSchemaValidityWarningFunc * warn,
    					 void ** ctx)
`ctxt`: |
`err`: |
`warn`: |
`ctx`: |
`Returns`: |
### Function: xmlSchemaIsValid
    int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
`ctxt`: |
`Returns`: |
### Function: xmlSchemaNewDocParserCtxt
    xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)
Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.
`doc`: | a preparsed document tree
`Returns`: | the parser context or NULL in case of error
### Function: xmlSchemaNewMemParserCtxt
    xmlSchemaParserCtxtPtr	xmlSchemaNewMemParserCtxt	(const char * buffer,
    							 int size)
Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.
`buffer`: | a pointer to a char array containing the schemas
`size`: | the size of the array
`Returns`: | the parser context or NULL in case of error
### Function: xmlSchemaNewParserCtxt
    xmlSchemaParserCtxtPtr	xmlSchemaNewParserCtxt	(const char * URL)
Create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.
`URL`: | the location of the schema
`Returns`: | the parser context or NULL in case of error
### Function: xmlSchemaNewValidCtxt
    xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
`schema`: |
`Returns`: |
### Function: xmlSchemaParse
    xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.
`ctxt`: | a schema validation context
`Returns`: | the internal XML Schema structure built from the resource or NULL in case of error
### Function: xmlSchemaSAXPlug
    xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt,
    						 xmlSAXHandlerPtr * sax,
    						 void ** user_data)
`ctxt`: |
`sax`: |
`user_data`: |
`Returns`: |
### Function: xmlSchemaSAXUnplug
    int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
`plug`: |
`Returns`: |
### Function: xmlSchemaSetParserErrors
    void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc err,
    					 xmlSchemaValidityWarningFunc warn,
    					 void * ctx)
Set the callback functions used to handle errors for a validation context
`ctxt`: | a schema validation context
`err`: | the error callback
`warn`: | the warning callback
`ctx`: | contextual data for the callbacks
### Function: xmlSchemaSetParserStructuredErrors
    void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt,
    						 xmlStructuredErrorFunc serror,
    						 void * ctx)
Set the structured error callback
`ctxt`: | a schema parser context
`serror`: | the structured error function
`ctx`: | the functions context
### Function: xmlSchemaSetValidErrors
    void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlSchemaValidityErrorFunc err,
    					 xmlSchemaValidityWarningFunc warn,
    					 void * ctx)
`ctxt`: |
`err`: |
`warn`: |
`ctx`: |
### Function: xmlSchemaSetValidOptions
    int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,
    					 int options)
`ctxt`: |
`options`: |
`Returns`: |
### Function: xmlSchemaSetValidStructuredErrors
    void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt,
    						 xmlStructuredErrorFunc serror,
    						 void * ctx)
`ctxt`: |
`serror`: |
`ctx`: |
### Function: xmlSchemaValidCtxtGetOptions
    int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
`ctxt`: |
`Returns`: |
### Function: xmlSchemaValidateDoc
    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlDocPtr instance)
`ctxt`: |
`instance`: |
`Returns`: |
### Function: xmlSchemaValidateFile
    int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt,
    					 const char * filename,
    					 int options)
`ctxt`: |
`filename`: |
`options`: |
`Returns`: |
### Function: xmlSchemaValidateOneElement
    int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt,
    					 xmlNodePtr elem)
`ctxt`: |
`elem`: |
`Returns`: |
### Function: xmlSchemaValidateStream
    int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt,
    					 xmlParserInputBufferPtr input,
    					 xmlCharEncoding enc,
    					 xmlSAXHandlerPtr sax,
    					 void * user_data)
`ctxt`: |
`input`: |
`enc`: |
`sax`: |
`user_data`: |
`Returns`: |
### Function type: xmlSchemaValidityErrorFunc
    Function type: xmlSchemaValidityErrorFunc
    void	xmlSchemaValidityErrorFunc	(void * ctx,
    					 const char * msg,
    					 ... ...)
`ctx`: |
`msg`: |
`...`: |
### Function type: xmlSchemaValidityWarningFunc
    Function type: xmlSchemaValidityWarningFunc
    void	xmlSchemaValidityWarningFunc	(void * ctx,
    					 const char * msg,
    					 ... ...)
`ctx`: |
`msg`: |
`...`: |
Daniel Veillard