libxml2
Loading...
Searching...
No Matches
schematron.h File Reference

XML Schematron implementation. More...

Typedefs

typedef struct _xmlSchematron xmlSchematron
 Schematron schema.
typedef void(* xmlSchematronValidityErrorFunc) (void *ctx, const char *msg,...)
 Signature of an error callback from a Schematron validation.
typedef void(* xmlSchematronValidityWarningFunc) (void *ctx, const char *msg,...)
 Signature of a warning callback from a Schematron validation.
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt
 Schematron parser context.
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt
 Schematron validation context.

Enumerations

enum  xmlSchematronValidOptions
 Schematron validation options. More...

Functions

xmlSchematronParserCtxtxmlSchematronNewParserCtxt (const char *URL)
 Create an XML Schematrons parse context for that file/resource expected to contain an XML Schematrons file.
xmlSchematronParserCtxtxmlSchematronNewMemParserCtxt (const char *buffer, int size)
 Create an XML Schematrons parse context for that memory buffer expected to contain an XML Schematrons file.
xmlSchematronParserCtxtxmlSchematronNewDocParserCtxt (xmlDoc *doc)
 Create an XML Schematrons parse context for that document.
void xmlSchematronFreeParserCtxt (xmlSchematronParserCtxt *ctxt)
 Free the resources associated to the schema parser context.
xmlSchematronxmlSchematronParse (xmlSchematronParserCtxt *ctxt)
 parse a schema definition resource and build an internal XML Schema structure which can be used to validate instances.
void xmlSchematronFree (xmlSchematron *schema)
 Deallocate a Schematron structure.
void xmlSchematronSetValidStructuredErrors (xmlSchematronValidCtxt *ctxt, xmlStructuredErrorFunc serror, void *ctx)
 Set the structured error callback.
xmlSchematronValidCtxtxmlSchematronNewValidCtxt (xmlSchematron *schema, int options)
 Create an XML Schematrons validation context based on the given schema.
void xmlSchematronFreeValidCtxt (xmlSchematronValidCtxt *ctxt)
 Free the resources associated to the schema validation context.
int xmlSchematronValidateDoc (xmlSchematronValidCtxt *ctxt, xmlDoc *instance)
 Validate a tree instance against the schematron.

Detailed Description

XML Schematron implementation.

interface to the XML Schematron validity checking.

Author
Daniel Veillard

Typedef Documentation

◆ xmlSchematronValidityErrorFunc

typedef void(* xmlSchematronValidityErrorFunc) (void *ctx, const char *msg,...)

Signature of an error callback from a Schematron validation.

Parameters
ctxthe validation context
msgthe message
...extra arguments

◆ xmlSchematronValidityWarningFunc

typedef void(* xmlSchematronValidityWarningFunc) (void *ctx, const char *msg,...)

Signature of a warning callback from a Schematron validation.

Parameters
ctxthe validation context
msgthe message
...extra arguments

Enumeration Type Documentation

◆ xmlSchematronValidOptions

Schematron validation options.

Enumerator
XML_SCHEMATRON_OUT_QUIET 

quiet no report

XML_SCHEMATRON_OUT_TEXT 

build a textual report

XML_SCHEMATRON_OUT_XML 

output SVRL

XML_SCHEMATRON_OUT_ERROR 

output via xmlStructuredErrorFunc

XML_SCHEMATRON_OUT_FILE 

output to a file descriptor

XML_SCHEMATRON_OUT_BUFFER 

output to a buffer

XML_SCHEMATRON_OUT_IO 

output to I/O mechanism

Function Documentation

◆ xmlSchematronFree()

void xmlSchematronFree ( xmlSchematron * schema)

Deallocate a Schematron structure.

Parameters
schemaa schema structure

◆ xmlSchematronFreeParserCtxt()

void xmlSchematronFreeParserCtxt ( xmlSchematronParserCtxt * ctxt)

Free the resources associated to the schema parser context.

Parameters
ctxtthe schema parser context

◆ xmlSchematronFreeValidCtxt()

void xmlSchematronFreeValidCtxt ( xmlSchematronValidCtxt * ctxt)

Free the resources associated to the schema validation context.

Parameters
ctxtthe schema validation context

◆ xmlSchematronNewDocParserCtxt()

xmlSchematronParserCtxt * xmlSchematronNewDocParserCtxt ( xmlDoc * doc)

Create an XML Schematrons parse context for that document.

NB. The document may be modified during the parsing process.

Parameters
doca preparsed document tree
Returns
the parser context or NULL in case of error

◆ xmlSchematronNewMemParserCtxt()

xmlSchematronParserCtxt * xmlSchematronNewMemParserCtxt ( const char * buffer,
int size )

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

Parameters
buffera pointer to a char array containing the schemas
sizethe size of the array
Returns
the parser context or NULL in case of error

◆ xmlSchematronNewParserCtxt()

xmlSchematronParserCtxt * xmlSchematronNewParserCtxt ( const char * URL)

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

Parameters
URLthe location of the schema
Returns
the parser context or NULL in case of error

◆ xmlSchematronNewValidCtxt()

xmlSchematronValidCtxt * xmlSchematronNewValidCtxt ( xmlSchematron * schema,
int options )

Create an XML Schematrons validation context based on the given schema.

Parameters
schemaa precompiled XML Schematrons
optionsa set of xmlSchematronValidOptions
Returns
the validation context or NULL in case of error

◆ xmlSchematronParse()

xmlSchematron * xmlSchematronParse ( xmlSchematronParserCtxt * ctxt)

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

Parameters
ctxta schema validation context
Returns
the internal XML Schematron structure built from the resource or NULL in case of error

◆ xmlSchematronSetValidStructuredErrors()

void xmlSchematronSetValidStructuredErrors ( xmlSchematronValidCtxt * ctxt,
xmlStructuredErrorFunc serror,
void * ctx )

Set the structured error callback.

Parameters
ctxta Schematron validation context
serrorthe structured error function
ctxthe functions context

◆ xmlSchematronValidateDoc()

int xmlSchematronValidateDoc ( xmlSchematronValidCtxt * ctxt,
xmlDoc * instance )

Validate a tree instance against the schematron.

Parameters
ctxtthe schema validation context
instancethe document instance tree
Returns
0 in case of success, -1 in case of internal error and an error count otherwise.