pyexpat.h 2.4 KB

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