Simple C Expat Wrapper (SCEW)
1.1.7
|
Handle element's hierarchy. More...
Files | |
file | element.h |
SCEW element's handling routines. | |
Functions | |
SCEW_API unsigned int | scew_element_count (scew_element const *element) |
Returns the number of children of the specified element. More... | |
SCEW_API scew_element * | scew_element_parent (scew_element const *element) |
Returns the parent of the given element. More... | |
SCEW_API scew_list * | scew_element_children (scew_element const *element) |
Returns the list of all the element's children. More... | |
SCEW_API scew_element * | scew_element_add (scew_element *element, XML_Char const *name) |
Creates and adds, as a child of element, a new element with the given name. More... | |
SCEW_API scew_element * | scew_element_add_pair (scew_element *element, XML_Char const *name, XML_Char const *contents) |
Creates and adds, as a child of element, a new element with the given name and contents. More... | |
SCEW_API scew_element * | scew_element_add_element (scew_element *element, scew_element *child) |
Adds a child to the given element. More... | |
SCEW_API void | scew_element_delete_all (scew_element *element) |
Deletes all the children for the given element. More... | |
SCEW_API void | scew_element_delete_all_by_name (scew_element *element, XML_Char const *name) |
Deletes all the children of the given element that matches name. More... | |
SCEW_API void | scew_element_delete_by_name (scew_element *element, XML_Char const *name) |
Deletes the first child of the given element that matches name. More... | |
SCEW_API void | scew_element_delete_by_index (scew_element *element, unsigned int index) |
Deletes the child of the given element at the specified zero-based index. More... | |
SCEW_API void | scew_element_detach (scew_element *element) |
Detaches the given element from its parent, if any. More... | |
Handle element's hierarchy.
SCEW_API unsigned int scew_element_count | ( | scew_element const * | element | ) |
Returns the number of children of the specified element.
An element can have zero or more children.
SCEW_API scew_element* scew_element_parent | ( | scew_element const * | element | ) |
Returns the parent of the given element.
SCEW_API scew_list* scew_element_children | ( | scew_element const * | element | ) |
Returns the list of all the element's children.
This is the internal list where element's children are stored, so no modifications or deletions should be performed on this list.
SCEW_API scew_element* scew_element_add | ( | scew_element * | element, |
XML_Char const * | name | ||
) |
Creates and adds, as a child of element, a new element with the given name.
SCEW_API scew_element* scew_element_add_pair | ( | scew_element * | element, |
XML_Char const * | name, | ||
XML_Char const * | contents | ||
) |
Creates and adds, as a child of element, a new element with the given name and contents.
SCEW_API scew_element* scew_element_add_element | ( | scew_element * | element, |
scew_element * | child | ||
) |
Adds a child to the given element.
Note that the element being added should be a clean element, that is, an element created with scew_element_create or an element detached from another tree after being detached (via scew_element_detach).
SCEW_API void scew_element_delete_all | ( | scew_element * | element | ) |
Deletes all the children for the given element.
This function deletes all subchildren recursively. This will automatically free the elements.
SCEW_API void scew_element_delete_all_by_name | ( | scew_element * | element, |
XML_Char const * | name | ||
) |
Deletes all the children of the given element that matches name.
This will automatically free the element.
SCEW_API void scew_element_delete_by_name | ( | scew_element * | element, |
XML_Char const * | name | ||
) |
Deletes the first child of the given element that matches name.
This will automatically free the element.
SCEW_API void scew_element_delete_by_index | ( | scew_element * | element, |
unsigned int | index | ||
) |
Deletes the child of the given element at the specified zero-based index.
This will automatically free the element.
SCEW_API void scew_element_detach | ( | scew_element * | element | ) |
Detaches the given element from its parent, if any.
This function only detaches the element, but does not free it. If the element has no parent, this function does not have any effect.