4 #include <prop/proplib.h>
6 int main(int argc
, char *argv
[])
10 prop_object_iterator_t pit
;
14 /* Check argument count */
16 fprintf(stderr
, "usage: %s <data.xml>\n", getprogname());
20 /* Read array contents from external XML file */
21 pa
= prop_array_internalize_from_file(argv
[1]);
23 errx(EXIT_FAILURE
, "prop_array_internalize_from_file() failed\n");
25 /* Skim through every item of the array */
26 for (i
= 0; i
< prop_array_count(pa
); i
++) {
27 s
= prop_string_cstring_nocopy(prop_array_get(pa
, i
));
31 /* We will now iterate through the items of the array,
32 * but this time we will exploit a prop_array_iterator_t
34 pit
= prop_array_iterator(pa
);
36 prop_object_release(pa
);
37 errx(EXIT_FAILURE
, "prop_array_iterator() failed\n");
40 while((po
= prop_object_iterator_next(pit
)) != NULL
)
41 printf("%s\n", prop_string_cstring_nocopy(po
));
44 prop_object_release(pa
);
45 prop_object_iterator_release(pit
);