annotate src/xmlnode.h @ 14051:f78289db8977

[gaim-migrate @ 16664] Removed code for looking up specific Chinese geolocation info from a user's IP address. The code was defunct for two reasons: First, the file holding the geolocation data (QQWry.dat) was simply too large to package with Gaim. Second, the current version of QQ seems to have stopped broadcasting the user's IP address with his/her status. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Mon, 07 Aug 2006 08:30:36 +0000
parents 25e63008d3bb
children 85144ba7d726
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file xmlnode.h XML DOM functions
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
3 * @ingroup core
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 * gaim
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7642
diff changeset
9 * source distribution.
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * (at your option) any later version.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * GNU General Public License for more details.
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 *
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24 */
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 #ifndef _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #define _GAIM_XMLNODE_H_
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
28 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
29 * The valid types for an xmlnode
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
30 */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
31 typedef enum _XMLNodeType
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32 {
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
33 XMLNODE_TYPE_TAG, /**< Just a tag */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
34 XMLNODE_TYPE_ATTRIB, /**< Has attributes */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
35 XMLNODE_TYPE_DATA /**< Has data */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
36 } XMLNodeType;
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
38 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
39 * An xmlnode.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
40 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
41 typedef struct _xmlnode
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42 {
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
43 char *name; /**< The name of the node. */
13806
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
44 #ifdef HAVE_LIBXML
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
45 char *namespace; /**< The namespace of the node */
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
46 #endif
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
47 XMLNodeType type; /**< The type of the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
48 char *data; /**< The data for the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
49 size_t data_sz; /**< The size of the data. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
50 struct _xmlnode *parent; /**< The parent node or @c NULL.*/
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
51 struct _xmlnode *child; /**< The child node or @c NULL.*/
12233
02833a0ae716 [gaim-migrate @ 14535]
Richard Laager <rlaager@wiktel.com>
parents: 11707
diff changeset
52 struct _xmlnode *lastchild; /**< The last child node or @c NULL.*/
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
53 struct _xmlnode *next; /**< The next node or @c NULL. */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
54 } xmlnode;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
55
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
56 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
57 * Creates a new xmlnode.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
58 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
59 * @param name The name of the node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
60 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
61 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
62 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
63 xmlnode *xmlnode_new(const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
64
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
65 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
66 * Creates a new xmlnode child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
67 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
68 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
69 * @param name The name of the child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
70 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
71 * @return The new child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
72 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
73 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
74
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
75 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
76 * Inserts a node into a node as a child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
77 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
78 * @param parent The parent node to insert child into.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
79 * @param child The child node to insert into parent.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
80 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
81 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
82
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
83 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
84 * Gets a child node named name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
85 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
86 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
87 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
88 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
89 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
90 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
91 xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
92
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
93 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
94 * Gets a child node named name in a namespace.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
95 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
96 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
97 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
98 * @param xmlns The namespace.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
99 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
100 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
101 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
102 xmlnode *xmlnode_get_child_with_namespace(const xmlnode *parent, const char *name, const char *xmlns);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
103
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
104 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
105 * Gets the next node with the same name as node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
106 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
107 * @param node The node of a twin to find.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
108 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
109 * @return The twin of node or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
110 */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
111 xmlnode *xmlnode_get_next_twin(xmlnode *node);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
112
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
113 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
114 * Inserts data into a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
115 *
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
116 * @param node The node to insert data into.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
117 * @param data The data to insert.
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
118 * @param size The size of the data to insert. If data is
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
119 * null-terminated you can pass in -1.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
120 */
10848
98de05966d6d [gaim-migrate @ 12520]
Nathan Walp <nwalp@pidgin.im>
parents: 10736
diff changeset
121 void xmlnode_insert_data(xmlnode *node, const char *data, gssize size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
122
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
123 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
124 * Gets data from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
125 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
126 * @param node The node to get data from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
127 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
128 * @return The data from the node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
129 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
130 char *xmlnode_get_data(xmlnode *node);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
131
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
132 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
133 * Sets an attribute for a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
134 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
135 * @param node The node to set an attribute for.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
136 * @param attr The name of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
137 * @param value The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
138 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
139 void xmlnode_set_attrib(xmlnode *node, const char *attr, const char *value);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
140
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
141 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
142 * Gets an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
143 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
144 * @param node The node to get an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
145 * @param attr The attribute to get.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
146 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
147 * @return The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
148 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149 const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
150
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
151 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
152 * Removes an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
153 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
154 * @param node The node to remove an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
155 * @param attr The attribute to remove.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
156 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
158
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
159 /**
13806
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
160 * Sets the namespace of a node
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
161 *
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
162 * @param node The node to qualify
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
163 * @param xmlns The namespace of the node
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
164 */
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
165 void xmlnode_set_namespace(xmlnode *node, const char *xmlns);
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
166
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
167 /**
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
168 * Returns the namespace of a node
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
169 *
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
170 * @param node The node to get the namepsace from
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
171 * @return The namespace of this node
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
172 */
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
173 const char *xmlnode_get_namespace(xmlnode *node);
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
174
25e63008d3bb [gaim-migrate @ 16229]
Sean Egan <seanegan@gmail.com>
parents: 12887
diff changeset
175 /**
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
176 * Returns the node in a string of xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
177 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
178 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
179 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
180 *
12887
4229503f1cd9 [gaim-migrate @ 15240]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12233
diff changeset
181 * @return The node represented as a string. You must
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
182 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
183 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
184 char *xmlnode_to_str(xmlnode *node, int *len);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
185
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
186 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
187 * Returns the node in a string of human readable xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
188 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
189 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
190 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
191 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
192 * @return The node as human readable string including
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
193 * tab and new line characters. You must
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
194 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
195 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
196 char *xmlnode_to_formatted_str(xmlnode *node, int *len);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
197
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
198 /**
10337
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
199 * Creates a node from a string of XML. Calling this on the
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
200 * root node of an XML document will parse the entire document
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
201 * into a tree of nodes, and return the xmlnode of the root.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
202 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
203 * @param str The string of xml.
11707
b7af9100af6c [gaim-migrate @ 13998]
Richard Laager <rlaager@wiktel.com>
parents: 10848
diff changeset
204 * @param size The size of the string, or -1 if @a str is
b7af9100af6c [gaim-migrate @ 13998]
Richard Laager <rlaager@wiktel.com>
parents: 10848
diff changeset
205 * NUL-terminated.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
206 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
207 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
208 */
10848
98de05966d6d [gaim-migrate @ 12520]
Nathan Walp <nwalp@pidgin.im>
parents: 10736
diff changeset
209 xmlnode *xmlnode_from_str(const char *str, gssize size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
210
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
211 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
212 * Creates a new node from the source node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
213 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
214 * @param src The node to copy.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
215 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
216 * @return A new copy of the src node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
217 */
8167
b55b70aef314 [gaim-migrate @ 8880]
Nathan Walp <nwalp@pidgin.im>
parents: 8135
diff changeset
218 xmlnode *xmlnode_copy(xmlnode *src);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
220 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
221 * Frees a node and all of it's children.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
222 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
223 * @param node The node to free.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
224 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 void xmlnode_free(xmlnode *node);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
226
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227 #endif /* _GAIM_XMLNODE_H_ */