xmltok.h
Go to the documentation of this file.00001
00002
00003
00004
00005
#ifndef XmlTok_INCLUDED
00006 #define XmlTok_INCLUDED 1
00007
00008
#ifdef __cplusplus
00009
extern "C" {
00010
#endif
00011
00012
00013 #define XML_TOK_TRAILING_RSQB -5
00014
00015
00016
00017
00018 #define XML_TOK_NONE -4
00019 #define XML_TOK_TRAILING_CR -3
00020
00021 #define XML_TOK_PARTIAL_CHAR -2
00022 #define XML_TOK_PARTIAL -1
00023 #define XML_TOK_INVALID 0
00024
00025
00026
00027
00028 #define XML_TOK_START_TAG_WITH_ATTS 1
00029 #define XML_TOK_START_TAG_NO_ATTS 2
00030 #define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3
00031 #define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
00032 #define XML_TOK_END_TAG 5
00033 #define XML_TOK_DATA_CHARS 6
00034 #define XML_TOK_DATA_NEWLINE 7
00035 #define XML_TOK_CDATA_SECT_OPEN 8
00036 #define XML_TOK_ENTITY_REF 9
00037 #define XML_TOK_CHAR_REF 10
00038
00039
00040
00041
00042 #define XML_TOK_PI 11
00043 #define XML_TOK_XML_DECL 12
00044 #define XML_TOK_COMMENT 13
00045 #define XML_TOK_BOM 14
00046
00047
00048 #define XML_TOK_PROLOG_S 15
00049 #define XML_TOK_DECL_OPEN 16
00050 #define XML_TOK_DECL_CLOSE 17
00051 #define XML_TOK_NAME 18
00052 #define XML_TOK_NMTOKEN 19
00053 #define XML_TOK_POUND_NAME 20
00054 #define XML_TOK_OR 21
00055 #define XML_TOK_PERCENT 22
00056 #define XML_TOK_OPEN_PAREN 23
00057 #define XML_TOK_CLOSE_PAREN 24
00058 #define XML_TOK_OPEN_BRACKET 25
00059 #define XML_TOK_CLOSE_BRACKET 26
00060 #define XML_TOK_LITERAL 27
00061 #define XML_TOK_PARAM_ENTITY_REF 28
00062 #define XML_TOK_INSTANCE_START 29
00063
00064
00065 #define XML_TOK_NAME_QUESTION 30
00066 #define XML_TOK_NAME_ASTERISK 31
00067 #define XML_TOK_NAME_PLUS 32
00068 #define XML_TOK_COND_SECT_OPEN 33
00069 #define XML_TOK_COND_SECT_CLOSE 34
00070 #define XML_TOK_CLOSE_PAREN_QUESTION 35
00071 #define XML_TOK_CLOSE_PAREN_ASTERISK 36
00072 #define XML_TOK_CLOSE_PAREN_PLUS 37
00073 #define XML_TOK_COMMA 38
00074
00075
00076 #define XML_TOK_ATTRIBUTE_VALUE_S 39
00077
00078
00079 #define XML_TOK_CDATA_SECT_CLOSE 40
00080
00081
00082
00083
00084 #define XML_TOK_PREFIXED_NAME 41
00085
00086
#ifdef XML_DTD
00087
#define XML_TOK_IGNORE_SECT 42
00088
#endif
00089
00090
#ifdef XML_DTD
00091
#define XML_N_STATES 4
00092
#else
00093 #define XML_N_STATES 3
00094
#endif
00095
00096 #define XML_PROLOG_STATE 0
00097 #define XML_CONTENT_STATE 1
00098 #define XML_CDATA_SECTION_STATE 2
00099
#ifdef XML_DTD
00100
#define XML_IGNORE_SECTION_STATE 3
00101
#endif
00102
00103 #define XML_N_LITERAL_TYPES 2
00104 #define XML_ATTRIBUTE_VALUE_LITERAL 0
00105 #define XML_ENTITY_VALUE_LITERAL 1
00106
00107
00108 #define XML_UTF8_ENCODE_MAX 4
00109
00110 #define XML_UTF16_ENCODE_MAX 2
00111
00112 typedef struct position {
00113
00114 unsigned long lineNumber;
00115 unsigned long columnNumber;
00116 }
POSITION;
00117
00118 typedef struct {
00119 const char *name;
00120 const char *valuePtr;
00121 const char *valueEnd;
00122 char normalized;
00123 }
ATTRIBUTE;
00124
00125
struct encoding;
00126 typedef struct encoding ENCODING;
00127
00128 struct encoding {
00129 int (*
scanners[
XML_N_STATES])(
const ENCODING *,
00130
const char *,
00131
const char *,
00132
const char **);
00133 int (*
literalScanners[
XML_N_LITERAL_TYPES])(
const ENCODING *,
00134
const char *,
00135
const char *,
00136
const char **);
00137 int (*
sameName)(
const ENCODING *,
00138
const char *,
const char *);
00139 int (*
nameMatchesAscii)(
const ENCODING *,
00140
const char *,
const char *,
const char *);
00141 int (*
nameLength)(
const ENCODING *,
const char *);
00142
const char *(*skipS)(
const ENCODING *,
const char *);
00143 int (*
getAtts)(
const ENCODING *enc,
const char *ptr,
00144
int attsMax,
ATTRIBUTE *atts);
00145 int (*
charRefNumber)(
const ENCODING *enc,
const char *ptr);
00146 int (*
predefinedEntityName)(
const ENCODING *,
const char *,
const char *);
00147 void (*
updatePosition)(
const ENCODING *,
00148
const char *ptr,
00149
const char *end,
00150
POSITION *);
00151 int (*
isPublicId)(
const ENCODING *enc,
const char *ptr,
const char *end,
00152
const char **badPtr);
00153 void (*
utf8Convert)(
const ENCODING *enc,
00154
const char **fromP,
00155
const char *fromLim,
00156
char **toP,
00157
const char *toLim);
00158 void (*
utf16Convert)(
const ENCODING *enc,
00159
const char **fromP,
00160
const char *fromLim,
00161
unsigned short **toP,
00162
const unsigned short *toLim);
00163 int minBytesPerChar;
00164 char isUtf8;
00165 char isUtf16;
00166 };
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 #define XmlTok(enc, state, ptr, end, nextTokPtr) \
00191
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
00192
00193 #define XmlPrologTok(enc, ptr, end, nextTokPtr) \
00194
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
00195
00196 #define XmlContentTok(enc, ptr, end, nextTokPtr) \
00197
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
00198
00199 #define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
00200
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
00201
00202
#ifdef XML_DTD
00203
00204
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
00205
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
00206
00207
#endif
00208
00209
00210
00211
00212 #define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
00213
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
00214
00215 #define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
00216
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
00217
00218 #define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
00219
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
00220
00221 #define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
00222
00223 #define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
00224
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
00225
00226 #define XmlNameLength(enc, ptr) \
00227
(((enc)->nameLength)(enc, ptr))
00228
00229 #define XmlSkipS(enc, ptr) \
00230
(((enc)->skipS)(enc, ptr))
00231
00232 #define XmlGetAttributes(enc, ptr, attsMax, atts) \
00233
(((enc)->getAtts)(enc, ptr, attsMax, atts))
00234
00235 #define XmlCharRefNumber(enc, ptr) \
00236
(((enc)->charRefNumber)(enc, ptr))
00237
00238 #define XmlPredefinedEntityName(enc, ptr, end) \
00239
(((enc)->predefinedEntityName)(enc, ptr, end))
00240
00241 #define XmlUpdatePosition(enc, ptr, end, pos) \
00242
(((enc)->updatePosition)(enc, ptr, end, pos))
00243
00244 #define XmlIsPublicId(enc, ptr, end, badPtr) \
00245
(((enc)->isPublicId)(enc, ptr, end, badPtr))
00246
00247 #define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
00248
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
00249
00250 #define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
00251
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
00252
00253 typedef struct {
00254 ENCODING initEnc;
00255 const ENCODING **encPtr;
00256 }
INIT_ENCODING;
00257
00258
int XmlParseXmlDecl(
int isGeneralTextEntity,
00259
const ENCODING *enc,
00260
const char *ptr,
00261
const char *end,
00262
const char **badPtr,
00263
const char **versionPtr,
00264
const char **versionEndPtr,
00265
const char **encodingNamePtr,
00266
const ENCODING **namedEncodingPtr,
00267
int *standalonePtr);
00268
00269
int XmlInitEncoding(
INIT_ENCODING *,
const ENCODING **,
const char *name);
00270
const ENCODING *
XmlGetUtf8InternalEncoding(
void);
00271
const ENCODING *
XmlGetUtf16InternalEncoding(
void);
00272
int XmlUtf8Encode(
int charNumber,
char *buf);
00273
int XmlUtf16Encode(
int charNumber,
unsigned short *buf);
00274
00275
int XmlSizeOfUnknownEncoding(
void);
00276
ENCODING *
00277
XmlInitUnknownEncoding(
void *mem,
00278
int *table,
00279
int (*conv)(
void *userData,
const char *p),
00280
void *userData);
00281
00282
int XmlParseXmlDeclNS(
int isGeneralTextEntity,
00283
const ENCODING *enc,
00284
const char *ptr,
00285
const char *end,
00286
const char **badPtr,
00287
const char **versionPtr,
00288
const char **versionEndPtr,
00289
const char **encodingNamePtr,
00290
const ENCODING **namedEncodingPtr,
00291
int *standalonePtr);
00292
int XmlInitEncodingNS(
INIT_ENCODING *,
const ENCODING **,
const char *name);
00293
const ENCODING *
XmlGetUtf8InternalEncodingNS(
void);
00294
const ENCODING *
XmlGetUtf16InternalEncodingNS(
void);
00295
ENCODING *
00296
XmlInitUnknownEncodingNS(
void *mem,
00297
int *table,
00298
int (*conv)(
void *userData,
const char *p),
00299
void *userData);
00300
#ifdef __cplusplus
00301
}
00302
#endif
00303
00304
#endif
Generated on Thu Apr 30 02:30:52 2009 for ACS C++ API by
1.3.8