element.h File Reference

SCEW element type declaration. More...

#include "types.h"
#include <expat.h>

Go to the source code of this file.

Functions

scew_element * scew_element_create (XML_Char const *name)
void scew_element_free (scew_element *element)
unsigned int scew_element_count (scew_element const *element)
scew_element * scew_element_by_index (scew_element const *parent, unsigned int idx)
scew_element * scew_element_by_name (scew_element const *parent, XML_Char const *name)
scew_element ** scew_element_list (scew_element const *parent, XML_Char const *name, unsigned int *count)
void scew_element_list_free (scew_element **xlist)
XML_Char const * scew_element_name (scew_element const *element)
XML_Char const * scew_element_contents (scew_element const *element)
XML_Char const * scew_element_set_name (scew_element *element, XML_Char const *name)
XML_Char const * scew_element_set_contents (scew_element *element, XML_Char const *data)
scew_element * scew_element_add (scew_element *element, XML_Char const *name)
scew_element * scew_element_add_elem (scew_element *element, scew_element *new_elem)
void scew_element_del (scew_element *element)
void scew_element_del_by_name (scew_element *element, XML_Char const *name)
void scew_element_del_by_index (scew_element *element, unsigned int idx)
void scew_element_list_del (scew_element *element, XML_Char const *name)
scew_attribute * scew_element_add_attr (scew_element *element, scew_attribute *attribute)
scew_attribute * scew_element_add_attr_pair (scew_element *element, XML_Char const *name, XML_Char const *value)
void scew_element_del_attr (scew_element *element, XML_Char const *name)


Detailed Description

SCEW element type declaration.

Author:
Aleix Conchillo Flaque <aleix@member.fsf.org>
Date:
Mon Nov 25, 2002 00:48
Id
element.h 673 2004-03-02 12:39:16Z rene-cvs

Element related functions. SCEW provides functions to access and manipulate the elements of an XML tree.


Function Documentation

scew_element* scew_element_add scew_element *  element,
XML_Char const *  name
 

Adds a new child to the given element with the specified name.

Returns:
the new element created.

scew_attribute* scew_element_add_attr scew_element *  element,
scew_attribute *  attribute
 

Adds an already existent attribute to the element. If the attribute already exist, the old value will be overwritten. It is important to note that the attribute given will be part of the element's attributes (ownership is lost), so it should not be freed.

See also:
attribute.h
Returns:
the new attribute added to the element.

scew_attribute* scew_element_add_attr_pair scew_element *  element,
XML_Char const *  name,
XML_Char const *  value
 

Adds a new attribute to the given element. An attribute is formed by a pair (name, value). Note that if the attribute already exist, the old value will be overwritten.

See also:
attribute.h
Returns:
the new attribute added to the element.

scew_element* scew_element_add_elem scew_element *  element,
scew_element *  new_elem
 

Adds an already existent element (new_elem) as a child of the given element (element). Note that the element being added should be a clean element, that is, an element created with scew_element_create, and not an element from another XML tree.

See also:
scew_element_create
Returns:
the element added.

scew_element* scew_element_by_index scew_element const *  parent,
unsigned int  idx
 

Returns the child element on the specified position. Positions are zero based.

Returns:
the element on the specified position, NULL if there is no element in the position.

scew_element* scew_element_by_name scew_element const *  parent,
XML_Char const *  name
 

Returns the first element child that matches the given name. Remember that XML names are case-sensitive.

Returns:
the first element that matches the given name, NULL if not found.

XML_Char const* scew_element_contents scew_element const *  element  ) 
 

Returns the element contents value. That is the contents between the start and end element tags. Returns NULL if element has no contents.

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_element* scew_element_create XML_Char const *  name  ) 
 

Creates a new element with the given name. This element is not yet related to any XML tree.

void scew_element_del scew_element *  element  ) 
 

This function is equivalent to scew_element_free.

See also:
scew_element_free

void scew_element_del_attr scew_element *  element,
XML_Char const *  name
 

Deletes an attribute from an element.

void scew_element_del_by_index scew_element *  element,
unsigned int  idx
 

Deletes the child element at the specified position.

void scew_element_del_by_name scew_element *  element,
XML_Char const *  name
 

Deletes the first child of the given element that matches name.

void scew_element_free scew_element *  element  ) 
 

Frees an element recursively. That is, it frees all his childs and attributes.

scew_element** scew_element_list scew_element const *  parent,
XML_Char const *  name,
unsigned int *  count
 

Returns a list of elements that matches the name specified. The number of elements is returned in count. The returned pointer must be freed after using it, calling the scew_element_list_free function.

void scew_element_list_del scew_element *  element,
XML_Char const *  name
 

Deletes all child elements of the given element that match name. This function will get an element list created by scew_element_list and will free all the elements in it. Note that this function is not equivalent to scew_element_list_free.

See also:
scew_element_list

void scew_element_list_free scew_element **  xlist  ) 
 

Frees an element list created by scew_element_list.

XML_Char const* scew_element_name scew_element const *  element  ) 
 

Returns the element name or NULL if the element does not exist.

XML_Char const* scew_element_set_contents scew_element *  element,
XML_Char const *  data
 

Sets the new contents to the given element and frees the old one.

Returns:
the new element's contents.

XML_Char const* scew_element_set_name scew_element *  element,
XML_Char const *  name
 

Sets a new name to the given element and frees the old one.

Returns:
the new element name.


Generated on Mon Jun 5 10:20:48 2006 for Intelligence.kdevelop by  doxygen 1.4.6