![]() |
The Open FUSION Toolkit 26.6
An open-source framework for fusion and plasma science and engineering
|
#include <string.h>#include <stdlib.h>#include <libxml/parser.h>Functions | |
| void | oft_xml_free_doc (void *doc_ptr) |
| void | oft_xml_free_ptr (void *gen_ptr) |
| int | oft_xml_get_attribute (const void *node_ptr, const char *attr_name, char **content, int *content_len) |
| int | oft_xml_get_content (const void *node_ptr, char **content, int *content_len) |
| int | oft_xml_get_element (const void *parent_ptr, const char *name, int index, void **element_ptr) |
| int | oft_xml_get_elements (const void *parent_ptr, const char *name, int *n, void **elements_ptr) |
| int | oft_xml_get_root (const void *doc_ptr, void **root_ptr) |
| int | oft_xml_has_attribute (const void *node_ptr, const char *attr_name) |
| int | oft_xml_parse_file (const char *filepath, void **doc_ptr) |
| void oft_xml_free_doc | ( | void * | doc_ptr | ) |
Free an XML document previously parsed with oft_xml_load_file
| doc_ptr | Pointer to xmlDoc |
| void oft_xml_free_ptr | ( | void * | gen_ptr | ) |
Free a C array/object
| gen_ptr | Pointer to be freed |
| int oft_xml_get_attribute | ( | const void * | node_ptr, |
| const char * | attr_name, | ||
| char ** | content, | ||
| int * | content_len ) |
Extract the string value of a given attribute on a given xml node
| node_ptr | Pointer to xmlNode |
| attr_name | Null-terminated attribute name |
| content | Output character buffer (null-terminated) |
| content_len | Size of content buffer |
| int oft_xml_get_content | ( | const void * | node_ptr, |
| char ** | content, | ||
| int * | content_len ) |
Extract the string content from a given xml node.
| node_ptr | Pointer to xmlNode |
| content | Output character buffer (null-terminated) |
| content_len | Size of content buffer |
| int oft_xml_get_element | ( | const void * | parent_ptr, |
| const char * | name, | ||
| int | index, | ||
| void ** | element_ptr ) |
Retrieve a pointer to the i-th xml node with a given name contained within a specified parent node (1-based index)
| parent_ptr | Pointer to parent xmlNode |
| name | Null-terminated element name to search for |
| index | 1-based index among matching children |
| element_ptr | Output pointer to matching xmlNode |
| int oft_xml_get_elements | ( | const void * | parent_ptr, |
| const char * | name, | ||
| int * | n, | ||
| void ** | elements_ptr ) |
Retrieve pointers to all xml nodes with a given name contained within a specified parent node
| parent_ptr | Pointer to parent xmlNode (cast to void*) |
| name | Null-terminated element name to search for |
| n | Output count of matching children |
| elements_ptr | Output pointer to array of pointers to matching xmlNodes |
| int oft_xml_get_root | ( | const void * | doc_ptr, |
| void ** | root_ptr ) |
Retrieve a pointer to the root element of an XML document
| doc_ptr | Pointer to xmlDoc |
| root_ptr | Output pointer to root xmlNode |
| int oft_xml_has_attribute | ( | const void * | node_ptr, |
| const char * | attr_name ) |
Test if a given xml node has a specified attribute
| node_ptr | Pointer to xmlNode |
| attr_name | Null-terminated attribute name |
| int oft_xml_parse_file | ( | const char * | filepath, |
| void ** | doc_ptr ) |
Parse an XML file from a given file path
| filepath | Null-terminated path to XML file |
| doc_ptr | Output pointer to xmlDoc |