17#ifndef _ASTERISK_XML_H
18#define _ASTERISK_XML_H
28struct ast_xml_xpath_results;
77struct ast_xml_node *
ast_xml_new_child(
struct ast_xml_node *parent,
const char *child_name);
86struct ast_xml_node *
ast_xml_add_child(
struct ast_xml_node *parent,
struct ast_xml_node *child);
189struct ast_xml_node *
ast_xml_find_element(
struct ast_xml_node *root_node,
const char *
name,
const char *attrname,
const char *attrvalue);
201#define ast_xml_find_child_element(_parent_node, _name, _attrname, _attrvalue) \
202 ast_xml_find_element(ast_xml_node_get_children(_parent_node), _name, _attrname, _attrvalue)
320struct ast_xml_xpath_results *
ast_xml_query(
struct ast_xml_doc *doc,
const char *xpath_str);
352struct ast_xslt_doc *ast_xslt_read_memory(
char *buffer,
size_t size);
361struct ast_xslt_doc *ast_xslt_open(
char *filename);
368void ast_xslt_close(
struct ast_xslt_doc *xslt);
381struct ast_xml_doc *ast_xslt_apply(
struct ast_xslt_doc *xslt,
struct ast_xml_doc *doc,
const char **params);
394int ast_xslt_save_result_to_string(
char **buffer,
int *length,
struct ast_xml_doc *
result,
395 struct ast_xslt_doc *xslt);
Vector container support.
#define AST_VECTOR(name, type)
Define a vector structure.
struct ast_xml_node * ast_xml_copy_node_list(struct ast_xml_node *list)
Create a copy of a n ode list.
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.
struct ast_xml_node * ast_xml_node_get_children(struct ast_xml_node *node)
Get the node's children.
const char * ast_xml_get_attribute(struct ast_xml_node *node, const char *attrname)
Get a node attribute by name.
struct ast_xml_node * ast_xml_xpath_get_result(struct ast_xml_xpath_results *results, int n)
Return a specific result node of an XPath query.
const char * ast_xml_get_text(struct ast_xml_node *node)
Get an element content string.
struct ast_xml_ns * ast_xml_find_namespace(struct ast_xml_doc *doc, struct ast_xml_node *node, const char *ns_name)
struct ast_xml_xpath_results * ast_xml_query_with_namespaces(struct ast_xml_doc *doc, const char *xpath_str, struct ast_xml_namespace_def_vector *namespaces)
Execute an XPath query on an XML document with namespaces.
const char * ast_xml_get_ns_href(struct ast_xml_ns *ns)
Get the href of a namespace.
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.
int ast_xml_xpath_num_results(struct ast_xml_xpath_results *results)
Return the number of results from an XPath query.
struct ast_xml_node * ast_xml_new_node(const char *name)
Create a XML node.
struct ast_xml_node * ast_xml_xpath_get_first_result(struct ast_xml_xpath_results *results)
Return the first result node of an XPath query.
void ast_xml_close(struct ast_xml_doc *doc)
Close an already open document and free the used structure.
void ast_xml_doc_dump_memory(struct ast_xml_doc *doc, char **buffer, int *length)
Dump the specified document to a buffer.
const char * ast_xml_node_get_name(struct ast_xml_node *node)
Get the name of a node.
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()
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_node_get_next(struct ast_xml_node *node)
Get the next node in the same level.
struct ast_xml_xpath_results * ast_xml_query(struct ast_xml_doc *doc, const char *xpath_str)
Execute an XPath query on an XML document.
struct ast_xml_node * ast_xml_node_get_prev(struct ast_xml_node *node)
Get the previous node in the same leve.
void ast_xml_xpath_results_free(struct ast_xml_xpath_results *results)
Free the XPath results.
struct ast_xml_doc * ast_xml_new(void)
Create a XML document.
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_text(struct ast_xml_node *node, const char *content)
Set an element content string.
struct ast_xml_node * ast_xml_add_child_list(struct ast_xml_node *parent, struct ast_xml_node *child)
Add a list of child nodes, to a specified parent node.
void ast_xml_free_text(const char *text)
Free a content element that was returned by ast_xml_get_text()
int ast_xml_init(void)
Initialize the XML library implementation. This function is used to setup everything needed to start ...
void ast_xml_set_root(struct ast_xml_doc *doc, struct ast_xml_node *node)
Specify the root node of a XML document.
struct ast_xml_node * ast_xml_node_get_parent(struct ast_xml_node *node)
Get the parent of a specified node.
struct ast_xml_doc * ast_xml_read_memory(char *buffer, size_t size)
Open an XML document that resides in memory.
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_doc * ast_xml_open(char *filename)
Open an XML document.
void ast_xml_set_name(struct ast_xml_node *node, const char *name)
Set or reset an element's name.
struct ast_xml_doc * ast_xml_get_doc(struct ast_xml_node *node)
Get the document based on a node.
void ast_xml_free_node(struct ast_xml_node *node)
Free node.
struct ast_xml_node * ast_xml_get_root(struct ast_xml_doc *doc)
Get the document root node.
const char * ast_xml_get_ns_prefix(struct ast_xml_ns *ns)
Get the prefix of a namespace.