D:/Papagan/490.2006/490.2006/korsan/Papagan/490.2006/korsan/Papagan/xmlparse.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
00003 See the file copying.txt for copying permission.
00004 */
00005 
00006 #ifndef XmlParse_INCLUDED
00007 #define XmlParse_INCLUDED 1
00008 
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012 
00013 #ifndef XMLPARSEAPI
00014 #define XMLPARSEAPI /* as nothing */
00015 #endif
00016 
00017 typedef void *XML_Parser;
00018 
00019 #ifdef XML_UNICODE_WCHAR_T
00020 
00021 /* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
00022 uses Unicode. */
00023 /* Information is UTF-16 encoded as wchar_ts */
00024 
00025 #ifndef XML_UNICODE
00026 #define XML_UNICODE
00027 #endif
00028 
00029 #include <stddef.h>
00030 typedef wchar_t XML_Char;
00031 typedef wchar_t XML_LChar;
00032 
00033 #else /* not XML_UNICODE_WCHAR_T */
00034 
00035 #ifdef XML_UNICODE
00036 
00037 /* Information is UTF-16 encoded as unsigned shorts */
00038 typedef unsigned short XML_Char;
00039 typedef char XML_LChar;
00040 
00041 #else /* not XML_UNICODE */
00042 
00043 /* Information is UTF-8 encoded. */
00044 typedef char XML_Char;
00045 typedef char XML_LChar;
00046 
00047 #endif /* not XML_UNICODE */
00048 
00049 #endif /* not XML_UNICODE_WCHAR_T */
00050 
00051 
00055 XML_Parser XMLPARSEAPI
00056 XML_ParserCreate(const XML_Char *encoding);
00057 
00068 XML_Parser XMLPARSEAPI
00069 XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
00070 
00071 
00075 typedef void (*XML_StartElementHandler)(void *userData,
00076                                         const XML_Char *name,
00077                                         const XML_Char **atts);
00078 
00079 typedef void (*XML_EndElementHandler)(void *userData,
00080                                       const XML_Char *name);
00081 
00083 typedef void (*XML_CharacterDataHandler)(void *userData,
00084                                          const XML_Char *s,
00085                                          int len);
00086 
00088 typedef void (*XML_ProcessingInstructionHandler)(void *userData,
00089                                                  const XML_Char *target,
00090                                                  const XML_Char *data);
00091 
00093 typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
00094 
00095 typedef void (*XML_StartCdataSectionHandler)(void *userData);
00096 typedef void (*XML_EndCdataSectionHandler)(void *userData);
00097 
00111 typedef void (*XML_DefaultHandler)(void *userData,
00112                                    const XML_Char *s,
00113                                    int len);
00114 
00117 typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
00118                                             const XML_Char *doctypeName);
00119 
00120 /*** This is called for the start of the DOCTYPE declaration when the
00121 closing > is encountered, but after processing any external subset. */
00122 typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
00123 
00129 typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
00130                                               const XML_Char *entityName,
00131                                               const XML_Char *base,
00132                                               const XML_Char *systemId,
00133                                               const XML_Char *publicId,
00134                                               const XML_Char *notationName);
00135 
00140 typedef void (*XML_NotationDeclHandler)(void *userData,
00141                                         const XML_Char *notationName,
00142                                         const XML_Char *base,
00143                                         const XML_Char *systemId,
00144                                         const XML_Char *publicId);
00145 
00146 typedef void (*XML_ExternalParsedEntityDeclHandler)(void *userData,
00147                                                     const XML_Char *entityName,
00148                                                     const XML_Char *base,
00149                                                     const XML_Char *systemId,
00150                                                     const XML_Char *publicId);
00151 
00152 typedef void (*XML_InternalParsedEntityDeclHandler)(void *userData,
00153                                                     const XML_Char *entityName,
00154                                                     const XML_Char *replacementText,
00155                                                     int replacementTextLength);
00156 
00163 typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
00164                                               const XML_Char *prefix,
00165                                               const XML_Char *uri);
00166 
00167 typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
00168                                             const XML_Char *prefix);
00169 
00176 typedef int (*XML_NotStandaloneHandler)(void *userData);
00177 
00202 typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
00203                                             const XML_Char *context,
00204                                             const XML_Char *base,
00205                                             const XML_Char *systemId,
00206                                             const XML_Char *publicId);
00207 
00249 typedef struct {
00250   int map[256];
00251   void *data;
00252   int (*convert)(void *data, const char *s);
00253   void (*release)(void *data);
00254 } XML_Encoding;
00255 
00267 typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
00268                                           const XML_Char *name,
00269                                           XML_Encoding *info);
00270 
00271 void XMLPARSEAPI
00272 XML_SetElementHandler(XML_Parser parser,
00273                       XML_StartElementHandler start,
00274                       XML_EndElementHandler end);
00275 
00276 void XMLPARSEAPI
00277 XML_SetCharacterDataHandler(XML_Parser parser,
00278                             XML_CharacterDataHandler handler);
00279 
00280 void XMLPARSEAPI
00281 XML_SetProcessingInstructionHandler(XML_Parser parser,
00282                                     XML_ProcessingInstructionHandler handler);
00283 void XMLPARSEAPI
00284 XML_SetCommentHandler(XML_Parser parser,
00285                       XML_CommentHandler handler);
00286 
00287 void XMLPARSEAPI
00288 XML_SetCdataSectionHandler(XML_Parser parser,
00289                            XML_StartCdataSectionHandler start,
00290                            XML_EndCdataSectionHandler end);
00291 
00295 void XMLPARSEAPI
00296 XML_SetDefaultHandler(XML_Parser parser,
00297                       XML_DefaultHandler handler);
00298 
00302 void XMLPARSEAPI
00303 XML_SetDefaultHandlerExpand(XML_Parser parser,
00304                             XML_DefaultHandler handler);
00305 
00306 void XMLPARSEAPI
00307 XML_SetDoctypeDeclHandler(XML_Parser parser,
00308                           XML_StartDoctypeDeclHandler start,
00309                           XML_EndDoctypeDeclHandler end);
00310 
00311 void XMLPARSEAPI
00312 XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
00313                                  XML_UnparsedEntityDeclHandler handler);
00314 
00315 void XMLPARSEAPI
00316 XML_SetNotationDeclHandler(XML_Parser parser,
00317                            XML_NotationDeclHandler handler);
00318 
00319 void XMLPARSEAPI
00320 XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
00321                                        XML_ExternalParsedEntityDeclHandler handler);
00322 
00323 void XMLPARSEAPI
00324 XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
00325                                        XML_InternalParsedEntityDeclHandler handler);
00326 
00327 void XMLPARSEAPI
00328 XML_SetNamespaceDeclHandler(XML_Parser parser,
00329                             XML_StartNamespaceDeclHandler start,
00330                             XML_EndNamespaceDeclHandler end);
00331 
00332 void XMLPARSEAPI
00333 XML_SetNotStandaloneHandler(XML_Parser parser,
00334                             XML_NotStandaloneHandler handler);
00335 
00336 void XMLPARSEAPI
00337 XML_SetExternalEntityRefHandler(XML_Parser parser,
00338                                 XML_ExternalEntityRefHandler handler);
00339 
00343 void XMLPARSEAPI
00344 XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
00345 
00346 void XMLPARSEAPI
00347 XML_SetUnknownEncodingHandler(XML_Parser parser,
00348                               XML_UnknownEncodingHandler handler,
00349                               void *encodingHandlerData);
00350 
00354 void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
00355 
00357 void XMLPARSEAPI
00358 XML_SetUserData(XML_Parser parser, void *userData);
00359 
00361 #define XML_GetUserData(parser) (*(void **)(parser))
00362 
00367 int XMLPARSEAPI
00368 XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
00369 
00374 void XMLPARSEAPI
00375 XML_UseParserAsHandlerArg(XML_Parser parser);
00376 
00384 int XMLPARSEAPI
00385 XML_SetBase(XML_Parser parser, const XML_Char *base);
00386 
00387 const XML_Char XMLPARSEAPI *
00388 XML_GetBase(XML_Parser parser);
00389 
00396 int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
00397 
00402 int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
00403 
00407 int XMLPARSEAPI
00408 XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
00409 
00410 void XMLPARSEAPI *
00411 XML_GetBuffer(XML_Parser parser, int len);
00412 
00413 int XMLPARSEAPI
00414 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
00415 
00429 XML_Parser XMLPARSEAPI
00430 XML_ExternalEntityParserCreate(XML_Parser parser,
00431                                const XML_Char *context,
00432                                const XML_Char *encoding);
00433 
00434 enum XML_ParamEntityParsing {
00435   XML_PARAM_ENTITY_PARSING_NEVER,
00436   XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
00437   XML_PARAM_ENTITY_PARSING_ALWAYS
00438 };
00439 
00459 int XMLPARSEAPI
00460 XML_SetParamEntityParsing(XML_Parser parser,
00461                           enum XML_ParamEntityParsing parsing);
00462 
00463 enum XML_Error {
00464   XML_ERROR_NONE,
00465   XML_ERROR_NO_MEMORY,
00466   XML_ERROR_SYNTAX,
00467   XML_ERROR_NO_ELEMENTS,
00468   XML_ERROR_INVALID_TOKEN,
00469   XML_ERROR_UNCLOSED_TOKEN,
00470   XML_ERROR_PARTIAL_CHAR,
00471   XML_ERROR_TAG_MISMATCH,
00472   XML_ERROR_DUPLICATE_ATTRIBUTE,
00473   XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
00474   XML_ERROR_PARAM_ENTITY_REF,
00475   XML_ERROR_UNDEFINED_ENTITY,
00476   XML_ERROR_RECURSIVE_ENTITY_REF,
00477   XML_ERROR_ASYNC_ENTITY,
00478   XML_ERROR_BAD_CHAR_REF,
00479   XML_ERROR_BINARY_ENTITY_REF,
00480   XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
00481   XML_ERROR_MISPLACED_XML_PI,
00482   XML_ERROR_UNKNOWN_ENCODING,
00483   XML_ERROR_INCORRECT_ENCODING,
00484   XML_ERROR_UNCLOSED_CDATA_SECTION,
00485   XML_ERROR_EXTERNAL_ENTITY_HANDLING,
00486   XML_ERROR_NOT_STANDALONE
00487 };
00488 
00492 enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
00493 
00502 int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
00503 int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
00504 long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
00505 
00509 int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
00510 
00512 #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
00513 #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
00514 #define XML_GetErrorByteIndex XML_GetCurrentByteIndex
00515 
00517 void XMLPARSEAPI
00518 XML_ParserFree(XML_Parser parser);
00519 
00521 const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
00522 
00523 #ifdef __cplusplus
00524 }
00525 #endif
00526 
00527 #endif /* not XmlParse_INCLUDED */

Generated on Mon May 29 01:10:33 2006 for Papagan by  doxygen 1.4.6-NO