@@ -108,15 +108,110 @@ class Element : public Node
108
108
void remove_attribute (const Glib::ustring& name,
109
109
const Glib::ustring& ns_prefix = Glib::ustring());
110
110
111
+ /* * Add a child element to this node.
112
+ *
113
+ * @newin{3,0} Replaces Node::add_child()
114
+ *
115
+ * @param name The new node name
116
+ * @param ns_prefix The namespace prefix. If the prefix has not been declared then this method will throw an exception.
117
+ * @returns The newly-created element
118
+ * @throws xmlpp::exception If a namespace prefix is specified, but has not been declared.
119
+ * @throws xmlpp::internal_error If this node is not an element node,
120
+ * or the child node cannot be created.
121
+ */
122
+ Element* add_child_element (const Glib::ustring& name,
123
+ const Glib::ustring& ns_prefix = Glib::ustring());
124
+
125
+ /* * Add a child element to this node after the specified existing child node.
126
+ *
127
+ * @newin{3,0} Replaces Node::add_child()
128
+ *
129
+ * @param previous_sibling An existing child node.
130
+ * @param name The new node name
131
+ * @param ns_prefix The namespace prefix. If the prefix has not been declared then this method will throw an exception.
132
+ * @returns The newly-created element
133
+ * @throws xmlpp::exception If a namespace prefix is specified, but has not been declared.
134
+ * @throws xmlpp::internal_error If this node is not an element node,
135
+ * or the child node cannot be created.
136
+ */
137
+ Element* add_child_element (xmlpp::Node* previous_sibling, const Glib::ustring& name,
138
+ const Glib::ustring& ns_prefix = Glib::ustring());
139
+
140
+ /* * Add a child element to this node before the specified existing child node.
141
+ *
142
+ * @newin{3,0} Replaces Node::add_child_before()
143
+ *
144
+ * @param next_sibling An existing child node.
145
+ * @param name The new node name
146
+ * @param ns_prefix The namespace prefix. If the prefix has not been declared then this method will throw an exception.
147
+ * @returns The newly-created element
148
+ * @throws xmlpp::exception If a namespace prefix is specified, but has not been declared.
149
+ * @throws xmlpp::internal_error If this node is not an element node,
150
+ * or the child node cannot be created.
151
+ */
152
+ Element* add_child_element_before (xmlpp::Node* next_sibling, const Glib::ustring& name,
153
+ const Glib::ustring& ns_prefix = Glib::ustring());
154
+
155
+ /* * Add a child element to this node.
156
+ *
157
+ * @newin{3,0} Replaces Node::add_child_with_new_ns()
158
+ *
159
+ * @param name The new node name.
160
+ * @param ns_uri The namespace to associate with the prefix,
161
+ * or to use as the default namespace if no prefix is specified.
162
+ * @param ns_prefix The prefix of the node's namespace. If no prefix is specified
163
+ * then the namespace URI will be the default namespace.
164
+ * @returns The newly-created element.
165
+ * @throws xmlpp::internal_error If this node is not an element node,
166
+ * or the child node or the namespace node cannot be created.
167
+ */
168
+ Element* add_child_element_with_new_ns (const Glib::ustring& name,
169
+ const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix = Glib::ustring());
170
+
171
+ /* * Add a child element to this node after the specified existing child node.
172
+ *
173
+ * @newin{3,0} Replaces Node::add_child_with_new_ns()
174
+ *
175
+ * @param previous_sibling An existing child node.
176
+ * @param name The new node name.
177
+ * @param ns_uri The namespace to associate with the prefix,
178
+ * or to use as the default namespace if no prefix is specified.
179
+ * @param ns_prefix The prefix of the node's namespace. If no prefix is specified
180
+ * then the namespace URI will be the default namespace.
181
+ * @returns The newly-created element.
182
+ * @throws xmlpp::internal_error If this node is not an element node,
183
+ * or the child node or the namespace node cannot be created.
184
+ */
185
+ Element* add_child_element_with_new_ns (xmlpp::Node* previous_sibling, const Glib::ustring& name,
186
+ const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix = Glib::ustring());
187
+
188
+ /* * Add a child element to this node before the specified existing child node.
189
+ *
190
+ * @newin{3,0} Replaces Node::add_child_before_with_new_ns()
191
+ *
192
+ * @param next_sibling An existing child node.
193
+ * @param name The new node name.
194
+ * @param ns_uri The namespace to associate with the prefix,
195
+ * or to use as the default namespace if no prefix is specified.
196
+ * @param ns_prefix The prefix of the node's namespace. If no prefix is specified
197
+ * then the namespace URI will be the default namespace.
198
+ * @returns The newly-created element.
199
+ * @throws xmlpp::internal_error If this node is not an element node,
200
+ * or the child node or the namespace node cannot be created.
201
+ */
202
+ Element* add_child_element_before_with_new_ns (xmlpp::Node* next_sibling, const Glib::ustring& name,
203
+ const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix = Glib::ustring());
111
204
112
205
/* * Get the first child text content node.
113
- * This is a convenience method, meant as an alternative to iterating over all the child nodes to find the first suitable node then and getting the text directly.
206
+ * This is a convenience method, meant as an alternative to iterating over all the
207
+ * child nodes to find the first suitable node then and getting the text directly.
114
208
* @returns The first text node, if any.
115
209
*/
116
210
TextNode* get_child_text ();
117
211
118
212
/* * Get the first child text content node.
119
- * This is a convenience method, meant as an alternative to iterating over all the child nodes to find the first suitable node then and getting the text directly.
213
+ * This is a convenience method, meant as an alternative to iterating over all the
214
+ * child nodes to find the first suitable node then and getting the text directly.
120
215
* @returns The first text node, if any.
121
216
*/
122
217
const TextNode* get_child_text () const ;
@@ -205,8 +300,16 @@ class Element : public Node
205
300
ProcessingInstructionNode* add_child_processing_instruction (
206
301
const Glib::ustring& name, const Glib::ustring& content);
207
302
208
- protected :
303
+ private :
209
304
Glib::ustring get_namespace_uri_for_prefix (const Glib::ustring& ns_prefix) const ;
305
+
306
+ // /Create the C instance ready to be added to the parent node.
307
+ _xmlNode* create_new_child_element_node (const Glib::ustring& name,
308
+ const Glib::ustring& ns_prefix);
309
+
310
+ // /Create the C instance ready to be added to the parent node.
311
+ _xmlNode* create_new_child_element_node_with_new_ns (const Glib::ustring& name,
312
+ const Glib::ustring& ns_uri, const Glib::ustring& ns_prefix);
210
313
};
211
314
212
315
} // namespace xmlpp
0 commit comments