Greenbone Vulnerability Management Libraries  11.0.1
xmlutils_tests.c
Go to the documentation of this file.
1 /* Copyright (C) 2019 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #include "xmlutils.c"
21 
22 #include <cgreen/cgreen.h>
23 #include <cgreen/mocks.h>
24 
25 Describe (xmlutils);
26 BeforeEach (xmlutils)
27 {
28 }
29 AfterEach (xmlutils)
30 {
31 }
32 
33 /* parse_entity */
34 
35 Ensure (xmlutils, parse_entity_parses_simple_xml)
36 {
37  entity_t entity, b;
38  const gchar *xml;
39 
40  xml = "<a><b>1</b></a>";
41 
42  assert_that (parse_entity (xml, &entity), is_equal_to (0));
43 
44  assert_that (entity_name (entity), is_equal_to_string ("a"));
45 
46  b = entity_child (entity, "b");
47  assert_that (entity_name (b), is_equal_to_string ("b"));
48 
49  assert_that (entity_text (b), is_equal_to_string ("1"));
50 }
51 
52 Ensure (xmlutils, parse_entity_parses_xml_with_attributes)
53 {
54  entity_t entity, b;
55  const gchar *xml;
56 
57  xml = "<a><b ba1='test'>1</b></a>";
58 
59  assert_that (parse_entity (xml, &entity), is_equal_to (0));
60 
61  b = entity_child (entity, "b");
62 
63  assert_that (entity_attribute (b, "ba1"), is_equal_to_string ("test"));
64 }
65 
66 Ensure (xmlutils, parse_entity_handles_declaration)
67 {
68  entity_t entity, b;
69  const gchar *xml;
70 
71  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><b ba1='test'>1</b></a>";
72 
73  assert_that (parse_entity (xml, &entity), is_equal_to (0));
74 
75  assert_that (entity_name (entity), is_equal_to_string ("a"));
76 
77  b = entity_child (entity, "b");
78  assert_that (entity_name (b), is_equal_to_string ("b"));
79 
80  assert_that (entity_text (b), is_equal_to_string ("1"));
81 }
82 
83 Ensure (xmlutils, parse_entity_handles_namespace)
84 {
85  entity_t entity, b;
86  const gchar *xml;
87 
88  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><n:b ba1='test'>1</n:b></a>";
89 
90  assert_that (parse_entity (xml, &entity), is_equal_to (0));
91 
92  assert_that (entity_name (entity), is_equal_to_string ("a"));
93 
94  b = entity_child (entity, "n:b");
95  assert_that (entity_name (b), is_equal_to_string ("n:b"));
96 
97  assert_that (entity_text (b), is_equal_to_string ("1"));
98 }
99 
100 Ensure (xmlutils, parse_entity_oval_timestamp)
101 {
102  gchar *generator_name;
103  entity_t generator, timestamp, entity;
104  const gchar *xml;
105 
106  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
107 "<oval_definitions xsi:schemaLocation=\"http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#linux linux-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#windows windows-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#unix unix-definitions-schema.xsd\" xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:oval=\"http://oval.mitre.org/XMLSchema/oval-common-5\" xmlns:oval-def=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\">" \
108 " <generator>" \
109 " <oval:product_name>The OVAL Repository</oval:product_name>" \
110 " <oval:schema_version>5.10</oval:schema_version>" \
111 " <oval:timestamp>2015-08-20T10:09:07.183-04:00</oval:timestamp>" \
112 " </generator>" \
113 "</oval_definitions>";
114 
115  assert_that (parse_entity (xml, &entity), is_equal_to (0));
116 
117  assert_that (entity_name (entity), is_equal_to_string ("oval_definitions"));
118  generator_name = g_strdup ("generator");
119  generator = entity_child (entity, generator_name);
120  g_free (generator_name);
121  assert_that (generator, is_not_null);
122  timestamp = entity_child (generator, "oval:timestamp");
123  assert_that (timestamp, is_not_null);
124  assert_that (entity_text (timestamp), is_equal_to_string ("2015-08-20T10:09:07.183-04:00"));
125 }
126 
127 /* next_entities. */
128 
129 Ensure (xmlutils, next_entities_handles_multiple_children)
130 {
131  entity_t entity, child;
132  entities_t children;
133  const gchar *xml;
134 
135  xml = "<top><a>1</a><b></b><c>3</c></top>";
136 
137  assert_that (parse_entity (xml, &entity), is_equal_to (0));
138 
139  assert_that (entity_name (entity), is_equal_to_string ("top"));
140 
141  children = entity->entities;
142 
143  child = first_entity (children);
144  assert_that (child, is_not_null);
145  assert_that (entity_name (child), is_equal_to_string ("a"));
146  assert_that (entity_text (child), is_equal_to_string ("1"));
147  children = next_entities (children);
148 
149  child = first_entity (children);
150  assert_that (child, is_not_null);
151  assert_that (entity_name (child), is_equal_to_string ("b"));
152  assert_that (entity_text (child), is_equal_to_string (""));
153  children = next_entities (children);
154 
155  child = first_entity (children);
156  assert_that (child, is_not_null);
157  assert_that (entity_name (child), is_equal_to_string ("c"));
158  assert_that (entity_text (child), is_equal_to_string ("3"));
159  children = next_entities (children);
160 }
161 
162 /* parse_element */
163 
164 Ensure (xmlutils, parse_element_parses_simple_xml)
165 {
166  element_t element, b;
167  const gchar *xml;
168 
169  xml = "<a><b>1</b></a>";
170 
171  assert_that (parse_element (xml, &element), is_equal_to (0));
172 
173  assert_that (element_name (element), is_equal_to_string ("a"));
174 
175  b = element_child (element, "b");
176  assert_that (element_name (b), is_equal_to_string ("b"));
177 
178  assert_that (element_text (b), is_equal_to_string ("1"));
179 }
180 
181 Ensure (xmlutils, parse_element_parses_xml_with_attributes)
182 {
183  element_t element, b;
184  const gchar *xml;
185 
186  xml = "<a><b ba1='test'>1</b></a>";
187 
188  assert_that (parse_element (xml, &element), is_equal_to (0));
189 
190  b = element_child (element, "b");
191 
192  assert_that (element_attribute (b, "ba1"), is_equal_to_string ("test"));
193 }
194 
195 Ensure (xmlutils, parse_element_handles_declaration)
196 {
197  element_t element, b;
198  const gchar *xml;
199 
200  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><b ba1='test'>1</b></a>";
201 
202  assert_that (parse_element (xml, &element), is_equal_to (0));
203 
204  assert_that (element_name (element), is_equal_to_string ("a"));
205 
206  b = element_child (element, "b");
207  assert_that (element_name (b), is_equal_to_string ("b"));
208 
209  assert_that (element_text (b), is_equal_to_string ("1"));
210 }
211 
212 Ensure (xmlutils, parse_element_handles_namespace)
213 {
214  element_t element, b;
215  const gchar *xml;
216 
217  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><n:b ba1='test' n2:ba2='test2'>1</n:b></a>";
218 
219  assert_that (parse_element (xml, &element), is_equal_to (0));
220 
221  assert_that (element_name (element), is_equal_to_string ("a"));
222 
223  b = element_child (element, "n:b");
224  assert_that (element_name (b), is_equal_to_string ("n:b"));
225 
226  assert_that (element_text (b), is_equal_to_string ("1"));
227 
228  assert_that (element_attribute (b, "n2:ba2"), is_equal_to_string ("test2"));
229 }
230 
231 Ensure (xmlutils, parse_element_oval_timestamp)
232 {
233  gchar *generator_name;
234  element_t generator, timestamp, element;
235  const gchar *xml;
236 
237  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
238 "<oval_definitions xsi:schemaLocation=\"http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#linux linux-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#windows windows-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#unix unix-definitions-schema.xsd\" xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:oval=\"http://oval.mitre.org/XMLSchema/oval-common-5\" xmlns:oval-def=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\">" \
239 " <generator>" \
240 " <oval:product_name>The OVAL Repository</oval:product_name>" \
241 " <oval:schema_version>5.10</oval:schema_version>" \
242 " <oval:timestamp>2015-08-20T10:09:07.183-04:00</oval:timestamp>" \
243 " </generator>" \
244 "</oval_definitions>";
245 
246  assert_that (parse_element (xml, &element), is_equal_to (0));
247 
248  assert_that (element_name (element), is_equal_to_string ("oval_definitions"));
249  generator_name = g_strdup ("generator");
250  generator = element_child (element, generator_name);
251  g_free (generator_name);
252  assert_that (generator, is_not_null);
253  timestamp = element_child (generator, "oval:timestamp");
254  assert_that (timestamp, is_not_null);
255  assert_that (element_text (timestamp), is_equal_to_string ("2015-08-20T10:09:07.183-04:00"));
256 }
257 
258 Ensure (xmlutils, parse_element_item_metadata)
259 {
260  element_t element, item, meta;
261  const gchar *xml;
262 
263  xml = "<cpe-list>" \
264 " <cpe-item name=\"cpe:/a:%240.99_kindle_books_project:%240.99_kindle_books:6::~~~android~~\">" \
265 " <title xml:lang=\"en-US\">$0.99 Kindle Books project $0.99 Kindle Books (aka com.kindle.books.for99) for android 6.0</title>" \
266 " <references>" \
267 " <reference href=\"https://play.google.com/store/apps/details?id=com.kindle.books.for99\">Product information</reference>" \
268 " <reference href=\"https://docs.google.com/spreadsheets/d/1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/edit?pli=1#gid=1053404143\">Government Advisory</reference>" \
269 " </references>" \
270 " <meta:item-metadata nvd-id=\"289692\" status=\"FINAL\" modification-date=\"2014-11-10T17:01:25.103Z\"/>" \
271 " </cpe-item>" \
272 "</cpe-list>";
273 
274  assert_that (parse_element (xml, &element), is_equal_to (0));
275 
276  assert_that (element_name (element), is_equal_to_string ("cpe-list"));
277  item = element_child (element, "cpe-item");
278  assert_that (item, is_not_null);
279  meta = element_child (item, "meta:item-metadata");
280  assert_that (meta, is_not_null);
281  assert_that (element_name (meta), is_equal_to_string ("meta:item-metadata"));
282 }
283 
284 Ensure (xmlutils, parse_element_item_metadata_with_namespace)
285 {
286  element_t element, item, meta;
287  const gchar *xml;
288 
289  xml = "<cpe-list xmlns=\"http://cpe.mitre.org/dictionary/2.0\" xmlns:ns6=\"http://scap.nist.gov/schema/scap-core/0.1\" xmlns:config=\"http://scap.nist.gov/schema/configuration/0.1\" xmlns:meta=\"http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2\" xmlns:cpe-23=\"http://scap.nist.gov/schema/cpe-extension/2.3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:scap-core=\"http://scap.nist.gov/schema/scap-core/0.3\" xsi:schemaLocation=\"http://cpe.mitre.org/dictionary/2.0 https://scap.nist.gov/schema/cpe/2.2/cpe-dictionary_2.2.xsd http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2 https://scap.nist.gov/schema/cpe/2.1/cpe-dictionary-metadata_0.2.xsd http://scap.nist.gov/schema/scap-core/0.3 https://scap.nist.gov/schema/nvd/scap-core_0.3.xsd http://scap.nist.gov/schema/configuration/0.1 https://scap.nist.gov/schema/nvd/configuration_0.1.xsd http://scap.nist.gov/schema/scap-core/0.1 https://scap.nist.gov/schema/nvd/scap-core_0.1.xsd\">" \
290 " <cpe-item name=\"cpe:/a:%240.99_kindle_books_project:%240.99_kindle_books:6::~~~android~~\">" \
291 " <title xml:lang=\"en-US\">$0.99 Kindle Books project $0.99 Kindle Books (aka com.kindle.books.for99) for android 6.0</title>" \
292 " <references>" \
293 " <reference href=\"https://play.google.com/store/apps/details?id=com.kindle.books.for99\">Product information</reference>" \
294 " <reference href=\"https://docs.google.com/spreadsheets/d/1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/edit?pli=1#gid=1053404143\">Government Advisory</reference>" \
295 " </references>" \
296 " <meta:item-metadata nvd-id=\"289692\" status=\"FINAL\" modification-date=\"2014-11-10T17:01:25.103Z\"/>" \
297 " </cpe-item>" \
298 "</cpe-list>";
299 
300  assert_that (parse_element (xml, &element), is_equal_to (0));
301 
302  assert_that (element_name (element), is_equal_to_string ("cpe-list"));
303  item = element_child (element, "cpe-item");
304  assert_that (item, is_not_null);
305  meta = element_child (item, "item-metadata");
306  assert_that (meta, is_not_null);
307  // NB
308  assert_that (element_name (meta), is_equal_to_string ("item-metadata"));
309  //assert_that (element_name (meta), is_equal_to_string ("meta:item-metadata"));
310 }
311 
312 Ensure (xmlutils, parse_element_item_handles_cdata)
313 {
314  element_t element;
315  const gchar *xml;
316 
317  xml = "<description><![CDATA[Several vulnerabilities were discovered in the Chromium browser. The Common Vulnerabilities and Exposures project identifies the following problems: CVE-2011-1108 Google Chrome before 9.0.597.107 does not properly implement JavaScript dialogs, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via a crafted HTML document. CVE-2011-1109 Google Chrome before 9.0.597.107 does not properly process nodes in Cascading Style Sheets stylesheets, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale pointer.&quot; CVE-2011-1113 Google Chrome before 9.0.597.107 on 64-bit Linux platforms does not properly perform pickle deserialization, which allows remote attackers to cause a denial of service via unspecified vectors. CVE-2011-1114 Google Chrome before 9.0.597.107 does not properly handle tables, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale node.&quot; CVE-2011-1115 Google Chrome before 9.0.597.107 does not properly render tables, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale pointer.&quot; CVE-2011-1121 Integer overflow in Google Chrome before 9.0.597.107 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors involving a TEXTAREA element. CVE-2011-1122 The WebGL implementation in Google Chrome before 9.0.597.107 allows remote attackers to cause a denial of service via unspecified vectors, aka Issue 71960. In addition, this upload fixes the following issues : Out-of-bounds read in text searching [69640] Memory corruption in SVG fonts. [72134] Memory corruption with counter nodes. [69628] Stale node in box layout. [70027] Cross-origin error message leak with workers. [70336] Stale pointer in table painting. [72028] Stale pointer with SVG cursors. [73746]]]></description>";
318 
319  assert_that (parse_element (xml, &element), is_equal_to (0));
320  assert_that (element_name (element), is_equal_to_string ("description"));
321  assert_that (element_text (element), is_equal_to_string ("Several vulnerabilities were discovered in the Chromium browser. The Common Vulnerabilities and Exposures project identifies the following problems: CVE-2011-1108 Google Chrome before 9.0.597.107 does not properly implement JavaScript dialogs, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via a crafted HTML document. CVE-2011-1109 Google Chrome before 9.0.597.107 does not properly process nodes in Cascading Style Sheets stylesheets, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale pointer.&quot; CVE-2011-1113 Google Chrome before 9.0.597.107 on 64-bit Linux platforms does not properly perform pickle deserialization, which allows remote attackers to cause a denial of service via unspecified vectors. CVE-2011-1114 Google Chrome before 9.0.597.107 does not properly handle tables, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale node.&quot; CVE-2011-1115 Google Chrome before 9.0.597.107 does not properly render tables, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors that lead to a &quot;stale pointer.&quot; CVE-2011-1121 Integer overflow in Google Chrome before 9.0.597.107 allows remote attackers to cause a denial of service or possibly have unspecified other impact via vectors involving a TEXTAREA element. CVE-2011-1122 The WebGL implementation in Google Chrome before 9.0.597.107 allows remote attackers to cause a denial of service via unspecified vectors, aka Issue 71960. In addition, this upload fixes the following issues : Out-of-bounds read in text searching [69640] Memory corruption in SVG fonts. [72134] Memory corruption with counter nodes. [69628] Stale node in box layout. [70027] Cross-origin error message leak with workers. [70336] Stale pointer in table painting. [72028] Stale pointer with SVG cursors. [73746]"));
322 }
323 
324 /* element_next. */
325 
326 Ensure (xmlutils, element_next_handles_multiple_children)
327 {
328  element_t element, child;
329  const gchar *xml;
330 
331  xml = "<top><a>1</a><b>2</b><c>3</c></top>";
332 
333  assert_that (parse_element (xml, &element), is_equal_to (0));
334 
335  assert_that (element_name (element), is_equal_to_string ("top"));
336 
337  child = element_first_child (element);
338  assert_that (child, is_not_null);
339  assert_that (element_name (child), is_equal_to_string ("a"));
340  assert_that (element_text (child), is_equal_to_string ("1"));
341 
342  child = element_next (child);
343  assert_that (child, is_not_null);
344  assert_that (element_name (child), is_equal_to_string ("b"));
345  assert_that (element_text (child), is_equal_to_string ("2"));
346 
347  child = element_next (child);
348  assert_that (child, is_not_null);
349  assert_that (element_name (child), is_equal_to_string ("c"));
350  assert_that (element_text (child), is_equal_to_string ("3"));
351 }
352 
353 Ensure (xmlutils, parse_element_free_using_child)
354 {
355  element_t element;
356  const gchar *xml;
357 
358  xml = "<a><b><c>1</c></b></a>";
359 
360  assert_that (parse_element (xml, &element), is_equal_to (0));
361  assert_that (element_name (element), is_equal_to_string ("a"));
362  element = element_child (element, "b");
363  assert_that (element, is_not_null);
364  element = element_child (element, "c");
365  assert_that (element, is_not_null);
366  element_free (element);
367 }
368 
369 /* Test suite. */
370 
371 int
372 main (int argc, char **argv)
373 {
374  TestSuite *suite;
375 
376  suite = create_test_suite ();
377 
378  add_test_with_context (suite, xmlutils, parse_entity_parses_simple_xml);
379  add_test_with_context (suite, xmlutils, parse_entity_parses_xml_with_attributes);
380  add_test_with_context (suite, xmlutils, parse_entity_handles_declaration);
381  add_test_with_context (suite, xmlutils, parse_entity_handles_namespace);
382  add_test_with_context (suite, xmlutils, parse_entity_oval_timestamp);
383 
384  add_test_with_context (suite, xmlutils, next_entities_handles_multiple_children);
385 
386  add_test_with_context (suite, xmlutils, parse_element_parses_simple_xml);
387  add_test_with_context (suite, xmlutils, parse_element_parses_xml_with_attributes);
388  add_test_with_context (suite, xmlutils, parse_element_handles_declaration);
389  add_test_with_context (suite, xmlutils, parse_element_handles_namespace);
390  add_test_with_context (suite, xmlutils, parse_element_oval_timestamp);
391  add_test_with_context (suite, xmlutils, parse_element_item_metadata);
392  add_test_with_context (suite, xmlutils, parse_element_item_metadata_with_namespace);
393  add_test_with_context (suite, xmlutils, parse_element_item_handles_cdata);
394  add_test_with_context (suite, xmlutils, parse_element_free_using_child);
395 
396  add_test_with_context (suite, xmlutils, element_next_handles_multiple_children);
397 
398  if (argc > 1)
399  return run_single_test (suite, argv[1], create_text_reporter ());
400 
401  return run_test_suite (suite, create_text_reporter ());
402 }
element_text
gchar * element_text(element_t element)
Get text of an element.
Definition: xmlutils.c:1816
entity_attribute
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
Definition: xmlutils.c:230
element_attribute
gchar * element_attribute(element_t element, const gchar *name)
Get an attribute of an element.
Definition: xmlutils.c:1840
entity_child
entity_t entity_child(entity_t entity, const char *name)
Get a child of an entity.
Definition: xmlutils.c:207
element_child
element_t element_child(element_t element, const gchar *name)
Get a child of an element.
Definition: xmlutils.c:1765
BeforeEach
BeforeEach(xmlutils)
Definition: xmlutils_tests.c:26
first_entity
entity_t first_entity(entities_t entities)
Return the first entity from an entities_t.
Definition: xmlutils.c:96
AfterEach
AfterEach(xmlutils)
Definition: xmlutils_tests.c:29
entity_s::entities
entities_t entities
Children.
Definition: xmlutils.h:70
entity_text
char * entity_text(entity_t entity)
Get the text an entity.
Definition: xmlutils.c:159
parse_element
int parse_element(const gchar *string, element_t *element)
Read an XML element tree from a string.
Definition: xmlutils.c:1682
element_first_child
element_t element_first_child(element_t element)
Get the first child of an element.
Definition: xmlutils.c:1887
main
int main(int argc, char **argv)
Definition: xmlutils_tests.c:372
entity_name
char * entity_name(entity_t entity)
Get the name an entity.
Definition: xmlutils.c:175
next_entities
entities_t next_entities(entities_t entities)
Return all the entities from an entities_t after the first.
Definition: xmlutils.c:81
Describe
Describe(xmlutils)
element_t
struct _xmlNode * element_t
Definition: xmlutils.h:170
xmlutils.c
Simple XML reader.
element_free
void element_free(element_t element)
Free an entire element tree.
Definition: xmlutils.c:1713
element_name
const gchar * element_name(element_t element)
Get the name of an element.
Definition: xmlutils.c:1730
entity_s
XML element.
Definition: xmlutils.h:65
element_next
element_t element_next(element_t element)
Get the next sibling of an element.
Definition: xmlutils.c:1902
Ensure
Ensure(xmlutils, parse_entity_parses_simple_xml)
Definition: xmlutils_tests.c:35
entities_t
GSList * entities_t
Entities.
Definition: xmlutils.h:60
parse_entity
int parse_entity(const char *string, entity_t *entity)
Read an XML entity tree from a string.
Definition: xmlutils.c:1191