SqueezeBrains SDK 1.13
XML

Definitions of functions to manage your own custom parameters. More...

Collaboration diagram for XML:

Functions

SB_HANDLE sb_xml_node_get (SB_HANDLE parent, const char *const name)
 Gets the handle of the xml node with the specified name. More...
 
SB_HANDLE sb_xml_node_get_child (SB_HANDLE parent)
 Gets the first child of the node. More...
 
SB_HANDLE sb_xml_node_previous (SB_HANDLE node)
 Gets the previous sibling node. More...
 
SB_HANDLE sb_xml_node_next (SB_HANDLE node)
 Gets the next sibling node. More...
 
SB_HANDLE sb_xml_node_add (SB_HANDLE parent, const char *const name, const char *const content)
 Adds the node to the parent node. More...
 
sb_t_err sb_xml_node_set (SB_HANDLE parent, const char *const name, const char *const content)
 Sets the content of the node with the specified name. The function checks if the node exists and otherwise creates it. If the node exists, the value is updated. More...
 
sb_t_err sb_xml_node_get_name (SB_HANDLE node, char *const str, size_t str_size)
 Gets the name of the current node. More...
 
sb_t_err sb_xml_node_set_attribute (SB_HANDLE node, const char *const attribute_name, const char *const content)
 Sets the content of the attribute with the specified name. More...
 
sb_t_err sb_xml_node_get_attribute (SB_HANDLE node, const char *const attribute_name, char *const str, size_t str_size)
 Gets the content of the attribute with the specified name. More...
 
sb_t_err sb_xml_node_set_itself (SB_HANDLE node, const char *const content)
 Sets the content of the node. More...
 
sb_t_err sb_xml_node_count (SB_HANDLE parent, const char *const name, int *const cnt)
 Gets the number of child nodes with the specified name. More...
 
sb_t_err sb_xml_node_get_string (SB_HANDLE parent, const char *const name, char *const str, size_t str_size)
 Gets the content of the node with the specified name. More...
 
sb_t_err sb_xml_node_get_string_malloc (SB_HANDLE parent, const char *const name, char **const str)
 Gets the content of the node with the specified name, allocating the string of the needed lenght. More...
 
sb_t_err sb_xml_node_remove (SB_HANDLE parent, const char *const name)
 Removes the node with the specified name. More...
 
sb_t_err sb_xml_node_remove_itself (SB_HANDLE node)
 Removes the current node. More...
 

Detailed Description

Definitions of functions to manage your own custom parameters.

See Manage custom parameters for more information.

Function Documentation

◆ sb_xml_node_add()

SB_HANDLE sb_xml_node_add ( SB_HANDLE  parent,
const char *const  name,
const char *const  content 
)

Adds the node to the parent node.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]parentPointer to the parent node
[in]nameName of the node to be added. The string must be compliant to UTF-8 format.
[in]contentContent of the node to be added. The string must be compliant to UTF-8 format.
If NULL a node without text will be added, i.e. a node containing other nodes.
Returns
If successful, returns SB_HANDLE. Otherwise, it returns null.
See also
Manage custom parameters
sb_xml_node_set

◆ sb_xml_node_count()

sb_t_err sb_xml_node_count ( SB_HANDLE  parent,
const char *const  name,
int *const  cnt 
)

Gets the number of child nodes with the specified name.

Parameters
[in]parentPointer to the parent node
[in]nameName of the nodes to count
[out]cntCount of the child nodes with the specified name
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_get()

SB_HANDLE sb_xml_node_get ( SB_HANDLE  parent,
const char *const  name 
)

Gets the handle of the xml node with the specified name.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]parentPointer to the parent node
[in]nameName of the xml node to look for
Returns
If successful, returns SB_HANDLE. Otherwise, it returns null.
See also
Manage custom parameters

◆ sb_xml_node_get_attribute()

sb_t_err sb_xml_node_get_attribute ( SB_HANDLE  node,
const char *const  attribute_name,
char *const  str,
size_t  str_size 
)

Gets the content of the attribute with the specified name.

Parameters
[in]nodePointer to the current node
[in]attribute_nameName of the attribute to get
[out]strString of the content of the attribute to get
[in]str_sizeMax lenght of the string
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_get_child()

SB_HANDLE sb_xml_node_get_child ( SB_HANDLE  parent)

Gets the first child of the node.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]parentPointer to the parent node
Returns
If successful, returns SB_HANDLE. Otherwise, it returns null.
See also
Manage custom parameters

◆ sb_xml_node_get_name()

sb_t_err sb_xml_node_get_name ( SB_HANDLE  node,
char *const  str,
size_t  str_size 
)

Gets the name of the current node.

Parameters
[in]nodePointer to the current node
[out]strString of the name
[in]str_sizeMax lenght of the string
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_get_string()

sb_t_err sb_xml_node_get_string ( SB_HANDLE  parent,
const char *const  name,
char *const  str,
size_t  str_size 
)

Gets the content of the node with the specified name.

Parameters
[in]parentPointer to the parent node
[in]nameName of the node to look for. If NULL the function considers the parent as the current node.
[out]strString of the content of the node
[in]str_sizeMax lenght of the string of the content of the node
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_get_string_malloc()

sb_t_err sb_xml_node_get_string_malloc ( SB_HANDLE  parent,
const char *const  name,
char **const  str 
)

Gets the content of the node with the specified name, allocating the string of the needed lenght.

Attention
The string str MUST be deallocated with sb_free .
Parameters
[in]parentPointer to the parent node
[in]nameName of the node to look for
[out]strString of the content of the node.
The string str MUST be deallocated with sb_free .
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters
sb_free

◆ sb_xml_node_next()

SB_HANDLE sb_xml_node_next ( SB_HANDLE  node)

Gets the next sibling node.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]nodePointer to current node
Returns
If successful, returns SB_HANDLE. Otherwise, it returns null.
See also
Manage custom parameters
sb_xml_node_previous

◆ sb_xml_node_previous()

SB_HANDLE sb_xml_node_previous ( SB_HANDLE  node)

Gets the previous sibling node.

Attention
The handle returned by the function must not the destroyed.
Parameters
[in]nodePointer to current node
Returns
If successful, returns SB_HANDLE. Otherwise, it returns null.
See also
Manage custom parameters
sb_xml_node_previous

◆ sb_xml_node_remove()

sb_t_err sb_xml_node_remove ( SB_HANDLE  parent,
const char *const  name 
)

Removes the node with the specified name.

Parameters
[in]parentPointer to the parent node
[in]nameName of the node to remove
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_remove_itself()

sb_t_err sb_xml_node_remove_itself ( SB_HANDLE  node)

Removes the current node.

Parameters
[in]nodePointer to the current node
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_set()

sb_t_err sb_xml_node_set ( SB_HANDLE  parent,
const char *const  name,
const char *const  content 
)

Sets the content of the node with the specified name. The function checks if the node exists and otherwise creates it. If the node exists, the value is updated.

Parameters
[in]parentPointer to the parent node
[in]nameName of the node to be set
[in]contentContent of the node to be set. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters
sb_xml_node_add

◆ sb_xml_node_set_attribute()

sb_t_err sb_xml_node_set_attribute ( SB_HANDLE  node,
const char *const  attribute_name,
const char *const  content 
)

Sets the content of the attribute with the specified name.

Parameters
[in]nodePointer to the current node
[in]attribute_nameName of the attribute to be set. The string must be compliant to UTF-8 format.
[in]contentContent of the attribute to be set. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters

◆ sb_xml_node_set_itself()

sb_t_err sb_xml_node_set_itself ( SB_HANDLE  node,
const char *const  content 
)

Sets the content of the node.

Parameters
[in]nodePointer to the current node.
[in]contentContent of the node to be set. The string must be compliant to UTF-8 format.
Returns
If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
See also
Manage custom parameters