annotate src/xmlnode.h @ 10838:bf7e5ae7baae

[gaim-migrate @ 12510] sf patch #1185493, from Richard Laager ChangeLog Spelling Fix committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 19 Apr 2005 03:03:20 +0000
parents 703f722d076f
children 98de05966d6d
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. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
44 XMLNodeType type; /**< The type of the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
45 char *data; /**< The data for the node. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
46 size_t data_sz; /**< The size of the data. */
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
47 struct _xmlnode *parent; /**< The parent node or @c NULL.*/
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
48 struct _xmlnode *child; /**< The child node or @c NULL.*/
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
49 struct _xmlnode *next; /**< The next node or @c NULL. */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
50 } xmlnode;
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
52 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
53 * Creates a new xmlnode.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
54 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
55 * @param name The name of the node.
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 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
58 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
59 xmlnode *xmlnode_new(const char *name);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
62 * Creates a new xmlnode child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
63 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
64 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
65 * @param name The name of the child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
66 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
67 * @return The new child node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
68 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69 xmlnode *xmlnode_new_child(xmlnode *parent, const char *name);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
72 * Inserts a node into a node as a child.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
73 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
74 * @param parent The parent node to insert child into.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
75 * @param child The child node to insert into parent.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
76 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
77 void xmlnode_insert_child(xmlnode *parent, xmlnode *child);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
78
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
79 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
80 * Gets a child node named name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
81 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
82 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
83 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
84 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
85 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
86 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
87 xmlnode *xmlnode_get_child(const xmlnode *parent, const char *name);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
90 * Gets a child node named name in a namespace.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
91 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
92 * @param parent The parent node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
93 * @param name The child's name.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
94 * @param xmlns The 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 * @return The child or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
97 */
10736
703f722d076f [gaim-migrate @ 12338]
Mark Doliner <mark@kingant.net>
parents: 10425
diff changeset
98 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
99
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
100 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
101 * Gets the next node with the same name as node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
102 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
103 * @param node The node of a twin to find.
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 * @return The twin of node or NULL.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
106 */
8135
8f4ce853e685 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
107 xmlnode *xmlnode_get_next_twin(xmlnode *node);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
110 * Inserts data into a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
111 *
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
112 * @param node The node to insert data into.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
113 * @param data The data to insert.
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
114 * @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
115 * null-terminated you can pass in -1.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
116 */
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
117 void xmlnode_insert_data(xmlnode *node, const char *data, size_t size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
118
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
119 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
120 * Gets data from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
121 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
122 * @param node The node to get data from.
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 * @return The data from the node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
125 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
126 char *xmlnode_get_data(xmlnode *node);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
129 * Sets an attribute for a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
130 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
131 * @param node The node to set an attribute for.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
132 * @param attr The name of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
133 * @param value The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
134 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
135 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
136
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
137 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
138 * Gets an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
139 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
140 * @param node The node to get an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
141 * @param attr The attribute to get.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
142 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
143 * @return The value of the attribute.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
144 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
145 const char *xmlnode_get_attrib(xmlnode *node, const char *attr);
10327
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 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
148 * Removes an attribute from a node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
149 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
150 * @param node The node to remove an attribute from.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
151 * @param attr The attribute to remove.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
152 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 void xmlnode_remove_attrib(xmlnode *node, const char *attr);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
154
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
155 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
156 * Returns the node in a string of xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
157 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
158 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
159 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
160 *
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
161 * @return The node repersented as a string. You must
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
162 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
163 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
164 char *xmlnode_to_str(xmlnode *node, int *len);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
165
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
166 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
167 * Returns the node in a string of human readable xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
168 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
169 * @param node The starting node to output.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
170 * @param len Address for the size of the string.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
171 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
172 * @return The node as human readable string including
10415
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
173 * tab and new line characters. You must
5b7a74d397cc [gaim-migrate @ 11665]
Mark Doliner <mark@kingant.net>
parents: 10337
diff changeset
174 * g_free this string when finished using it.
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
175 */
10425
9903182f2aac [gaim-migrate @ 11677]
Mark Doliner <mark@kingant.net>
parents: 10424
diff changeset
176 char *xmlnode_to_formatted_str(xmlnode *node, int *len);
10327
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 /**
10337
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
179 * 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
180 * root node of an XML document will parse the entire document
682201b69107 [gaim-migrate @ 11545]
Mark Doliner <mark@kingant.net>
parents: 10327
diff changeset
181 * 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
182 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
183 * @param str The string of xml.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
184 * @param size The size of the string.
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 * @return The new node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
187 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
188 xmlnode *xmlnode_from_str(const char *str, size_t size);
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
189
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
190 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
191 * Creates a new node from the source node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
192 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
193 * @param src The node to copy.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
194 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
195 * @return A new copy of the src node.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
196 */
8167
b55b70aef314 [gaim-migrate @ 8880]
Nathan Walp <nwalp@pidgin.im>
parents: 8135
diff changeset
197 xmlnode *xmlnode_copy(xmlnode *src);
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198
10327
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
199 /**
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
200 * Frees a node and all of it's children.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
201 *
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
202 * @param node The node to free.
d88ee1d73a93 [gaim-migrate @ 11534]
Mark Doliner <mark@kingant.net>
parents: 9837
diff changeset
203 */
7131
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 void xmlnode_free(xmlnode *node);
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205
af889fd531d0 [gaim-migrate @ 7698]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 #endif /* _GAIM_XMLNODE_H_ */