2003-10-20 05:48:46 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2004-01-09 01:33:29 +08:00
|
|
|
| PHP Version 5 |
|
2003-10-20 05:48:46 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2012-01-01 21:15:04 +08:00
|
|
|
| Copyright (c) 1997-2012 The PHP Group |
|
2003-10-20 05:48:46 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 20:51:34 +08:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
2003-10-20 05:48:46 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 20:51:34 +08:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
2003-10-20 05:48:46 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Shane Caraveo <shane@php.net> |
|
|
|
|
| Wez Furlong <wez@thebrainroom.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef PHP_LIBXML_H
|
|
|
|
#define PHP_LIBXML_H
|
|
|
|
|
2005-04-21 19:19:29 +08:00
|
|
|
#if HAVE_LIBXML
|
2003-10-20 05:48:46 +08:00
|
|
|
extern zend_module_entry libxml_module_entry;
|
|
|
|
#define libxml_module_ptr &libxml_module_entry
|
|
|
|
|
|
|
|
#ifdef PHP_WIN32
|
2008-01-30 17:41:12 +08:00
|
|
|
# define PHP_LIBXML_API __declspec(dllexport)
|
|
|
|
#elif defined(__GNUC__) && __GNUC__ >= 4
|
|
|
|
# define PHP_LIBXML_API __attribute__ ((visibility("default")))
|
2003-10-20 05:48:46 +08:00
|
|
|
#else
|
2008-01-30 17:41:12 +08:00
|
|
|
# define PHP_LIBXML_API
|
2003-10-20 05:48:46 +08:00
|
|
|
#endif
|
|
|
|
|
2003-12-10 05:55:02 +08:00
|
|
|
#include "ext/standard/php_smart_str.h"
|
2003-10-26 23:53:20 +08:00
|
|
|
#include <libxml/tree.h>
|
2003-10-20 05:48:46 +08:00
|
|
|
|
2005-09-08 18:37:57 +08:00
|
|
|
#define LIBXML_SAVE_NOEMPTYTAG 1<<2
|
|
|
|
|
2006-06-16 02:33:09 +08:00
|
|
|
ZEND_BEGIN_MODULE_GLOBALS(libxml)
|
2003-10-20 05:48:46 +08:00
|
|
|
zval *stream_context;
|
2004-01-10 21:23:58 +08:00
|
|
|
smart_str error_buffer;
|
2005-02-10 23:52:38 +08:00
|
|
|
zend_llist *error_list;
|
2011-08-29 13:00:26 +08:00
|
|
|
struct _php_libxml_entity_resolver {
|
|
|
|
zend_fcall_info fci;
|
|
|
|
zend_fcall_info_cache fcc;
|
|
|
|
} entity_loader;
|
2006-06-16 02:33:09 +08:00
|
|
|
ZEND_END_MODULE_GLOBALS(libxml)
|
2003-10-20 05:48:46 +08:00
|
|
|
|
2006-05-23 01:09:05 +08:00
|
|
|
typedef struct _libxml_doc_props {
|
|
|
|
int formatoutput;
|
|
|
|
int validateonparse;
|
|
|
|
int resolveexternals;
|
|
|
|
int preservewhitespace;
|
|
|
|
int substituteentities;
|
|
|
|
int stricterror;
|
|
|
|
int recover;
|
|
|
|
HashTable *classmap;
|
|
|
|
} libxml_doc_props;
|
|
|
|
|
2003-10-26 23:53:20 +08:00
|
|
|
typedef struct _php_libxml_ref_obj {
|
|
|
|
void *ptr;
|
|
|
|
int refcount;
|
2006-05-23 01:09:05 +08:00
|
|
|
libxml_doc_props *doc_props;
|
2003-10-26 23:53:20 +08:00
|
|
|
} php_libxml_ref_obj;
|
|
|
|
|
|
|
|
typedef struct _php_libxml_node_ptr {
|
|
|
|
xmlNodePtr node;
|
|
|
|
int refcount;
|
|
|
|
void *_private;
|
|
|
|
} php_libxml_node_ptr;
|
|
|
|
|
|
|
|
typedef struct _php_libxml_node_object {
|
|
|
|
zend_object std;
|
|
|
|
php_libxml_node_ptr *node;
|
|
|
|
php_libxml_ref_obj *document;
|
|
|
|
HashTable *properties;
|
|
|
|
} php_libxml_node_object;
|
|
|
|
|
2004-03-01 20:09:24 +08:00
|
|
|
typedef void * (*php_libxml_export_node) (zval *object TSRMLS_DC);
|
|
|
|
|
2007-08-01 19:43:05 +08:00
|
|
|
PHP_LIBXML_API int php_libxml_increment_node_ptr(php_libxml_node_object *object, xmlNodePtr node, void *private_data TSRMLS_DC);
|
|
|
|
PHP_LIBXML_API int php_libxml_decrement_node_ptr(php_libxml_node_object *object TSRMLS_DC);
|
2005-02-10 23:52:38 +08:00
|
|
|
PHP_LIBXML_API int php_libxml_increment_doc_ref(php_libxml_node_object *object, xmlDocPtr docp TSRMLS_DC);
|
|
|
|
PHP_LIBXML_API int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC);
|
2004-03-01 20:09:24 +08:00
|
|
|
PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC);
|
|
|
|
PHP_LIBXML_API int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function);
|
2003-10-26 23:53:20 +08:00
|
|
|
/* When an explicit freeing of node and children is required */
|
2008-07-22 18:30:38 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_node_free_resource(xmlNodePtr node TSRMLS_DC);
|
2003-10-26 23:53:20 +08:00
|
|
|
/* When object dtor is called as node may still be referenced */
|
2008-07-22 18:30:38 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC);
|
2004-07-25 20:00:28 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...);
|
2008-07-22 18:30:38 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_ctx_warning(void *ctx, const char *msg, ...);
|
|
|
|
PHP_LIBXML_API void php_libxml_ctx_error(void *ctx, const char *msg, ...);
|
2004-09-08 18:15:41 +08:00
|
|
|
PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s);
|
2004-11-09 16:13:35 +08:00
|
|
|
PHP_LIBXML_API zval *php_libxml_switch_context(zval *context TSRMLS_DC);
|
2005-02-21 05:49:45 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg TSRMLS_DC);
|
2003-10-20 05:48:46 +08:00
|
|
|
|
2005-04-21 19:19:29 +08:00
|
|
|
/* Init/shutdown functions*/
|
2007-07-21 08:51:17 +08:00
|
|
|
PHP_LIBXML_API void php_libxml_initialize(void);
|
|
|
|
PHP_LIBXML_API void php_libxml_shutdown(void);
|
2003-10-20 05:48:46 +08:00
|
|
|
|
|
|
|
#ifdef ZTS
|
2006-06-16 02:33:09 +08:00
|
|
|
#define LIBXML(v) TSRMG(libxml_globals_id, zend_libxml_globals *, v)
|
2003-10-20 05:48:46 +08:00
|
|
|
#else
|
|
|
|
#define LIBXML(v) (libxml_globals.v)
|
|
|
|
#endif
|
|
|
|
|
2005-04-21 19:19:29 +08:00
|
|
|
#else /* HAVE_LIBXML */
|
|
|
|
#define libxml_module_ptr NULL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define phpext_libxml_ptr libxml_module_ptr
|
2003-10-20 07:17:56 +08:00
|
|
|
|
2003-10-20 05:48:46 +08:00
|
|
|
#endif /* PHP_LIBXML_H */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|