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