]>
Commit | Line | Data |
---|---|---|
b8c7453a MW |
1 | /* |
2 | * Copyright (C) 2007 Martin Willi | |
3 | * Hochschule fuer Technik Rapperswil | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License as published by the | |
7 | * Free Software Foundation; either version 2 of the License, or (at your | |
8 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 | * for more details. | |
552cc11b MW |
14 | */ |
15 | ||
16 | /** | |
17 | * @defgroup xml xml | |
18 | * @{ @ingroup manager | |
b8c7453a MW |
19 | */ |
20 | ||
21 | #ifndef XML_H_ | |
22 | #define XML_H_ | |
23 | ||
12642a68 | 24 | #include <collections/enumerator.h> |
b8c7453a MW |
25 | |
26 | typedef struct xml_t xml_t; | |
27 | ||
28 | /** | |
552cc11b | 29 | * Simple enumerator based XML parser. |
b8c7453a MW |
30 | * |
31 | * An xml_t is a single node of the XML tree, but also serves as root node | |
32 | * and therefore the document. | |
33 | * This object has no destructor, the tree gets destroyed when all enumerator | |
34 | * instances get destroyed. | |
35 | */ | |
36 | struct xml_t { | |
37 | ||
38 | /** | |
552cc11b | 39 | * Create an enumerator over all children. |
b8c7453a MW |
40 | * |
41 | * Enumerated values must not be manipulated or freed. | |
42 | * | |
43 | * @return enumerator over (xml_t* child, char *name, char *value) | |
44 | */ | |
45 | enumerator_t* (*children)(xml_t *this); | |
7daf5226 | 46 | |
b8c7453a | 47 | /** |
552cc11b | 48 | * Get an attribute value by its name. |
b8c7453a MW |
49 | * |
50 | * @param name name of the attribute | |
51 | * @return attribute value, NULL if not found | |
52 | */ | |
53 | char *(*get_attribute)(xml_t *this, char *name); | |
54 | }; | |
55 | ||
56 | /** | |
552cc11b | 57 | * Create a xml instance. |
b8c7453a MW |
58 | */ |
59 | xml_t *xml_create(char *xml); | |
60 | ||
1490ff4d | 61 | #endif /** XML_H_ @}*/ |