summaryrefslogtreecommitdiff
path: root/src/include/xml/xml.h
blob: c812005ce075ac05fe3e68910d263d0187dfe940 (plain)
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
#ifndef XML_H
#define XML_H

#include <stdio.h>

typedef struct {
	char *id;
	char *value;
} attr_t;

typedef struct {
	char *tag;
	void *payload;
	size_t size;
	int n;
	attr_t *attrs;
	int n_attrs;
} map_t;

// TODO: make encode more reliant on helpers
// to make function more private

/* decode: decodes the provided xml statement into a map_t */
map_t *decode(char *xml, int *pos, int *len);

/* encode: encodes the provided map_t into a xml statement */
char *encode(map_t *map, int len);

/* freemap: frees a map and its children */
void freemap(map_t *map);

#endif