1999-01-18 03:11:59 +08:00
|
|
|
/*
|
|
|
|
* valid.h : interface to the DTD handling and the validity checking
|
|
|
|
*
|
|
|
|
* See Copyright for the status of this software.
|
|
|
|
*
|
|
|
|
* Daniel.Veillard@w3.org
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __XML_VALID_H__
|
|
|
|
#define __XML_VALID_H__
|
|
|
|
#include "tree.h"
|
|
|
|
|
1999-08-11 03:04:08 +08:00
|
|
|
/**
|
|
|
|
* an xmlValidCtxt is used for error reporting when validating
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
|
|
|
|
typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
|
|
|
|
|
|
|
|
typedef struct xmlValidCtxt {
|
|
|
|
void *userData; /* user specific data block */
|
|
|
|
xmlValidityErrorFunc error; /* the callback in case of errors */
|
|
|
|
xmlValidityWarningFunc warning; /* the callback in case of warning */
|
|
|
|
} xmlValidCtxt, *xmlValidCtxtPtr;
|
|
|
|
|
|
|
|
extern void xmlParserValidityError(void *ctx, const char *msg, ...);
|
|
|
|
extern void xmlParserValidityWarning(void *ctx, const char *msg, ...);
|
|
|
|
|
1999-02-22 18:33:01 +08:00
|
|
|
/*
|
|
|
|
* ALl notation declarations are stored in a table
|
|
|
|
* there is one table per DTD
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define XML_MIN_NOTATION_TABLE 32
|
|
|
|
|
|
|
|
typedef struct xmlNotationTable {
|
|
|
|
int nb_notations; /* number of notations stored */
|
|
|
|
int max_notations; /* maximum number of notations */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlNotationPtr *table; /* the table of attributes */
|
1999-02-22 18:33:01 +08:00
|
|
|
} xmlNotationTable;
|
|
|
|
typedef xmlNotationTable *xmlNotationTablePtr;
|
|
|
|
|
1999-02-01 06:15:06 +08:00
|
|
|
/*
|
|
|
|
* ALl element declarations are stored in a table
|
|
|
|
* there is one table per DTD
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define XML_MIN_ELEMENT_TABLE 32
|
|
|
|
|
|
|
|
typedef struct xmlElementTable {
|
|
|
|
int nb_elements; /* number of elements stored */
|
|
|
|
int max_elements; /* maximum number of elements */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlElementPtr *table; /* the table of elements */
|
1999-02-22 18:33:01 +08:00
|
|
|
} xmlElementTable;
|
|
|
|
typedef xmlElementTable *xmlElementTablePtr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ALl attribute declarations are stored in a table
|
|
|
|
* there is one table per DTD
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define XML_MIN_ATTRIBUTE_TABLE 32
|
|
|
|
|
|
|
|
typedef struct xmlAttributeTable {
|
|
|
|
int nb_attributes; /* number of attributes stored */
|
|
|
|
int max_attributes; /* maximum number of attributes */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlAttributePtr *table; /* the table of attributes */
|
1999-02-22 18:33:01 +08:00
|
|
|
} xmlAttributeTable;
|
|
|
|
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
1999-02-01 06:15:06 +08:00
|
|
|
|
1999-02-22 18:33:01 +08:00
|
|
|
/* Notation */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlNotationPtr xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
|
|
|
|
const CHAR *name, const CHAR *PublicID, const CHAR *SystemID);
|
1999-02-22 18:33:01 +08:00
|
|
|
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
|
|
|
|
void xmlFreeNotationTable(xmlNotationTablePtr table);
|
1999-04-22 04:12:07 +08:00
|
|
|
void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table);
|
1999-02-22 18:33:01 +08:00
|
|
|
|
|
|
|
/* Element Content */
|
|
|
|
xmlElementContentPtr xmlNewElementContent(CHAR *name, int type);
|
|
|
|
xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
|
|
|
|
void xmlFreeElementContent(xmlElementContentPtr cur);
|
|
|
|
|
|
|
|
/* Element */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlElementPtr xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
|
|
|
|
const CHAR *name, int type, xmlElementContentPtr content);
|
1999-02-22 18:33:01 +08:00
|
|
|
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
|
|
|
|
void xmlFreeElementTable(xmlElementTablePtr table);
|
1999-04-22 04:12:07 +08:00
|
|
|
void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table);
|
1999-02-22 18:33:01 +08:00
|
|
|
|
|
|
|
/* Enumeration */
|
|
|
|
xmlEnumerationPtr xmlCreateEnumeration(CHAR *name);
|
|
|
|
void xmlFreeEnumeration(xmlEnumerationPtr cur);
|
|
|
|
xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
|
|
|
|
|
|
|
|
/* Attribute */
|
1999-08-11 03:04:08 +08:00
|
|
|
xmlAttributePtr xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd,
|
|
|
|
const CHAR *elem, const CHAR *name, int type, int def,
|
1999-04-05 20:20:10 +08:00
|
|
|
const CHAR *defaultValue, xmlEnumerationPtr tree);
|
1999-02-22 18:33:01 +08:00
|
|
|
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
|
|
|
|
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
|
1999-04-22 04:12:07 +08:00
|
|
|
void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table);
|
1999-02-01 06:15:06 +08:00
|
|
|
|
1999-08-11 03:04:08 +08:00
|
|
|
/**
|
|
|
|
* The public function calls related to validity checking
|
|
|
|
*/
|
|
|
|
|
|
|
|
int xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc);
|
|
|
|
int xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|
|
|
xmlElementPtr elem);
|
|
|
|
int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|
|
|
xmlAttributePtr attr);
|
|
|
|
int xmlValidateNotationDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|
|
|
xmlNotationPtr nota);
|
|
|
|
int xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd);
|
|
|
|
|
|
|
|
int xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc);
|
|
|
|
int xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem);
|
|
|
|
int xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|
|
|
xmlNodePtr elem);
|
|
|
|
int xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|
|
|
xmlNodePtr elem, xmlAttrPtr attr, const CHAR *value);
|
|
|
|
|
|
|
|
int xmlIsMixedElement(xmlDocPtr doc, const CHAR *name);
|
1999-01-18 03:11:59 +08:00
|
|
|
#endif /* __XML_VALID_H__ */
|