Fri Feb 10 06:37:44 2012

Asterisk developer's documentation


xml.h File Reference

Asterisk XML abstraction layer. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct ast_xml_node * ast_xml_add_child (struct ast_xml_node *parent, struct ast_xml_node *child)
 Add a child node, to a specified parent node.
void ast_xml_close (struct ast_xml_doc *doc)
 Close an already open document and free the used structure.
int ast_xml_doc_dump_file (FILE *output, struct ast_xml_doc *doc)
 Dump the specified document to a file.
struct ast_xml_node * ast_xml_find_element (struct ast_xml_node *root_node, const char *name, const char *attrname, const char *attrvalue)
 Find a node element by name.
struct ast_xml_ns * ast_xml_find_namespace (struct ast_xml_doc *doc, struct ast_xml_node *node, const char *ns_name)
int ast_xml_finish (void)
 Cleanup library allocated global data.
void ast_xml_free_attr (const char *attribute)
 Free an attribute returned by ast_xml_get_attribute().
void ast_xml_free_node (struct ast_xml_node *node)
 Free node.
void ast_xml_free_text (const char *text)
 Free a content element that was returned by ast_xml_get_text().
const char * ast_xml_get_attribute (struct ast_xml_node *node, const char *attrname)
 Get a node attribute by name.
struct ast_xml_doc * ast_xml_get_doc (struct ast_xml_node *node)
 Get the document based on a node.
const char * ast_xml_get_ns_href (struct ast_xml_ns *ns)
struct ast_xml_node * ast_xml_get_root (struct ast_xml_doc *doc)
 Get the document root node.
const char * ast_xml_get_text (struct ast_xml_node *node)
 Get an element content string.
int ast_xml_init (void)
 Initialize the XML library implementation. This function is used to setup everything needed to start working with the xml implementation.
struct ast_xml_doc * ast_xml_new (void)
 Create a XML document.
struct ast_xml_node * ast_xml_new_child (struct ast_xml_node *parent, const char *child_name)
 Add a child node inside a passed parent node.
struct ast_xml_node * ast_xml_new_node (const char *name)
 Create a XML node.
struct ast_xml_node * ast_xml_node_get_children (struct ast_xml_node *node)
 Get the node's children.
const char * ast_xml_node_get_name (struct ast_xml_node *node)
 Get the name of a node.
struct ast_xml_node * ast_xml_node_get_next (struct ast_xml_node *node)
 Get the next node in the same level.
struct ast_xml_node * ast_xml_node_get_parent (struct ast_xml_node *node)
 Get the parent of a specified node.
struct ast_xml_node * ast_xml_node_get_prev (struct ast_xml_node *node)
 Get the previous node in the same leve.
struct ast_xml_doc * ast_xml_open (char *filename)
 Open an XML document.
struct ast_xml_doc * ast_xml_read_memory (char *buffer, size_t size)
 Open an XML document that resides in memory.
int ast_xml_set_attribute (struct ast_xml_node *node, const char *name, const char *value)
 Set an attribute to a node.
void ast_xml_set_root (struct ast_xml_doc *doc, struct ast_xml_node *node)
 Specify the root node of a XML document.
void ast_xml_set_text (struct ast_xml_node *node, const char *content)
 Set an element content string.


Detailed Description

Asterisk XML abstraction layer.

Definition in file xml.h.


Function Documentation

struct ast_xml_node* ast_xml_add_child ( struct ast_xml_node *  parent,
struct ast_xml_node *  child 
) [read]

Add a child node, to a specified parent node.

Parameters:
parent Where to add the child node.
child The child node to add.
Return values:
NULL on error.
non-NULL The add child node on success.

void ast_xml_close ( struct ast_xml_doc *  doc  ) 

Close an already open document and free the used structure.

Return values:
doc The document reference.

int ast_xml_doc_dump_file ( FILE *  output,
struct ast_xml_doc *  doc 
)

Dump the specified document to a file.

struct ast_xml_node* ast_xml_find_element ( struct ast_xml_node *  root_node,
const char *  name,
const char *  attrname,
const char *  attrvalue 
) [read]

Find a node element by name.

Parameters:
root_node This is the node starting point.
name Node name to find.
attrname attribute name to match (if NULL it won't be matched).
attrvalue attribute value to match (if NULL it won't be matched).
Return values:
NULL if not found.
The node on success.

struct ast_xml_ns* ast_xml_find_namespace ( struct ast_xml_doc *  doc,
struct ast_xml_node *  node,
const char *  ns_name 
) [read]

int ast_xml_finish ( void   ) 

Cleanup library allocated global data.

Return values:
0 On success.
1 On error.

void ast_xml_free_attr ( const char *  attribute  ) 

Free an attribute returned by ast_xml_get_attribute().

Parameters:
attribute pointer to be freed.

void ast_xml_free_node ( struct ast_xml_node *  node  ) 

Free node.

Parameters:
node Node to be released.

void ast_xml_free_text ( const char *  text  ) 

Free a content element that was returned by ast_xml_get_text().

Parameters:
text text to be freed.

const char* ast_xml_get_attribute ( struct ast_xml_node *  node,
const char *  attrname 
)

Get a node attribute by name.

Parameters:
node Node where to search the attribute.
attrname Attribute name.
Return values:
NULL on error
The attribute value on success.

struct ast_xml_doc* ast_xml_get_doc ( struct ast_xml_node *  node  )  [read]

Get the document based on a node.

Parameters:
node A node that is part of the dom.
Returns:
The dom pointer where this node resides.

const char* ast_xml_get_ns_href ( struct ast_xml_ns *  ns  ) 

struct ast_xml_node* ast_xml_get_root ( struct ast_xml_doc *  doc  )  [read]

Get the document root node.

Parameters:
doc Document reference
Return values:
NULL on error
The root node on success.

const char* ast_xml_get_text ( struct ast_xml_node *  node  ) 

Get an element content string.

Parameters:
node Node from where to get the string.
Return values:
NULL on error.
The text content of node.

int ast_xml_init ( void   ) 

Initialize the XML library implementation. This function is used to setup everything needed to start working with the xml implementation.

Return values:
0 On success.
1 On error.

struct ast_xml_doc* ast_xml_new ( void   )  [read]

Create a XML document.

Return values:
NULL on error.
non-NULL The allocated document structure.

struct ast_xml_node* ast_xml_new_child ( struct ast_xml_node *  parent,
const char *  child_name 
) [read]

Add a child node inside a passed parent node.

Parameters:
parent The pointer of the parent node.
child_name The name of the child node to add.
Return values:
NULL on error.
non-NULL The created child node pointer.

struct ast_xml_node* ast_xml_new_node ( const char *  name  )  [read]

Create a XML node.

Parameters:
name The name of the node to be created.
Return values:
NULL on error.
non-NULL The allocated node structe.

struct ast_xml_node* ast_xml_node_get_children ( struct ast_xml_node *  node  )  [read]

Get the node's children.

const char* ast_xml_node_get_name ( struct ast_xml_node *  node  ) 

Get the name of a node.

struct ast_xml_node* ast_xml_node_get_next ( struct ast_xml_node *  node  )  [read]

Get the next node in the same level.

struct ast_xml_node* ast_xml_node_get_parent ( struct ast_xml_node *  node  )  [read]

Get the parent of a specified node.

struct ast_xml_node* ast_xml_node_get_prev ( struct ast_xml_node *  node  )  [read]

Get the previous node in the same leve.

struct ast_xml_doc* ast_xml_open ( char *  filename  )  [read]

Open an XML document.

Parameters:
filename Document path.
Return values:
NULL on error.
The ast_xml_doc reference to the open document.

struct ast_xml_doc* ast_xml_read_memory ( char *  buffer,
size_t  size 
) [read]

Open an XML document that resides in memory.

Parameters:
buffer The address where the document is stored
size The number of bytes in the document
Return values:
NULL on error.
The ast_xml_doc reference to the open document.

int ast_xml_set_attribute ( struct ast_xml_node *  node,
const char *  name,
const char *  value 
)

Set an attribute to a node.

Parameters:
node In which node we want to insert the attribute.
name The attribute name.
value The attribute value.
Return values:
0 on success.
-1 on error.

void ast_xml_set_root ( struct ast_xml_doc *  doc,
struct ast_xml_node *  node 
)

Specify the root node of a XML document.

Parameters:
doc The document pointer.
node A pointer to the node we want to set as root node.

void ast_xml_set_text ( struct ast_xml_node *  node,
const char *  content 
)

Set an element content string.

Parameters:
node Node from where to set the content string.
content The text to insert in the node.


Generated on Fri Feb 10 06:37:44 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6