1 /* Copyright (C) 2019-2021 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);
BeforeEach(xmlutils)26 BeforeEach (xmlutils)
27 {
28 }
AfterEach(xmlutils)29 AfterEach (xmlutils)
30 {
31 }
32 
33 /* parse_entity */
34 
Ensure(xmlutils,parse_entity_parses_simple_xml)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 
Ensure(xmlutils,parse_entity_parses_xml_with_attributes)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 
Ensure(xmlutils,parse_entity_handles_declaration)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 
Ensure(xmlutils,parse_entity_handles_namespace)83 Ensure (xmlutils, parse_entity_handles_namespace)
84 {
85   entity_t entity, b;
86   const gchar *xml;
87 
88   xml =
89     "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><n:b ba1='test'>1</n:b></a>";
90 
91   assert_that (parse_entity (xml, &entity), is_equal_to (0));
92 
93   assert_that (entity_name (entity), is_equal_to_string ("a"));
94 
95   b = entity_child (entity, "n:b");
96   assert_that (entity_name (b), is_equal_to_string ("n:b"));
97 
98   assert_that (entity_text (b), is_equal_to_string ("1"));
99 }
100 
Ensure(xmlutils,parse_entity_oval_timestamp)101 Ensure (xmlutils, parse_entity_oval_timestamp)
102 {
103   gchar *generator_name;
104   entity_t generator, timestamp, entity;
105   const gchar *xml;
106 
107   xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
108         "<oval_definitions "
109         "xsi:schemaLocation=\"http://oval.mitre.org/XMLSchema/"
110         "oval-definitions-5 oval-definitions-schema.xsd "
111         "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux "
112         "linux-definitions-schema.xsd "
113         "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows "
114         "windows-definitions-schema.xsd "
115         "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent "
116         "independent-definitions-schema.xsd "
117         "http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd "
118         "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix "
119         "unix-definitions-schema.xsd\" "
120         "xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\" "
121         "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
122         "xmlns:oval=\"http://oval.mitre.org/XMLSchema/oval-common-5\" "
123         "xmlns:oval-def=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\">"
124         "  <generator>"
125         "    <oval:product_name>The OVAL Repository</oval:product_name>"
126         "    <oval:schema_version>5.10</oval:schema_version>"
127         "    <oval:timestamp>2015-08-20T10:09:07.183-04:00</oval:timestamp>"
128         "  </generator>"
129         "</oval_definitions>";
130 
131   assert_that (parse_entity (xml, &entity), is_equal_to (0));
132 
133   assert_that (entity_name (entity), is_equal_to_string ("oval_definitions"));
134   generator_name = g_strdup ("generator");
135   generator = entity_child (entity, generator_name);
136   g_free (generator_name);
137   assert_that (generator, is_not_null);
138   timestamp = entity_child (generator, "oval:timestamp");
139   assert_that (timestamp, is_not_null);
140   assert_that (entity_text (timestamp),
141                is_equal_to_string ("2015-08-20T10:09:07.183-04:00"));
142 }
143 
144 /* next_entities. */
145 
Ensure(xmlutils,next_entities_handles_multiple_children)146 Ensure (xmlutils, next_entities_handles_multiple_children)
147 {
148   entity_t entity, child;
149   entities_t children;
150   const gchar *xml;
151 
152   xml = "<top><a>1</a><b></b><c>3</c></top>";
153 
154   assert_that (parse_entity (xml, &entity), is_equal_to (0));
155 
156   assert_that (entity_name (entity), is_equal_to_string ("top"));
157 
158   children = entity->entities;
159 
160   child = first_entity (children);
161   assert_that (child, is_not_null);
162   assert_that (entity_name (child), is_equal_to_string ("a"));
163   assert_that (entity_text (child), is_equal_to_string ("1"));
164   children = next_entities (children);
165 
166   child = first_entity (children);
167   assert_that (child, is_not_null);
168   assert_that (entity_name (child), is_equal_to_string ("b"));
169   assert_that (entity_text (child), is_equal_to_string (""));
170   children = next_entities (children);
171 
172   child = first_entity (children);
173   assert_that (child, is_not_null);
174   assert_that (entity_name (child), is_equal_to_string ("c"));
175   assert_that (entity_text (child), is_equal_to_string ("3"));
176   children = next_entities (children);
177 }
178 
179 /* parse_element */
180 
Ensure(xmlutils,parse_element_parses_simple_xml)181 Ensure (xmlutils, parse_element_parses_simple_xml)
182 {
183   element_t element, b;
184   const gchar *xml;
185 
186   xml = "<a><b>1</b></a>";
187 
188   assert_that (parse_element (xml, &element), is_equal_to (0));
189 
190   assert_that (element_name (element), is_equal_to_string ("a"));
191 
192   b = element_child (element, "b");
193   assert_that (element_name (b), is_equal_to_string ("b"));
194 
195   assert_that (element_text (b), is_equal_to_string ("1"));
196 }
197 
Ensure(xmlutils,parse_element_parses_xml_with_attributes)198 Ensure (xmlutils, parse_element_parses_xml_with_attributes)
199 {
200   element_t element, b;
201   const gchar *xml;
202 
203   xml = "<a><b ba1='test'>1</b></a>";
204 
205   assert_that (parse_element (xml, &element), is_equal_to (0));
206 
207   b = element_child (element, "b");
208 
209   assert_that (element_attribute (b, "ba1"), is_equal_to_string ("test"));
210 }
211 
Ensure(xmlutils,parse_element_handles_declaration)212 Ensure (xmlutils, parse_element_handles_declaration)
213 {
214   element_t element, b;
215   const gchar *xml;
216 
217   xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><b ba1='test'>1</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, "b");
224   assert_that (element_name (b), is_equal_to_string ("b"));
225 
226   assert_that (element_text (b), is_equal_to_string ("1"));
227 }
228 
Ensure(xmlutils,parse_element_handles_namespace)229 Ensure (xmlutils, parse_element_handles_namespace)
230 {
231   element_t element, b;
232   const gchar *xml;
233 
234   xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a><n:b ba1='test' "
235         "n2:ba2='test2'>1</n:b></a>";
236 
237   assert_that (parse_element (xml, &element), is_equal_to (0));
238 
239   assert_that (element_name (element), is_equal_to_string ("a"));
240 
241   b = element_child (element, "n:b");
242   assert_that (element_name (b), is_equal_to_string ("n:b"));
243 
244   assert_that (element_text (b), is_equal_to_string ("1"));
245 
246   assert_that (element_attribute (b, "n2:ba2"), is_equal_to_string ("test2"));
247 }
248 
Ensure(xmlutils,parse_element_oval_timestamp)249 Ensure (xmlutils, parse_element_oval_timestamp)
250 {
251   gchar *generator_name;
252   element_t generator, timestamp, element;
253   const gchar *xml;
254 
255   xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
256         "<oval_definitions "
257         "xsi:schemaLocation=\"http://oval.mitre.org/XMLSchema/"
258         "oval-definitions-5 oval-definitions-schema.xsd "
259         "http://oval.mitre.org/XMLSchema/oval-definitions-5#linux "
260         "linux-definitions-schema.xsd "
261         "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows "
262         "windows-definitions-schema.xsd "
263         "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent "
264         "independent-definitions-schema.xsd "
265         "http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd "
266         "http://oval.mitre.org/XMLSchema/oval-definitions-5#unix "
267         "unix-definitions-schema.xsd\" "
268         "xmlns=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\" "
269         "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
270         "xmlns:oval=\"http://oval.mitre.org/XMLSchema/oval-common-5\" "
271         "xmlns:oval-def=\"http://oval.mitre.org/XMLSchema/oval-definitions-5\">"
272         "  <generator>"
273         "    <oval:product_name>The OVAL Repository</oval:product_name>"
274         "    <oval:schema_version>5.10</oval:schema_version>"
275         "    <oval:timestamp>2015-08-20T10:09:07.183-04:00</oval:timestamp>"
276         "  </generator>"
277         "</oval_definitions>";
278 
279   assert_that (parse_element (xml, &element), is_equal_to (0));
280 
281   assert_that (element_name (element), is_equal_to_string ("oval_definitions"));
282   generator_name = g_strdup ("generator");
283   generator = element_child (element, generator_name);
284   g_free (generator_name);
285   assert_that (generator, is_not_null);
286   timestamp = element_child (generator, "oval:timestamp");
287   assert_that (timestamp, is_not_null);
288   assert_that (element_text (timestamp),
289                is_equal_to_string ("2015-08-20T10:09:07.183-04:00"));
290 }
291 
Ensure(xmlutils,parse_element_item_metadata)292 Ensure (xmlutils, parse_element_item_metadata)
293 {
294   element_t element, item, meta;
295   const gchar *xml;
296 
297   xml = "<cpe-list>"
298         "  <cpe-item "
299         "name=\"cpe:/"
300         "a:%240.99_kindle_books_project:%240.99_kindle_books:6::~~~android~~\">"
301         "    <title xml:lang=\"en-US\">$0.99 Kindle Books project $0.99 Kindle "
302         "Books (aka com.kindle.books.for99) for android 6.0</title>"
303         "    <references>"
304         "      <reference "
305         "href=\"https://play.google.com/store/apps/"
306         "details?id=com.kindle.books.for99\">Product information</reference>"
307         "      <reference "
308         "href=\"https://docs.google.com/spreadsheets/d/"
309         "1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/"
310         "edit?pli=1#gid=1053404143\">Government Advisory</reference>"
311         "    </references>"
312         "    <meta:item-metadata nvd-id=\"289692\" status=\"FINAL\" "
313         "modification-date=\"2014-11-10T17:01:25.103Z\"/>"
314         "  </cpe-item>"
315         "</cpe-list>";
316 
317   assert_that (parse_element (xml, &element), is_equal_to (0));
318 
319   assert_that (element_name (element), is_equal_to_string ("cpe-list"));
320   item = element_child (element, "cpe-item");
321   assert_that (item, is_not_null);
322   meta = element_child (item, "meta:item-metadata");
323   assert_that (meta, is_not_null);
324   assert_that (element_name (meta), is_equal_to_string ("meta:item-metadata"));
325 }
326 
Ensure(xmlutils,parse_element_item_metadata_with_namespace)327 Ensure (xmlutils, parse_element_item_metadata_with_namespace)
328 {
329   element_t element, item, meta;
330   const gchar *xml;
331 
332   xml = "<cpe-list xmlns=\"http://cpe.mitre.org/dictionary/2.0\" "
333         "xmlns:ns6=\"http://scap.nist.gov/schema/scap-core/0.1\" "
334         "xmlns:config=\"http://scap.nist.gov/schema/configuration/0.1\" "
335         "xmlns:meta=\"http://scap.nist.gov/schema/cpe-dictionary-metadata/"
336         "0.2\" xmlns:cpe-23=\"http://scap.nist.gov/schema/cpe-extension/2.3\" "
337         "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
338         "xmlns:scap-core=\"http://scap.nist.gov/schema/scap-core/0.3\" "
339         "xsi:schemaLocation=\"http://cpe.mitre.org/dictionary/2.0 "
340         "https://scap.nist.gov/schema/cpe/2.2/cpe-dictionary_2.2.xsd "
341         "http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2 "
342         "https://scap.nist.gov/schema/cpe/2.1/cpe-dictionary-metadata_0.2.xsd "
343         "http://scap.nist.gov/schema/scap-core/0.3 "
344         "https://scap.nist.gov/schema/nvd/scap-core_0.3.xsd "
345         "http://scap.nist.gov/schema/configuration/0.1 "
346         "https://scap.nist.gov/schema/nvd/configuration_0.1.xsd "
347         "http://scap.nist.gov/schema/scap-core/0.1 "
348         "https://scap.nist.gov/schema/nvd/scap-core_0.1.xsd\">"
349         "  <cpe-item "
350         "name=\"cpe:/"
351         "a:%240.99_kindle_books_project:%240.99_kindle_books:6::~~~android~~\">"
352         "    <title xml:lang=\"en-US\">$0.99 Kindle Books project $0.99 Kindle "
353         "Books (aka com.kindle.books.for99) for android 6.0</title>"
354         "    <references>"
355         "      <reference "
356         "href=\"https://play.google.com/store/apps/"
357         "details?id=com.kindle.books.for99\">Product information</reference>"
358         "      <reference "
359         "href=\"https://docs.google.com/spreadsheets/d/"
360         "1t5GXwjw82SyunALVJb2w0zi3FoLRIkfGPc7AMjRF0r4/"
361         "edit?pli=1#gid=1053404143\">Government Advisory</reference>"
362         "    </references>"
363         "    <meta:item-metadata nvd-id=\"289692\" status=\"FINAL\" "
364         "modification-date=\"2014-11-10T17:01:25.103Z\"/>"
365         "  </cpe-item>"
366         "</cpe-list>";
367 
368   assert_that (parse_element (xml, &element), is_equal_to (0));
369 
370   assert_that (element_name (element), is_equal_to_string ("cpe-list"));
371   item = element_child (element, "cpe-item");
372   assert_that (item, is_not_null);
373   meta = element_child (item, "item-metadata");
374   assert_that (meta, is_not_null);
375   // NB
376   assert_that (element_name (meta), is_equal_to_string ("item-metadata"));
377   // assert_that (element_name (meta), is_equal_to_string
378   // ("meta:item-metadata"));
379 }
380 
Ensure(xmlutils,parse_element_item_handles_cdata)381 Ensure (xmlutils, parse_element_item_handles_cdata)
382 {
383   element_t element;
384   const gchar *xml;
385 
386   xml =
387     "<description><![CDATA[Several vulnerabilities were discovered in the "
388     "Chromium browser. The Common Vulnerabilities and Exposures project "
389     "identifies the following problems: CVE-2011-1108 Google Chrome before "
390     "9.0.597.107 does not properly implement JavaScript dialogs, which allows "
391     "remote attackers to cause a denial of service or possibly have "
392     "unspecified other impact via a crafted HTML document. CVE-2011-1109 "
393     "Google Chrome before 9.0.597.107 does not properly process nodes in "
394     "Cascading Style Sheets stylesheets, which allows remote attackers to "
395     "cause a denial of service or possibly have unspecified other impact via "
396     "unknown vectors that lead to a &quot;stale pointer.&quot; CVE-2011-1113 "
397     "Google Chrome before 9.0.597.107 on 64-bit Linux platforms does not "
398     "properly perform pickle deserialization, which allows remote attackers to "
399     "cause a denial of service via unspecified vectors. CVE-2011-1114 Google "
400     "Chrome before 9.0.597.107 does not properly handle tables, which allows "
401     "remote attackers to cause a denial of service or possibly have "
402     "unspecified other impact via unknown vectors that lead to a &quot;stale "
403     "node.&quot; CVE-2011-1115 Google Chrome before 9.0.597.107 does not "
404     "properly render tables, which allows remote attackers to cause a denial "
405     "of service or possibly have unspecified other impact via unknown vectors "
406     "that lead to a &quot;stale pointer.&quot; CVE-2011-1121 Integer overflow "
407     "in Google Chrome before 9.0.597.107 allows remote attackers to cause a "
408     "denial of service or possibly have unspecified other impact via vectors "
409     "involving a TEXTAREA element. CVE-2011-1122 The WebGL implementation in "
410     "Google Chrome before 9.0.597.107 allows remote attackers to cause a "
411     "denial of service via unspecified vectors, aka Issue 71960. In addition, "
412     "this upload fixes the following issues : Out-of-bounds read in text "
413     "searching [69640] Memory corruption in SVG fonts. [72134] Memory "
414     "corruption with counter nodes. [69628] Stale node in box layout. [70027] "
415     "Cross-origin error message leak with workers. [70336] Stale pointer in "
416     "table painting. [72028] Stale pointer with SVG cursors. "
417     "[73746]]]></description>";
418 
419   assert_that (parse_element (xml, &element), is_equal_to (0));
420   assert_that (element_name (element), is_equal_to_string ("description"));
421   assert_that (
422     element_text (element),
423     is_equal_to_string (
424       "Several vulnerabilities were discovered in the Chromium browser. The "
425       "Common Vulnerabilities and Exposures project identifies the following "
426       "problems: CVE-2011-1108 Google Chrome before 9.0.597.107 does not "
427       "properly implement JavaScript dialogs, which allows remote attackers to "
428       "cause a denial of service or possibly have unspecified other impact via "
429       "a crafted HTML document. CVE-2011-1109 Google Chrome before 9.0.597.107 "
430       "does not properly process nodes in Cascading Style Sheets stylesheets, "
431       "which allows remote attackers to cause a denial of service or possibly "
432       "have unspecified other impact via unknown vectors that lead to a "
433       "&quot;stale pointer.&quot; CVE-2011-1113 Google Chrome before "
434       "9.0.597.107 on 64-bit Linux platforms does not properly perform pickle "
435       "deserialization, which allows remote attackers to cause a denial of "
436       "service via unspecified vectors. CVE-2011-1114 Google Chrome before "
437       "9.0.597.107 does not properly handle tables, which allows remote "
438       "attackers to cause a denial of service or possibly have unspecified "
439       "other impact via unknown vectors that lead to a &quot;stale node.&quot; "
440       "CVE-2011-1115 Google Chrome before 9.0.597.107 does not properly render "
441       "tables, which allows remote attackers to cause a denial of service or "
442       "possibly have unspecified other impact via unknown vectors that lead to "
443       "a &quot;stale pointer.&quot; CVE-2011-1121 Integer overflow in Google "
444       "Chrome before 9.0.597.107 allows remote attackers to cause a denial of "
445       "service or possibly have unspecified other impact via vectors involving "
446       "a TEXTAREA element. CVE-2011-1122 The WebGL implementation in Google "
447       "Chrome before 9.0.597.107 allows remote attackers to cause a denial of "
448       "service via unspecified vectors, aka Issue 71960. In addition, this "
449       "upload fixes the following issues : Out-of-bounds read in text "
450       "searching [69640] Memory corruption in SVG fonts. [72134] Memory "
451       "corruption with counter nodes. [69628] Stale node in box layout. "
452       "[70027] Cross-origin error message leak with workers. [70336] Stale "
453       "pointer in table painting. [72028] Stale pointer with SVG cursors. "
454       "[73746]"));
455 }
456 
457 /* element_next. */
458 
Ensure(xmlutils,element_next_handles_multiple_children)459 Ensure (xmlutils, element_next_handles_multiple_children)
460 {
461   element_t element, child;
462   const gchar *xml;
463 
464   xml = "<top><a>1</a><b>2</b><c>3</c></top>";
465 
466   assert_that (parse_element (xml, &element), is_equal_to (0));
467 
468   assert_that (element_name (element), is_equal_to_string ("top"));
469 
470   child = element_first_child (element);
471   assert_that (child, is_not_null);
472   assert_that (element_name (child), is_equal_to_string ("a"));
473   assert_that (element_text (child), is_equal_to_string ("1"));
474 
475   child = element_next (child);
476   assert_that (child, is_not_null);
477   assert_that (element_name (child), is_equal_to_string ("b"));
478   assert_that (element_text (child), is_equal_to_string ("2"));
479 
480   child = element_next (child);
481   assert_that (child, is_not_null);
482   assert_that (element_name (child), is_equal_to_string ("c"));
483   assert_that (element_text (child), is_equal_to_string ("3"));
484 }
485 
Ensure(xmlutils,parse_element_free_using_child)486 Ensure (xmlutils, parse_element_free_using_child)
487 {
488   element_t element;
489   const gchar *xml;
490 
491   xml = "<a><b><c>1</c></b></a>";
492 
493   assert_that (parse_element (xml, &element), is_equal_to (0));
494   assert_that (element_name (element), is_equal_to_string ("a"));
495   element = element_child (element, "b");
496   assert_that (element, is_not_null);
497   element = element_child (element, "c");
498   assert_that (element, is_not_null);
499   element_free (element);
500 }
501 
502 /* Test suite. */
503 
504 int
main(int argc,char ** argv)505 main (int argc, char **argv)
506 {
507   TestSuite *suite;
508 
509   suite = create_test_suite ();
510 
511   add_test_with_context (suite, xmlutils, parse_entity_parses_simple_xml);
512   add_test_with_context (suite, xmlutils,
513                          parse_entity_parses_xml_with_attributes);
514   add_test_with_context (suite, xmlutils, parse_entity_handles_declaration);
515   add_test_with_context (suite, xmlutils, parse_entity_handles_namespace);
516   add_test_with_context (suite, xmlutils, parse_entity_oval_timestamp);
517 
518   add_test_with_context (suite, xmlutils,
519                          next_entities_handles_multiple_children);
520 
521   add_test_with_context (suite, xmlutils, parse_element_parses_simple_xml);
522   add_test_with_context (suite, xmlutils,
523                          parse_element_parses_xml_with_attributes);
524   add_test_with_context (suite, xmlutils, parse_element_handles_declaration);
525   add_test_with_context (suite, xmlutils, parse_element_handles_namespace);
526   add_test_with_context (suite, xmlutils, parse_element_oval_timestamp);
527   add_test_with_context (suite, xmlutils, parse_element_item_metadata);
528   add_test_with_context (suite, xmlutils,
529                          parse_element_item_metadata_with_namespace);
530   add_test_with_context (suite, xmlutils, parse_element_item_handles_cdata);
531   add_test_with_context (suite, xmlutils, parse_element_free_using_child);
532 
533   add_test_with_context (suite, xmlutils,
534                          element_next_handles_multiple_children);
535 
536   if (argc > 1)
537     return run_single_test (suite, argv[1], create_text_reporter ());
538 
539   return run_test_suite (suite, create_text_reporter ());
540 }
541