Blame doc/devhelp/libxml2-relaxng.html

Packit Service a31ea6
Packit Service a31ea6
<html>
Packit Service a31ea6
  <head>
Packit Service a31ea6
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Packit Service a31ea6
    <title>relaxng: implementation of the Relax-NG validation</title>
Packit Service a31ea6
    <meta name="generator" content="Libxml2 devhelp stylesheet"/>
Packit Service a31ea6
    <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
Packit Service a31ea6
    <link rel="up" href="general.html" title="API"/>
Packit Service a31ea6
    <link rel="stylesheet" href="style.css" type="text/css"/>
Packit Service a31ea6
    <link rel="chapter" href="general.html" title="API"/>
Packit Service a31ea6
  </head>
Packit Service a31ea6
  <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit Service a31ea6
    
Packit Service a31ea6
      
Packit Service a31ea6
        
Packit Service a31ea6
          
Packit Service a31ea6
            Prev
Packit Service a31ea6
          
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6
          
Packit Service a31ea6
            Up
Packit Service a31ea6
          
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6
          
Packit Service a31ea6
            Home
Packit Service a31ea6
          
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6
          
Packit Service a31ea6
            Next
Packit Service a31ea6
          
Packit Service a31ea6
        
Packit Service a31ea6
        libxml2 Reference Manual
Packit Service a31ea6
      
Packit Service a31ea6
    
Packit Service a31ea6
    

Packit Service a31ea6
      relaxng
Packit Service a31ea6
    
Packit Service a31ea6
    

relaxng - implementation of the Relax-NG validation

Packit Service a31ea6
    

implementation of the Relax-NG validation

Packit Service a31ea6
    

Author(s): Daniel Veillard

Packit Service a31ea6
    
Packit Service a31ea6
      

Synopsis

Packit Service a31ea6
      
typedef struct _xmlRelaxNG xmlRelaxNG;
Packit Service a31ea6
typedef xmlRelaxNG * xmlRelaxNGPtr;
Packit Service a31ea6
typedef enum xmlRelaxNGValidErr;
Packit Service a31ea6
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
Packit Service a31ea6
typedef xmlRelaxNGParserCtxt * xmlRelaxNGParserCtxtPtr;
Packit Service a31ea6
typedef enum xmlRelaxNGParserFlag;
Packit Service a31ea6
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
Packit Service a31ea6
typedef xmlRelaxNGValidCtxt * xmlRelaxNGValidCtxtPtr;
Packit Service a31ea6
void	xmlRelaxNGFreeValidCtxt		(xmlRelaxNGValidCtxtPtr ctxt);
Packit Service a31ea6
xmlRelaxNGParserCtxtPtr	xmlRelaxNGNewDocParserCtxt	(xmlDocPtr doc);
Packit Service a31ea6
void	xmlRelaxNGSetValidErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void * ctx);
Packit Service a31ea6
xmlRelaxNGParserCtxtPtr	xmlRelaxNGNewParserCtxt	(const char * URL);
Packit Service a31ea6
int	xmlRelaxNGGetParserErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc * err,
xmlRelaxNGValidityWarningFunc * warn,
void ** ctx);
Packit Service a31ea6
int	xmlRelaxNGValidatePopElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem);
Packit Service a31ea6
xmlRelaxNGValidCtxtPtr	xmlRelaxNGNewValidCtxt	(xmlRelaxNGPtr schema);
Packit Service a31ea6
xmlRelaxNGParserCtxtPtr	xmlRelaxNGNewMemParserCtxt	(const char * buffer, 
int size);
Packit Service a31ea6
void	xmlRelaxNGDump			(FILE * output, 
xmlRelaxNGPtr schema);
Packit Service a31ea6
void	xmlRelaxNGSetParserErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void * ctx);
Packit Service a31ea6
xmlRelaxNGPtr	xmlRelaxNGParse		(xmlRelaxNGParserCtxtPtr ctxt);
Packit Service a31ea6
void	xmlRelaxNGSetParserStructuredErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx);
Packit Service a31ea6
int	xmlRelaxNGValidateFullElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem);
Packit Service a31ea6
typedef void xmlRelaxNGValidityErrorFunc	(void * ctx, 
const char * msg,
... ...);
Packit Service a31ea6
int	xmlRelaxNGValidatePushElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem);
Packit Service a31ea6
void	xmlRelaxNGFree			(xmlRelaxNGPtr schema);
Packit Service a31ea6
int	xmlRelaxNGValidateDoc		(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc);
Packit Service a31ea6
void	xmlRelaxNGSetValidStructuredErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx);
Packit Service a31ea6
void	xmlRelaxNGFreeParserCtxt	(xmlRelaxNGParserCtxtPtr ctxt);
Packit Service a31ea6
int	xmlRelaxNGGetValidErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc * err,
xmlRelaxNGValidityWarningFunc * warn,
void ** ctx);
Packit Service a31ea6
int	xmlRelaxNGInitTypes		(void);
Packit Service a31ea6
void	xmlRelaxNGDumpTree		(FILE * output, 
xmlRelaxNGPtr schema);
Packit Service a31ea6
void	xmlRelaxNGCleanupTypes		(void);
Packit Service a31ea6
int	xmlRelaxNGValidatePushCData	(xmlRelaxNGValidCtxtPtr ctxt, 
const xmlChar * data,
int len);
Packit Service a31ea6
int	xmlRelaxParserSetFlag		(xmlRelaxNGParserCtxtPtr ctxt, 
int flags);
Packit Service a31ea6
typedef void xmlRelaxNGValidityWarningFunc	(void * ctx, 
const char * msg,
... ...);
Packit Service a31ea6
Packit Service a31ea6
    
Packit Service a31ea6
    
Packit Service a31ea6
      

Description

Packit Service a31ea6
    
Packit Service a31ea6
    
Packit Service a31ea6
      

Details

Packit Service a31ea6
      
Packit Service a31ea6
        

Structure xmlRelaxNG

struct _xmlRelaxNG {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
} xmlRelaxNG;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Structure xmlRelaxNGParserCtxt

struct _xmlRelaxNGParserCtxt {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
} xmlRelaxNGParserCtxt;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Typedef xmlRelaxNGParserCtxtPtr

xmlRelaxNGParserCtxt * xmlRelaxNGParserCtxtPtr;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Enum xmlRelaxNGParserFlag

enum xmlRelaxNGParserFlag {
Packit Service a31ea6
    XML_RELAXNGP_NONE = 0
Packit Service a31ea6
    XML_RELAXNGP_FREE_DOC = 1
Packit Service a31ea6
    XML_RELAXNGP_CRNG = 2
Packit Service a31ea6
};
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Typedef xmlRelaxNGPtr

xmlRelaxNG * xmlRelaxNGPtr;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Structure xmlRelaxNGValidCtxt

struct _xmlRelaxNGValidCtxt {
Packit Service a31ea6
The content of this structure is not made public by the API.
Packit Service a31ea6
} xmlRelaxNGValidCtxt;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Typedef xmlRelaxNGValidCtxtPtr

xmlRelaxNGValidCtxt * xmlRelaxNGValidCtxtPtr;
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        

Enum xmlRelaxNGValidErr

enum xmlRelaxNGValidErr {
Packit Service a31ea6
    XML_RELAXNG_OK = 0
Packit Service a31ea6
    XML_RELAXNG_ERR_MEMORY = 1
Packit Service a31ea6
    XML_RELAXNG_ERR_TYPE = 2
Packit Service a31ea6
    XML_RELAXNG_ERR_TYPEVAL = 3
Packit Service a31ea6
    XML_RELAXNG_ERR_DUPID = 4
Packit Service a31ea6
    XML_RELAXNG_ERR_TYPECMP = 5
Packit Service a31ea6
    XML_RELAXNG_ERR_NOSTATE = 6
Packit Service a31ea6
    XML_RELAXNG_ERR_NODEFINE = 7
Packit Service a31ea6
    XML_RELAXNG_ERR_LISTEXTRA = 8
Packit Service a31ea6
    XML_RELAXNG_ERR_LISTEMPTY = 9
Packit Service a31ea6
    XML_RELAXNG_ERR_INTERNODATA = 10
Packit Service a31ea6
    XML_RELAXNG_ERR_INTERSEQ = 11
Packit Service a31ea6
    XML_RELAXNG_ERR_INTEREXTRA = 12
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMNAME = 13
Packit Service a31ea6
    XML_RELAXNG_ERR_ATTRNAME = 14
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMNONS = 15
Packit Service a31ea6
    XML_RELAXNG_ERR_ATTRNONS = 16
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMWRONGNS = 17
Packit Service a31ea6
    XML_RELAXNG_ERR_ATTRWRONGNS = 18
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMEXTRANS = 19
Packit Service a31ea6
    XML_RELAXNG_ERR_ATTREXTRANS = 20
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMNOTEMPTY = 21
Packit Service a31ea6
    XML_RELAXNG_ERR_NOELEM = 22
Packit Service a31ea6
    XML_RELAXNG_ERR_NOTELEM = 23
Packit Service a31ea6
    XML_RELAXNG_ERR_ATTRVALID = 24
Packit Service a31ea6
    XML_RELAXNG_ERR_CONTENTVALID = 25
Packit Service a31ea6
    XML_RELAXNG_ERR_EXTRACONTENT = 26
Packit Service a31ea6
    XML_RELAXNG_ERR_INVALIDATTR = 27
Packit Service a31ea6
    XML_RELAXNG_ERR_DATAELEM = 28
Packit Service a31ea6
    XML_RELAXNG_ERR_VALELEM = 29
Packit Service a31ea6
    XML_RELAXNG_ERR_LISTELEM = 30
Packit Service a31ea6
    XML_RELAXNG_ERR_DATATYPE = 31
Packit Service a31ea6
    XML_RELAXNG_ERR_VALUE = 32
Packit Service a31ea6
    XML_RELAXNG_ERR_LIST = 33
Packit Service a31ea6
    XML_RELAXNG_ERR_NOGRAMMAR = 34
Packit Service a31ea6
    XML_RELAXNG_ERR_EXTRADATA = 35
Packit Service a31ea6
    XML_RELAXNG_ERR_LACKDATA = 36
Packit Service a31ea6
    XML_RELAXNG_ERR_INTERNAL = 37
Packit Service a31ea6
    XML_RELAXNG_ERR_ELEMWRONG = 38
Packit Service a31ea6
    XML_RELAXNG_ERR_TEXTWRONG = 39
Packit Service a31ea6
};
Packit Service a31ea6

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Signature of an error callback from a Relax-NG validation

Packit Service a31ea6
<tt>ctx</tt>:the validation context
<tt>msg</tt>:the message
<tt>...</tt>:extra arguments
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Signature of a warning callback from a Relax-NG validation

Packit Service a31ea6
<tt>ctx</tt>:the validation context
<tt>msg</tt>:the message
<tt>...</tt>:extra arguments
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Cleanup the default Schemas type library associated to RelaxNG

Packit Service a31ea6
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Dump a RelaxNG structure back

Packit Service a31ea6
<tt>output</tt>:the file output
<tt>schema</tt>:a schema structure
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Dump the transformed RelaxNG tree.

Packit Service a31ea6
<tt>output</tt>:the file output
<tt>schema</tt>:a schema structure
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Deallocate a RelaxNG structure.

Packit Service a31ea6
<tt>schema</tt>:a schema structure
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Free the resources associated to the schema parser context

Packit Service a31ea6
<tt>ctxt</tt>:the schema parser context
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Free the resources associated to the schema validation context

Packit Service a31ea6
<tt>ctxt</tt>:the schema validation context
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Get the callback information used to handle errors for a validation context

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>err</tt>:the error callback result
<tt>warn</tt>:the warning callback result
<tt>ctx</tt>:contextual data for the callbacks result
<tt>Returns</tt>:-1 in case of failure, 0 otherwise.
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Get the error and warning callback informations

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>err</tt>:the error function result
<tt>warn</tt>:the warning function result
<tt>ctx</tt>:the functions context result
<tt>Returns</tt>:-1 in case of error and 0 otherwise
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Initilize the default type libraries.

Packit Service a31ea6
<tt>Returns</tt>:0 in case of success and -1 in case of error.
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Create an XML RelaxNGs parser context for that document. Note: since the process of compiling a RelaxNG schemas modifies the document, the @doc parameter is duplicated internally.

Packit Service a31ea6
<tt>doc</tt>:a preparsed document tree
<tt>Returns</tt>:the parser context or NULL in case of error
Packit Service a31ea6
        
Packit Service a31ea6
        

xmlRelaxNGNewMemParserCtxt ()

xmlRelaxNGParserCtxtPtr	xmlRelaxNGNewMemParserCtxt	(const char * buffer, 
int size)
Packit Service a31ea6

Create an XML RelaxNGs parse context for that memory buffer expected to contain an XML RelaxNGs file.

Packit Service a31ea6
<tt>buffer</tt>:a pointer to a char array containing the schemas
<tt>size</tt>:the size of the array
<tt>Returns</tt>:the parser context or NULL in case of error
Packit Service a31ea6
        
Packit Service a31ea6
        

xmlRelaxNGNewParserCtxt ()

xmlRelaxNGParserCtxtPtr	xmlRelaxNGNewParserCtxt	(const char * URL)
Packit Service a31ea6

Create an XML RelaxNGs parse context for that file/resource expected to contain an XML RelaxNGs file.

Packit Service a31ea6
<tt>URL</tt>:the location of the schema
<tt>Returns</tt>:the parser context or NULL in case of error
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Create an XML RelaxNGs validation context based on the given schema

Packit Service a31ea6
<tt>schema</tt>:a precompiled XML RelaxNGs
<tt>Returns</tt>:the validation context or NULL in case of error
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG parser context
<tt>Returns</tt>:the internal XML RelaxNG structure built from the resource or NULL in case of error
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Set the callback functions used to handle errors for a validation context

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>err</tt>:the error callback
<tt>warn</tt>:the warning callback
<tt>ctx</tt>:contextual data for the callbacks
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Set the callback functions used to handle errors for a parsing context

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG parser context
<tt>serror</tt>:the error callback
<tt>ctx</tt>:contextual data for the callbacks
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Set the error and warning callback informations

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>err</tt>:the error function
<tt>warn</tt>:the warning function
<tt>ctx</tt>:the functions context
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Set the structured error callback

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>serror</tt>:the structured error function
<tt>ctx</tt>:the functions context
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Validate a document tree in memory.

Packit Service a31ea6
<tt>ctxt</tt>:a Relax-NG validation context
<tt>doc</tt>:a parsed document tree
<tt>Returns</tt>:0 if the document is valid, a positive error code number otherwise and -1 in case of internal or API error.
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Validate a full subtree when xmlRelaxNGValidatePushElement() returned 0 and the content of the node has been expanded.

Packit Service a31ea6
<tt>ctxt</tt>:the validation context
<tt>doc</tt>:a document instance
<tt>elem</tt>:an element instance
<tt>Returns</tt>:1 if no validation problem was found or -1 in case of error.
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Pop the element end from the RelaxNG validation stack.

Packit Service a31ea6
<tt>ctxt</tt>:the RelaxNG validation context
<tt>doc</tt>:a document instance
<tt>elem</tt>:an element instance
<tt>Returns</tt>:1 if no validation problem was found or 0 otherwise
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

check the CData parsed for validation in the current stack

Packit Service a31ea6
<tt>ctxt</tt>:the RelaxNG validation context
<tt>data</tt>:some character data read
<tt>len</tt>:the length of the data
<tt>Returns</tt>:1 if no validation problem was found or -1 otherwise
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Push a new element start on the RelaxNG validation stack.

Packit Service a31ea6
<tt>ctxt</tt>:the validation context
<tt>doc</tt>:a document instance
<tt>elem</tt>:an element instance
<tt>Returns</tt>:1 if no validation problem was found or 0 if validating the element requires a full node, and -1 in case of error.
Packit Service a31ea6
        
Packit Service a31ea6
        
Packit Service a31ea6

Semi private function used to pass informations to a parser context which are a combination of xmlRelaxNGParserFlag .

Packit Service a31ea6
<tt>ctxt</tt>:a RelaxNG parser context
<tt>flags</tt>:a set of flags values
<tt>Returns</tt>:0 if success and -1 in case of error
Packit Service a31ea6
        
Packit Service a31ea6
      
Packit Service a31ea6
    
Packit Service a31ea6
  </body>
Packit Service a31ea6
</html>