xref: /PHP-8.1/ext/simplexml/php_simplexml.h (revision 01b3fc03)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author: Sterling Hughes <sterling@php.net>                           |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_SIMPLEXML_H
18 #define PHP_SIMPLEXML_H
19 
20 extern zend_module_entry simplexml_module_entry;
21 #define phpext_simplexml_ptr &simplexml_module_entry
22 
23 #include "php_version.h"
24 #define PHP_SIMPLEXML_VERSION PHP_VERSION
25 
26 #ifdef ZTS
27 #include "TSRM.h"
28 #endif
29 
30 #include "ext/libxml/php_libxml.h"
31 #include <libxml/parser.h>
32 #include <libxml/parserInternals.h>
33 #include <libxml/tree.h>
34 #include <libxml/uri.h>
35 #include <libxml/xmlerror.h>
36 #include <libxml/xinclude.h>
37 #include <libxml/xpath.h>
38 #include <libxml/xpathInternals.h>
39 #include <libxml/xpointer.h>
40 #include <libxml/xmlschemas.h>
41 
42 PHP_MINIT_FUNCTION(simplexml);
43 PHP_MSHUTDOWN_FUNCTION(simplexml);
44 PHP_MINFO_FUNCTION(simplexml);
45 
46 typedef enum {
47 	SXE_ITER_NONE     = 0,
48 	SXE_ITER_ELEMENT  = 1,
49 	SXE_ITER_CHILD    = 2,
50 	SXE_ITER_ATTRLIST = 3
51 } SXE_ITER;
52 
53 typedef struct {
54 	php_libxml_node_ptr *node;
55 	php_libxml_ref_obj *document;
56 	HashTable *properties;
57 	xmlXPathContextPtr xpath;
58 	struct {
59 		xmlChar               *name;
60 		xmlChar               *nsprefix;
61 		int                   isprefix;
62 		SXE_ITER              type;
63 		zval                  data;
64 	} iter;
65 	zval tmp;
66 	zend_function *fptr_count;
67 	zend_object zo;
68 } php_sxe_object;
69 
70 #ifdef PHP_WIN32
71 #	ifdef PHP_SIMPLEXML_EXPORTS
72 #		define PHP_SXE_API __declspec(dllexport)
73 #	else
74 #		define PHP_SXE_API __declspec(dllimport)
75 #	endif
76 #else
77 #	define PHP_SXE_API ZEND_API
78 #endif
79 
80 extern PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator;
81 extern PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
82 
83 PHP_SXE_API zend_class_entry *sxe_get_element_class_entry(void);
84 
85 #endif
86