tizen 2.3.1 release
[external/gupnp.git] / libgupnp / xml-util.h
1 /*
2  * Copyright (C) 2006, 2007 OpenedHand Ltd.
3  *
4  * Author: Jorn Baayen <jorn@openedhand.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __XML_UTIL_H__
23 #define __XML_UTIL_H__
24
25 #include <libxml/tree.h>
26 #include <libsoup/soup-uri.h>
27 #include <stdarg.h>
28 #include <glib-object.h>
29
30 /* Misc utilities for inspecting xmlNodes */
31 G_GNUC_INTERNAL xmlNode *
32 xml_util_get_element                    (xmlNode    *node,
33                                          ...) G_GNUC_NULL_TERMINATED;
34
35 G_GNUC_INTERNAL xmlChar *
36 xml_util_get_child_element_content      (xmlNode    *node,
37                                          const char *child_name);
38
39 G_GNUC_INTERNAL int
40 xml_util_get_child_element_content_int  (xmlNode    *node,
41                                          const char *child_name);
42
43 G_GNUC_INTERNAL char *
44 xml_util_get_child_element_content_glib (xmlNode    *node,
45                                          const char *child_name);
46
47 G_GNUC_INTERNAL SoupURI *
48 xml_util_get_child_element_content_uri  (xmlNode    *node,
49                                          const char *child_name,
50                                          SoupURI    *base);
51
52 G_GNUC_INTERNAL char *
53 xml_util_get_child_element_content_url  (xmlNode    *node,
54                                          const char *child_name,
55                                          SoupURI    *base);
56 G_GNUC_INTERNAL xmlChar *
57 xml_util_get_attribute_contents         (xmlNode    *node,
58                                          const char *attribute_name);
59
60 G_GNUC_INTERNAL xmlNode *
61 xml_util_real_node                      (xmlNode    *node);
62
63 /* XML string creation helpers */
64 G_GNUC_INTERNAL GString *
65 xml_util_new_string                     (void);
66
67 G_GNUC_INTERNAL void
68 xml_util_start_element                  (GString    *xml_str,
69                                          const char *element_name);
70
71 G_GNUC_INTERNAL void
72 xml_util_end_element                    (GString    *xml_str,
73                                          const char *element_name);
74
75 G_GNUC_INTERNAL void
76 xml_util_add_content                    (GString    *xml_str,
77                                          const char *content);
78
79 #endif /* __XML_UTIL_H__ */