libxml2: schematron.h File Reference

libxml2

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
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
xmlSchematronParserCtxt * | xmlSchematronNewParserCtxt (const char *URL)
| Create an XML Schematrons parse context for that file/resource expected to contain an XML Schematrons file.
xmlSchematronParserCtxt * | xmlSchematronNewMemParserCtxt (const char *buffer, int size)
| Create an XML Schematrons parse context for that memory buffer expected to contain an XML Schematrons file.
xmlSchematronParserCtxt * | xmlSchematronNewDocParserCtxt (xmlDoc *doc)
| Create an XML Schematrons parse context for that document.
void | xmlSchematronFreeParserCtxt (xmlSchematronParserCtxt *ctxt)
| Free the resources associated to the schema parser context.
xmlSchematron * | xmlSchematronParse (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.
xmlSchematronValidCtxt * | xmlSchematronNewValidCtxt (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.

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Typedef Documentation

## ◆ xmlSchematronValidityErrorFunc

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

Signature of an error callback from a Schematron validation.

Parameters

  ctx | the validation context
  msg | the message
  ... | extra arguments

## ◆ xmlSchematronValidityWarningFunc

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

Signature of a warning callback from a Schematron validation.

Parameters

  ctx | the validation context
  msg | the message
  ... | extra arguments

## Enumeration Type Documentation

## ◆ xmlSchematronValidOptions

enum 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

  schema | a schema structure

## ◆ xmlSchematronFreeParserCtxt()

void xmlSchematronFreeParserCtxt | ( | xmlSchematronParserCtxt * | ctxt | ) |

Free the resources associated to the schema parser context.

Parameters

  ctxt | the schema parser context

## ◆ xmlSchematronFreeValidCtxt()

void xmlSchematronFreeValidCtxt | ( | xmlSchematronValidCtxt * | ctxt | ) |

Free the resources associated to the schema validation context.

Parameters

  ctxt | the 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

  doc | a 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

  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

## ◆ xmlSchematronNewParserCtxt()

xmlSchematronParserCtxt * xmlSchematronNewParserCtxt | ( | const char * | URL | ) |

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

Parameters

  URL | the 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

  schema | a precompiled XML Schematrons
  options | a 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

  ctxt | a 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

  ctxt | a Schematron validation context
  serror | the structured error function
  ctx | the functions context

## ◆ xmlSchematronValidateDoc()

int xmlSchematronValidateDoc | ( | xmlSchematronValidCtxt * | ctxt,
|  | xmlDoc * | instance )

Validate a tree instance against the schematron.

Parameters

  ctxt | the schema validation context
  instance | the document instance tree

Returns
  0 in case of success, -1 in case of internal error and an error count otherwise.