1 /*===========================================================================
2   dtdvalid.h
3     see parsifal.h for copyright info
4 ===========================================================================*/
5 #ifndef DTDVALID__H
6 #define DTDVALID__H
7 
8 typedef struct tagXMLDTDVALIDATOR {
9     LPXMLPARSER parser;
10     LPXMLVECTOR ElementDecls, fsa, ContextStack;
11     LPXMLPOOL StatePool, cpNodesPool;
12     LPXMLHTABLE ElementTable, idTable;
13     XML_EVENT_HANDLER endDTDHandler;
14     XML_CHARACTERS_HANDLER charactersHandler;
15     XML_CHARACTERS_HANDLER ignorableWhitespaceHandler;
16     XML_START_ELEMENT_HANDLER startElementHandler;
17     XML_END_ELEMENT_HANDLER endElementHandler;
18     XML_ELEMENTDECL_HANDLER elementDeclHandler;
19     XML_CHARACTERS_HANDLER charactersHandlerFilter;
20     XML_CHARACTERS_HANDLER ignorableWhitespaceHandlerFilter;
21     XML_START_ELEMENT_HANDLER startElementHandlerFilter;
22     XML_END_ELEMENT_HANDLER endElementHandlerFilter;
23     void *UserData;
24     int UserFlag;
25     int ErrorCode;
26     int ErrorLine;
27     int ErrorColumn;
28     XMLCH ErrorString[128];
29 } XMLDTDVALIDATOR, *LPXMLDTDVALIDATOR;
30 
31 #define ERR_XMLDTDV_MEMORY_ALLOC 1
32 #define ERR_XMLDTDV_ELEMENT_NOT_ALLOWED 2
33 #define ERR_XMLDTDV_UNDECLARED_ELEMENT 3
34 #define ERR_XMLDTDV_PCDATA_NOT_ALLOWED 4
35 #define ERR_XMLDTDV_CONTENT_MODEL_CANNOT_END 5
36 #define ERR_XMLDTDV_REQUIRED_ATT_MISSING 6
37 #define ERR_XMLDTDV_UNDECLARED_ATT 7
38 #define ERR_XMLDTDV_ILLEGAL_ATT_VALUE 8
39 #define ERR_XMLDTDV_ROOTELEMENT_MISMATCH 9
40 #define ERR_XMLDTDV_DUPLICATE_ID 10
41 #define ERR_XMLDTDV_CANNOT_RESOLVE_IDREF 11
42 
43 #ifndef UTF8LEN
44 #define UTF8LEN(c,o) \
45 if (!(*c & 0x80)) o = 1; \
46 else if ((unsigned int)*c <= 0xdf) o = 2; \
47 else if ((unsigned int)*c <= 0xef) o = 3; \
48 else if ((unsigned int)*c <= 0xf7) o = 4; \
49 else if ((unsigned int)*c <= 0xfb) o = 5; \
50 else o = 6;
51 #endif
52 
53 #ifdef __cplusplus
54    extern "C" {
55 #endif
56 
57 LPXMLDTDVALIDATOR XMLAPI XMLParser_CreateDTDValidator(void);
58 void XMLAPI XMLParser_FreeDTDValidator(LPXMLDTDVALIDATOR dtd);
59 int XMLAPI XMLParser_ParseValidateDTD(LPXMLDTDVALIDATOR dtd,
60         LPXMLPARSER parser, LPFNINPUTSRC inputSrc, void *inputData, const XMLCH *encoding);
61 int XMLAPI DTDValidate_Characters(void *UserData,
62         const XMLCH *chars, int cbSize);
63 int XMLAPI DTDValidate_IgnorableWhitespace(void *UserData,
64         const XMLCH *chars, int cbSize);
65 int XMLAPI DTDValidate_EndElement(void *UserData, const XMLCH *uri,
66         const XMLCH *localName, const XMLCH *qName);
67 int XMLAPI DTDValidate_StartElement(void *UserData, const XMLCH *uri,
68         const XMLCH *localName, const XMLCH *qName, LPXMLVECTOR atts);
69 
70 #ifdef __cplusplus
71    }
72 #endif /* __cplusplus */
73 #endif /* DTDVALID__H */
74