1999-01-17 22:11:59 +03: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__
1999-08-30 15:23:51 +04:00
# ifdef __cplusplus
extern " C " {
# endif
1999-01-17 22:11:59 +03:00
# include "tree.h"
1999-08-10 23:04:08 +04: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 13:33:01 +03: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-10 23:04:08 +04:00
xmlNotationPtr * table ; /* the table of attributes */
1999-02-22 13:33:01 +03:00
} xmlNotationTable ;
typedef xmlNotationTable * xmlNotationTablePtr ;
1999-02-01 01:15:06 +03: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-10 23:04:08 +04:00
xmlElementPtr * table ; /* the table of elements */
1999-02-22 13:33:01 +03: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-10 23:04:08 +04:00
xmlAttributePtr * table ; /* the table of attributes */
1999-02-22 13:33:01 +03:00
} xmlAttributeTable ;
typedef xmlAttributeTable * xmlAttributeTablePtr ;
1999-02-01 01:15:06 +03:00
1999-08-16 03:32:28 +04:00
/*
* ALl IDs attributes are stored in a table
* there is one table per document
*/
# define XML_MIN_ID_TABLE 32
typedef struct xmlIDTable {
int nb_ids ; /* number of ids stored */
int max_ids ; /* maximum number of ids */
xmlIDPtr * table ; /* the table of ids */
} xmlIDTable ;
typedef xmlIDTable * xmlIDTablePtr ;
1999-02-22 13:33:01 +03:00
/* Notation */
1999-08-30 01:02:19 +04:00
xmlNotationPtr xmlAddNotationDecl ( xmlValidCtxtPtr ctxt ,
xmlDtdPtr dtd ,
const CHAR * name ,
const CHAR * PublicID ,
const CHAR * SystemID ) ;
1999-02-22 13:33:01 +03:00
xmlNotationTablePtr xmlCopyNotationTable ( xmlNotationTablePtr table ) ;
1999-08-30 01:02:19 +04:00
void xmlFreeNotationTable ( xmlNotationTablePtr table ) ;
void xmlDumpNotationTable ( xmlBufferPtr buf ,
xmlNotationTablePtr table ) ;
1999-02-22 13:33:01 +03:00
/* Element Content */
1999-08-30 15:23:51 +04:00
xmlElementContentPtr xmlNewElementContent ( CHAR * name ,
xmlElementContentType type ) ;
1999-02-22 13:33:01 +03:00
xmlElementContentPtr xmlCopyElementContent ( xmlElementContentPtr content ) ;
1999-08-30 01:02:19 +04:00
void xmlFreeElementContent ( xmlElementContentPtr cur ) ;
1999-02-22 13:33:01 +03:00
/* Element */
1999-08-30 01:02:19 +04:00
xmlElementPtr xmlAddElementDecl ( xmlValidCtxtPtr ctxt ,
xmlDtdPtr dtd ,
const CHAR * name ,
1999-08-30 15:23:51 +04:00
xmlElementContentType type ,
1999-08-30 01:02:19 +04:00
xmlElementContentPtr content ) ;
xmlElementTablePtr xmlCopyElementTable ( xmlElementTablePtr table ) ;
void xmlFreeElementTable ( xmlElementTablePtr table ) ;
void xmlDumpElementTable ( xmlBufferPtr buf ,
xmlElementTablePtr table ) ;
1999-02-22 13:33:01 +03:00
/* Enumeration */
1999-08-30 01:02:19 +04:00
xmlEnumerationPtr xmlCreateEnumeration ( CHAR * name ) ;
void xmlFreeEnumeration ( xmlEnumerationPtr cur ) ;
xmlEnumerationPtr xmlCopyEnumeration ( xmlEnumerationPtr cur ) ;
1999-02-22 13:33:01 +03:00
/* Attribute */
1999-08-30 01:02:19 +04:00
xmlAttributePtr xmlAddAttributeDecl ( xmlValidCtxtPtr ctxt ,
xmlDtdPtr dtd ,
const CHAR * elem ,
const CHAR * name ,
1999-08-30 15:23:51 +04:00
xmlAttributeType type ,
xmlAttributeDefault def ,
1999-08-30 01:02:19 +04:00
const CHAR * defaultValue ,
xmlEnumerationPtr tree ) ;
xmlAttributeTablePtr xmlCopyAttributeTable ( xmlAttributeTablePtr table ) ;
void xmlFreeAttributeTable ( xmlAttributeTablePtr table ) ;
void xmlDumpAttributeTable ( xmlBufferPtr buf ,
xmlAttributeTablePtr table ) ;
1999-02-01 01:15:06 +03:00
1999-08-16 03:32:28 +04:00
/* IDs */
1999-08-30 01:02:19 +04:00
xmlIDPtr xmlAddID ( xmlValidCtxtPtr ctxt ,
xmlDocPtr doc ,
const CHAR * value ,
xmlAttrPtr attr ) ;
xmlIDTablePtr xmlCopyIDTable ( xmlIDTablePtr table ) ;
void xmlFreeIDTable ( xmlIDTablePtr table ) ;
xmlAttrPtr xmlGetID ( xmlDocPtr doc ,
const CHAR * ID ) ;
int xmlIsID ( xmlDocPtr doc ,
xmlNodePtr elem ,
xmlAttrPtr attr ) ;
1999-08-16 03:32:28 +04:00
1999-08-10 23:04:08 +04:00
/**
* The public function calls related to validity checking
*/
1999-08-30 01:02:19 +04:00
int xmlValidateRoot ( xmlValidCtxtPtr ctxt ,
xmlDocPtr doc ) ;
int xmlValidateElementDecl ( xmlValidCtxtPtr ctxt ,
xmlDocPtr doc ,
xmlElementPtr elem ) ;
int xmlValidateAttributeDecl ( xmlValidCtxtPtr ctxt ,
xmlDocPtr doc ,
xmlAttributePtr attr ) ;
int xmlValidateAttributeValue ( xmlAttributeType type ,
const CHAR * value ) ;
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 xmlValidateNotationUse ( xmlValidCtxtPtr ctxt ,
xmlDocPtr doc ,
const CHAR * notationName ) ;
int xmlIsMixedElement ( xmlDocPtr doc ,
const CHAR * name ) ;
xmlAttributePtr xmlGetDtdAttrDesc ( xmlDtdPtr dtd ,
const CHAR * elem ,
const CHAR * name ) ;
xmlNotationPtr xmlGetDtdNotationDesc ( xmlDtdPtr dtd ,
const CHAR * name ) ;
xmlElementPtr xmlGetDtdElementDesc ( xmlDtdPtr dtd ,
const CHAR * name ) ;
1999-08-30 15:23:51 +04:00
# ifdef __cplusplus
}
# endif
1999-01-17 22:11:59 +03:00
# endif /* __XML_VALID_H__ */