Simple C Expat Wrapper (SCEW)
1.1.7
|
Handle element's attributes. More...
Files | |
file | element.h |
SCEW element's handling routines. | |
Functions | |
SCEW_API unsigned int | scew_element_attribute_count (scew_element const *element) |
Returns the number of attributes of the given element. More... | |
SCEW_API scew_list * | scew_element_attributes (scew_element const *element) |
Returns the list of all the element's attributes. More... | |
SCEW_API scew_attribute * | scew_element_attribute_by_name (scew_element const *element, XML_Char const *name) |
Returns the first attribute from the specified element that matches the given name. More... | |
SCEW_API scew_attribute * | scew_element_attribute_by_index (scew_element const *element, unsigned int index) |
Returns the attribute of the given element at the specified zero-based index. More... | |
SCEW_API scew_attribute * | scew_element_add_attribute (scew_element *element, scew_attribute *attribute) |
Adds an existent attribute to the given element. More... | |
SCEW_API scew_attribute * | scew_element_add_attribute_pair (scew_element *element, XML_Char const *name, XML_Char const *value) |
Creates and adds a new attribute to the given element. More... | |
SCEW_API void | scew_element_delete_attribute_all (scew_element *element) |
Deletes all the attributes of the given element. More... | |
SCEW_API void | scew_element_delete_attribute (scew_element *element, scew_attribute *attribute) |
Deletes the given attribute from the specified element. More... | |
SCEW_API void | scew_element_delete_attribute_by_name (scew_element *element, XML_Char const *name) |
Deletes the first attribute of the given element that matches name. More... | |
SCEW_API void | scew_element_delete_attribute_by_index (scew_element *element, unsigned int index) |
Deletes the attribute of the given element at the specified zero-based index. More... | |
Handle element's attributes.
SCEW_API unsigned int scew_element_attribute_count | ( | scew_element const * | element | ) |
Returns the number of attributes of the given element.
An element can have zero or more attributes.
SCEW_API scew_list* scew_element_attributes | ( | scew_element const * | element | ) |
Returns the list of all the element's attributes.
This is the internal list where element's attributes are stored, so no modifications or deletions should be performed on this list.
SCEW_API scew_attribute* scew_element_attribute_by_name | ( | scew_element const * | element, |
XML_Char const * | name | ||
) |
Returns the first attribute from the specified element that matches the given name.
Remember that XML attributes are case-sensitive.
SCEW_API scew_attribute* scew_element_attribute_by_index | ( | scew_element const * | element, |
unsigned int | index | ||
) |
Returns the attribute of the given element at the specified zero-based index.
SCEW_API scew_attribute* scew_element_add_attribute | ( | scew_element * | element, |
scew_attribute * | attribute | ||
) |
Adds an existent attribute to the given element.
It is important to note that the given attribute will be part of the element's attributes (ownership is lost), so it should not be later freed, and it should not be part of another attribute element list.
Also note that, if the attribute already existed, the old value will be overwritten and the given attribute will not become part of the element's attribute list (only the old value is updated).
SCEW_API scew_attribute* scew_element_add_attribute_pair | ( | scew_element * | element, |
XML_Char const * | name, | ||
XML_Char const * | value | ||
) |
Creates and adds a new attribute to the given element.
An attribute is formed by a pair (name, value).
If the attribute already existed, the old value will be overwritten, thus the new attribute will not be created (only the old value is updated).
SCEW_API void scew_element_delete_attribute_all | ( | scew_element * | element | ) |
Deletes all the attributes of the given element.
This will also automatically free all the attributes.
SCEW_API void scew_element_delete_attribute | ( | scew_element * | element, |
scew_attribute * | attribute | ||
) |
Deletes the given attribute from the specified element.
This will also automatically free the given attribute.
SCEW_API void scew_element_delete_attribute_by_name | ( | scew_element * | element, |
XML_Char const * | name | ||
) |
Deletes the first attribute of the given element that matches name.
This will also automatically free the attribute.
SCEW_API void scew_element_delete_attribute_by_index | ( | scew_element * | element, |
unsigned int | index | ||
) |
Deletes the attribute of the given element at the specified zero-based index.
This will also automatically free the attribute.