• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Stuff to export relevant 'expat' entry points from pyexpat to other
2  * parser modules, such as cElementTree. */
3 
4 /* note: you must import expat.h before importing this module! */
5 
6 #define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.1"
7 #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
8 
9 struct PyExpat_CAPI
10 {
11     char* magic; /* set to PyExpat_CAPI_MAGIC */
12     int size; /* set to sizeof(struct PyExpat_CAPI) */
13     int MAJOR_VERSION;
14     int MINOR_VERSION;
15     int MICRO_VERSION;
16     /* pointers to selected expat functions.  add new functions at
17        the end, if needed */
18     const XML_LChar * (*ErrorString)(enum XML_Error code);
19     enum XML_Error (*GetErrorCode)(XML_Parser parser);
20     XML_Size (*GetErrorColumnNumber)(XML_Parser parser);
21     XML_Size (*GetErrorLineNumber)(XML_Parser parser);
22     enum XML_Status (*Parse)(
23         XML_Parser parser, const char *s, int len, int isFinal);
24     XML_Parser (*ParserCreate_MM)(
25         const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite,
26         const XML_Char *namespaceSeparator);
27     void (*ParserFree)(XML_Parser parser);
28     void (*SetCharacterDataHandler)(
29         XML_Parser parser, XML_CharacterDataHandler handler);
30     void (*SetCommentHandler)(
31         XML_Parser parser, XML_CommentHandler handler);
32     void (*SetDefaultHandlerExpand)(
33         XML_Parser parser, XML_DefaultHandler handler);
34     void (*SetElementHandler)(
35         XML_Parser parser, XML_StartElementHandler start,
36         XML_EndElementHandler end);
37     void (*SetNamespaceDeclHandler)(
38         XML_Parser parser, XML_StartNamespaceDeclHandler start,
39         XML_EndNamespaceDeclHandler end);
40     void (*SetProcessingInstructionHandler)(
41         XML_Parser parser, XML_ProcessingInstructionHandler handler);
42     void (*SetUnknownEncodingHandler)(
43         XML_Parser parser, XML_UnknownEncodingHandler handler,
44         void *encodingHandlerData);
45     void (*SetUserData)(XML_Parser parser, void *userData);
46     void (*SetStartDoctypeDeclHandler)(XML_Parser parser,
47                                        XML_StartDoctypeDeclHandler start);
48     enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
49     int (*DefaultUnknownEncodingHandler)(
50         void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
51     /* might be none for expat < 2.1.0 */
52     int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
53     /* always add new stuff to the end! */
54 };
55 
56