forked from xdebug/xdebug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xdebug_xml.h
76 lines (64 loc) · 3.03 KB
/
xdebug_xml.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
+----------------------------------------------------------------------+
| Xdebug |
+----------------------------------------------------------------------+
| Copyright (c) 2002-2011 Derick Rethans |
+----------------------------------------------------------------------+
| This source file is subject to version 1.0 of the Xdebug license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://xdebug.derickrethans.nl/license.php |
| If you did not receive a copy of the Xdebug license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <[email protected]> |
+----------------------------------------------------------------------+
*/
#include "xdebug_str.h"
#ifndef __HAVE_XDEBUG_XML_H__
#define __HAVE_XDEBUG_XML_H__
typedef struct _xdebug_xml_attribute xdebug_xml_attribute;
typedef struct _xdebug_xml_text_node xdebug_xml_text_node;
typedef struct _xdebug_xml_node xdebug_xml_node;
struct _xdebug_xml_attribute
{
char *name;
char *value;
int name_len;
int value_len;
struct _xdebug_xml_attribute *next;
int free_name;
int free_value;
};
/* todo: support multiple text nodes inside an element */
struct _xdebug_xml_text_node
{
char *text;
int free_value;
int encode;
int text_len;
};
struct _xdebug_xml_node
{
char *tag;
struct _xdebug_xml_text_node *text;
struct _xdebug_xml_attribute *attribute;
struct _xdebug_xml_node *child;
struct _xdebug_xml_node *next;
int free_tag;
};
#define xdebug_xml_node_init(t) xdebug_xml_node_init_ex((t), 0)
#define xdebug_xml_add_attribute_ex(x,a,v,fa,fv) { char *ta = (a), *tv = (v); xdebug_xml_add_attribute_exl((x), (ta), strlen((ta)), (tv), strlen((tv)), fa, fv); }
#define xdebug_xml_add_attribute(x,a,v) xdebug_xml_add_attribute_ex((x), (a), (v), 0, 0);
xdebug_xml_node *xdebug_xml_node_init_ex(char *tag, int free_tag);
void xdebug_xml_add_attribute_exl(xdebug_xml_node* xml, char *attribute, int attribute_len, char *value, int varlue_len, int free_name, int free_value);
void xdebug_xml_add_child(xdebug_xml_node *xml, xdebug_xml_node *child);
void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode);
void xdebug_xml_add_text(xdebug_xml_node *xml, char *text);
void xdebug_xml_add_text_encode(xdebug_xml_node *xml, char *text);
#define xdebug_xml_add_textl(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 0)
#define xdebug_xml_add_text_encodel(x,t,l) xdebug_xml_add_text_ex((x), (t), (l), 1, 1)
void xdebug_xml_return_node(xdebug_xml_node* node, struct xdebug_str *output);
void xdebug_xml_node_dtor(xdebug_xml_node* xml);
#endif