Back to index

php5  5.3.10
php_libxml.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Shane Caraveo <shane@php.net>                               |
00016    |          Wez Furlong <wez@thebrainroom.com>                          |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: php_libxml.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef PHP_LIBXML_H
00023 #define PHP_LIBXML_H
00024 
00025 #if HAVE_LIBXML
00026 extern zend_module_entry libxml_module_entry;
00027 #define libxml_module_ptr &libxml_module_entry
00028 
00029 #ifdef PHP_WIN32
00030 #      define PHP_LIBXML_API __declspec(dllexport)
00031 #elif defined(__GNUC__) && __GNUC__ >= 4
00032 #      define PHP_LIBXML_API __attribute__ ((visibility("default")))
00033 #else
00034 #      define PHP_LIBXML_API
00035 #endif
00036 
00037 #include "ext/standard/php_smart_str.h"
00038 #include <libxml/tree.h>
00039 
00040 #define LIBXML_SAVE_NOEMPTYTAG 1<<2
00041 
00042 ZEND_BEGIN_MODULE_GLOBALS(libxml)
00043        zval *stream_context;
00044        smart_str error_buffer;
00045        zend_llist *error_list;
00046 ZEND_END_MODULE_GLOBALS(libxml)
00047 
00048 typedef struct _libxml_doc_props {
00049        int formatoutput;
00050        int validateonparse;
00051        int resolveexternals;
00052        int preservewhitespace;
00053        int substituteentities;
00054        int stricterror;
00055        int recover;
00056        HashTable *classmap;
00057 } libxml_doc_props;
00058 
00059 typedef struct _php_libxml_ref_obj {
00060        void *ptr;
00061        int   refcount;
00062        libxml_doc_props *doc_props;
00063 } php_libxml_ref_obj;
00064 
00065 typedef struct _php_libxml_node_ptr {
00066        xmlNodePtr node;
00067        int    refcount;
00068        void *_private;
00069 } php_libxml_node_ptr;
00070 
00071 typedef struct _php_libxml_node_object {
00072        zend_object  std;
00073        php_libxml_node_ptr *node;
00074        php_libxml_ref_obj *document;
00075        HashTable *properties;
00076 } php_libxml_node_object;
00077 
00078 typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
00079 
00080 PHP_LIBXML_API int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
00081 PHP_LIBXML_API int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
00082 PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
00083 PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
00084 PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
00085 PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
00086 /* When an explicit freeing of node and children is required */
00087 PHP_LIBXML_API void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
00088 /* When object dtor is called as node may still be referenced */
00089 PHP_LIBXML_API void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
00090 PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
00091 PHP_LIBXML_API void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
00092 PHP_LIBXML_API void php_libxml_ctx_error(void *ctx, const char *msg, ...);
00093 PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
00094 PHP_LIBXML_API zval *php_libxml_switch_context(zval *context TSRMLS_DC);
00095 PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg TSRMLS_DC);
00096 
00097 /* Init/shutdown functions*/
00098 PHP_LIBXML_API void php_libxml_initialize(void);
00099 PHP_LIBXML_API void php_libxml_shutdown(void);
00100 
00101 #ifdef ZTS
00102 #define LIBXML(v) TSRMG(libxml_globals_id, zend_libxml_globals *, v)
00103 #else
00104 #define LIBXML(v) (libxml_globals.v)
00105 #endif
00106 
00107 #else /* HAVE_LIBXML */
00108 #define libxml_module_ptr NULL
00109 #endif
00110 
00111 #define phpext_libxml_ptr libxml_module_ptr
00112 
00113 #endif /* PHP_LIBXML_H */
00114 
00115 /*
00116  * Local variables:
00117  * tab-width: 4
00118  * c-basic-offset: 4
00119  * End:
00120  */