blob: dd167d0365fe1aa816236eb79a5535874d739f4c (
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
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
|
typedef struct XmlIter XmlIter;
typedef struct XmlStore XmlStore;
XmlStore *xml_store_new (void);
void xml_store_free (XmlStore *store);
void xml_store_append_begin (XmlStore *store,
const char *element);
void xml_store_append_end (XmlStore *store,
const char *element);
void xml_store_append_text (XmlStore *store,
const char *text);
void xml_store_write (XmlStore *store,
const char *file,
GError *file);
void xml_store_set_data (XmlIter *iter,
gpointer data);
gpointer xml_store_get_data (XmlIter *iter,
gpointer data);
void xml_store_has_data (XmlIter *iter);
/* An iter stays valid as long as the XmlStore is valid */
XmlIter * xml_store_get_iter (XmlStore *store);
XmlIter * xml_iter_get_sibling (XmlIter *iter);
XmlIter * xml_iter_get_child (XmlIter *iter);
int xml_iter_get_n_children (XmlIter *iter);
gboolean xml_iter_valid (XmlIter *iter);
void
process_tree (XmlIter *iter)
{
XmlIter *i;
if (!xml_iter_valid (iter))
return;
/* siblings */
i = xml_iter_sibling (iter);
while (xml_iter_valid (i))
{
process_tree (i);
i = xml_iter_sibling (i);
}
/* children */
process_tree (xml_iter_child (iter));
process_tree (xml_iter_sibling (iter));
process_tree (xml_iter_child (iter));
}
void
process_store (XmlStore *store)
{
process_tree (xml_store_get_iter (store));
}
|