You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.2 KiB

  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2006 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Shane Caraveo <shane@php.net> |
  16. | Wez Furlong <wez@thebrainroom.com> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_LIBXML_H
  21. #define PHP_LIBXML_H
  22. #if HAVE_LIBXML
  23. extern zend_module_entry libxml_module_entry;
  24. #define libxml_module_ptr &libxml_module_entry
  25. #ifdef PHP_WIN32
  26. #define PHP_LIBXML_API __declspec(dllexport)
  27. #else
  28. #define PHP_LIBXML_API
  29. #endif
  30. #include "ext/standard/php_smart_str.h"
  31. #include <libxml/tree.h>
  32. #define LIBXML_SAVE_NOEMPTYTAG 1<<2
  33. typedef struct {
  34. zval *stream_context;
  35. smart_str error_buffer;
  36. zend_llist *error_list;
  37. } php_libxml_globals;
  38. typedef struct _libxml_doc_props {
  39. int formatoutput;
  40. int validateonparse;
  41. int resolveexternals;
  42. int preservewhitespace;
  43. int substituteentities;
  44. int stricterror;
  45. int recover;
  46. HashTable *classmap;
  47. } libxml_doc_props;
  48. typedef struct _php_libxml_ref_obj {
  49. void *ptr;
  50. int refcount;
  51. libxml_doc_props *doc_props;
  52. } php_libxml_ref_obj;
  53. typedef struct _php_libxml_node_ptr {
  54. xmlNodePtr node;
  55. int refcount;
  56. void *_private;
  57. } php_libxml_node_ptr;
  58. typedef struct _php_libxml_node_object {
  59. zend_object std;
  60. php_libxml_node_ptr *node;
  61. php_libxml_ref_obj *document;
  62. HashTable *properties;
  63. } php_libxml_node_object;
  64. typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
  65. PHP_FUNCTION(libxml_set_streams_context);
  66. PHP_FUNCTION(libxml_use_internal_errors);
  67. PHP_FUNCTION(libxml_get_last_error);
  68. PHP_FUNCTION(libxml_clear_errors);
  69. PHP_FUNCTION(libxml_get_errors);
  70. int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
  71. int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
  72. PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
  73. PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
  74. PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
  75. PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
  76. /* When an explicit freeing of node and children is required */
  77. void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
  78. /* When object dtor is called as node may still be referenced */
  79. void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
  80. PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
  81. void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
  82. void php_libxml_ctx_error(void *ctx, const char *msg, ...);
  83. PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
  84. PHP_LIBXML_API zval *php_libxml_switch_context(zval *context TSRMLS_DC);
  85. PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg TSRMLS_DC);
  86. /* Init/shutdown functions*/
  87. PHP_LIBXML_API void php_libxml_initialize();
  88. PHP_LIBXML_API void php_libxml_shutdown();
  89. #ifdef ZTS
  90. #define LIBXML(v) TSRMG(libxml_globals_id, php_libxml_globals *, v)
  91. #else
  92. #define LIBXML(v) (libxml_globals.v)
  93. #endif
  94. #else /* HAVE_LIBXML */
  95. #define libxml_module_ptr NULL
  96. #endif
  97. #define phpext_libxml_ptr libxml_module_ptr
  98. #endif /* PHP_LIBXML_H */
  99. /*
  100. * Local variables:
  101. * tab-width: 4
  102. * c-basic-offset: 4
  103. * End:
  104. */