[DO-981] qt package (!15)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
45
recipes/libxml2/all/test_package/test_package.c
Normal file
45
recipes/libxml2/all/test_package/test_package.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
static void print_element_names(xmlNode *a_node)
|
||||
{
|
||||
xmlNode *cur_node = NULL;
|
||||
for (cur_node = a_node; cur_node; cur_node = cur_node->next)
|
||||
{
|
||||
if (cur_node->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
printf("node type: Element, name: %s\n", cur_node->name);
|
||||
}
|
||||
print_element_names(cur_node->children);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
xmlDoc *doc = NULL;
|
||||
xmlNode *root_element = NULL;
|
||||
|
||||
if (argc != 2)
|
||||
return (1);
|
||||
|
||||
LIBXML_TEST_VERSION
|
||||
|
||||
/*parse the file and get the DOM */
|
||||
doc = xmlReadFile(argv[1], NULL, 0);
|
||||
|
||||
if (doc == NULL)
|
||||
{
|
||||
printf("error: could not parse file %s\n", argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/*Get the root element node */
|
||||
root_element = xmlDocGetRootElement(doc);
|
||||
print_element_names(root_element);
|
||||
xmlFreeDoc(doc); // free document
|
||||
xmlCleanupParser(); // Free globals
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user