xref: /PHP-7.4/ext/soap/php_xml.h (revision 0cf7de1c)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 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: Brad Lafountain <rodif_bl@yahoo.com>                        |
16   |          Shane Caraveo <shane@caraveo.com>                           |
17   |          Dmitry Stogov <dmitry@php.net>                              |
18   +----------------------------------------------------------------------+
19 */
20 
21 #ifndef PHP_SOAP_XML_H
22 #define PHP_SOAP_XML_H
23 
24 #define get_attribute(node, name) get_attribute_ex(node, name, NULL)
25 #define get_node(node, name) get_node_ex(node, name, NULL)
26 #define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL)
27 #define get_node_with_attribute(node, name, attr, val) get_node_with_attribute_ex(node, name, NULL, attr, val, NULL)
28 #define get_node_with_attribute_recursive(node, name, attr, val) get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL)
29 #define node_is_equal(node, name) node_is_equal_ex(node, name, NULL)
30 #define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL)
31 
32 xmlDocPtr soap_xmlParseFile(const char *filename);
33 xmlDocPtr soap_xmlParseMemory(const void *buf, size_t size);
34 
35 xmlNsPtr attr_find_ns(xmlAttrPtr node);
36 xmlNsPtr node_find_ns(xmlNodePtr node);
37 int attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns);
38 int node_is_equal_ex(xmlNodePtr node, char *name, char *ns);
39 xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns);
40 xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns);
41 xmlNodePtr get_node_recursive_ex(xmlNodePtr node,char *name, char *ns);
42 xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
43 xmlNodePtr get_node_with_attribute_recursive_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns);
44 int parse_namespace(const xmlChar *inval,char **value,char **namespace);
45 
46 #define FOREACHATTRNODE(n,c,i)      FOREACHATTRNODEEX(n,c,NULL,i)
47 #define FOREACHATTRNODEEX(n,c,ns,i) \
48 	do { \
49 		if (n == NULL) { \
50 			break; \
51 		} \
52 		if (c) { \
53 			i = get_attribute_ex(n,c,ns); \
54 		} else { \
55 			i = n; \
56 		} \
57 		if (i != NULL) { \
58 			n = i;
59 
60 #define FOREACHNODE(n,c,i)      FOREACHNODEEX(n,c,NULL,i)
61 #define FOREACHNODEEX(n,c,ns,i) \
62 	do { \
63 		if (n == NULL) { \
64 			break; \
65 		} \
66 		if (c) { \
67 			i = get_node_ex(n,c,NULL); \
68 		} else { \
69 			i = n; \
70 		} \
71 		if(i != NULL) { \
72 			n = i;
73 
74 #define ENDFOREACH(n) \
75 		} \
76 	} while ((n = n->next));
77 
78 #endif
79