1 /*
2 expat XML parser
3 Copyright (C) 1998 James Clark
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 
20 #ifndef XmlRole_INCLUDED
21 #define XmlRole_INCLUDED 1
22 
23 #include "xmltok.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 enum {
30   XML_ROLE_ERROR = -1,
31   XML_ROLE_NONE = 0,
32   XML_ROLE_XML_DECL,
33   XML_ROLE_INSTANCE_START,
34   XML_ROLE_DOCTYPE_NAME,
35   XML_ROLE_DOCTYPE_SYSTEM_ID,
36   XML_ROLE_DOCTYPE_PUBLIC_ID,
37   XML_ROLE_DOCTYPE_CLOSE,
38   XML_ROLE_GENERAL_ENTITY_NAME,
39   XML_ROLE_PARAM_ENTITY_NAME,
40   XML_ROLE_ENTITY_VALUE,
41   XML_ROLE_ENTITY_SYSTEM_ID,
42   XML_ROLE_ENTITY_PUBLIC_ID,
43   XML_ROLE_ENTITY_NOTATION_NAME,
44   XML_ROLE_NOTATION_NAME,
45   XML_ROLE_NOTATION_SYSTEM_ID,
46   XML_ROLE_NOTATION_NO_SYSTEM_ID,
47   XML_ROLE_NOTATION_PUBLIC_ID,
48   XML_ROLE_ATTRIBUTE_NAME,
49   XML_ROLE_ATTRIBUTE_TYPE_CDATA,
50   XML_ROLE_ATTRIBUTE_TYPE_ID,
51   XML_ROLE_ATTRIBUTE_TYPE_IDREF,
52   XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
53   XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
54   XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
55   XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
56   XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
57   XML_ROLE_ATTRIBUTE_ENUM_VALUE,
58   XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
59   XML_ROLE_ATTLIST_ELEMENT_NAME,
60   XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
61   XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
62   XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
63   XML_ROLE_FIXED_ATTRIBUTE_VALUE,
64   XML_ROLE_ELEMENT_NAME,
65   XML_ROLE_CONTENT_ANY,
66   XML_ROLE_CONTENT_EMPTY,
67   XML_ROLE_CONTENT_PCDATA,
68   XML_ROLE_GROUP_OPEN,
69   XML_ROLE_GROUP_CLOSE,
70   XML_ROLE_GROUP_CLOSE_REP,
71   XML_ROLE_GROUP_CLOSE_OPT,
72   XML_ROLE_GROUP_CLOSE_PLUS,
73   XML_ROLE_GROUP_CHOICE,
74   XML_ROLE_GROUP_SEQUENCE,
75   XML_ROLE_CONTENT_ELEMENT,
76   XML_ROLE_CONTENT_ELEMENT_REP,
77   XML_ROLE_CONTENT_ELEMENT_OPT,
78   XML_ROLE_CONTENT_ELEMENT_PLUS,
79 #ifdef XML_DTD
80   XML_ROLE_TEXT_DECL,
81   XML_ROLE_IGNORE_SECT,
82   XML_ROLE_INNER_PARAM_ENTITY_REF,
83 #endif /* XML_DTD */
84   XML_ROLE_PARAM_ENTITY_REF
85 };
86 
87 typedef struct prolog_state {
88   int (*handler)(struct prolog_state *state,
89 	         int tok,
90 		 const char *ptr,
91 		 const char *end,
92 		 const ENCODING *enc);
93   unsigned level;
94 #ifdef XML_DTD
95   unsigned includeLevel;
96   int documentEntity;
97 #endif /* XML_DTD */
98 } PROLOG_STATE;
99 
100 void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
101 #ifdef XML_DTD
102 void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *);
103 #endif /* XML_DTD */
104 
105 #define XmlTokenRole(state, tok, ptr, end, enc) \
106  (((state)->handler)(state, tok, ptr, end, enc))
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* not XmlRole_INCLUDED */
113