mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-09-29 04:25:55 -04:00
Feature: Added functions to get a node from report XML by it's type
This commit is contained in:
parent
2a370cccd0
commit
c67d9de500
@ -286,6 +286,14 @@ reportxml_node_t * reportxml_get_node_by_attribute(reportxml_t *report, con
|
|||||||
return reportxml_node_get_child_by_attribute(report->root, key, value, include_definitions);
|
return reportxml_node_get_child_by_attribute(report->root, key, value, include_definitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportxml_node_t * reportxml_get_node_by_type(reportxml_t *report, reportxml_node_type_t type, int include_definitions)
|
||||||
|
{
|
||||||
|
if (!report)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return reportxml_node_get_child_by_type(report->root, type, include_definitions);
|
||||||
|
}
|
||||||
|
|
||||||
reportxml_t * reportxml_parse_xmldoc(xmlDocPtr doc)
|
reportxml_t * reportxml_parse_xmldoc(xmlDocPtr doc)
|
||||||
{
|
{
|
||||||
reportxml_node_t *root;
|
reportxml_node_t *root;
|
||||||
@ -822,6 +830,33 @@ reportxml_node_t * reportxml_node_get_child_by_attribute(reportxml_node_t *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reportxml_node_t * reportxml_node_get_child_by_type(reportxml_node_t *node, reportxml_node_type_t type, int include_definitions)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!node)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (node->type == type) {
|
||||||
|
if (refobject_ref(node) != 0)
|
||||||
|
return NULL;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node->type == REPORTXML_NODE_TYPE_DEFINITION && !include_definitions)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < node->childs_len; i++) {
|
||||||
|
reportxml_node_t *ret;
|
||||||
|
|
||||||
|
ret = reportxml_node_get_child_by_type(node->childs[i], type, include_definitions);
|
||||||
|
if (ret != NULL)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int reportxml_node_set_content(reportxml_node_t *node, const char *value)
|
int reportxml_node_set_content(reportxml_node_t *node, const char *value)
|
||||||
{
|
{
|
||||||
const struct nodedef *nodedef;
|
const struct nodedef *nodedef;
|
||||||
|
@ -77,6 +77,8 @@ reportxml_node_t * reportxml_get_root_node(reportxml_t *report);
|
|||||||
* <definition>s are skipped.
|
* <definition>s are skipped.
|
||||||
*/
|
*/
|
||||||
reportxml_node_t * reportxml_get_node_by_attribute(reportxml_t *report, const char *key, const char *value, int include_definitions);
|
reportxml_node_t * reportxml_get_node_by_attribute(reportxml_t *report, const char *key, const char *value, int include_definitions);
|
||||||
|
/* This gets a node by it's type. Otherwise identical to reportxml_get_node_by_attribute() */
|
||||||
|
reportxml_node_t * reportxml_get_node_by_type(reportxml_t *report, reportxml_node_type_t type, int include_definitions);
|
||||||
/* This function parses an XML document and returns the parst report XML document */
|
/* This function parses an XML document and returns the parst report XML document */
|
||||||
reportxml_t * reportxml_parse_xmldoc(xmlDocPtr doc);
|
reportxml_t * reportxml_parse_xmldoc(xmlDocPtr doc);
|
||||||
/* This function renders an report XML document as XML structure */
|
/* This function renders an report XML document as XML structure */
|
||||||
@ -108,6 +110,8 @@ ssize_t reportxml_node_count_child(reportxml_node_t *node);
|
|||||||
reportxml_node_t * reportxml_node_get_child(reportxml_node_t *node, size_t idx);
|
reportxml_node_t * reportxml_node_get_child(reportxml_node_t *node, size_t idx);
|
||||||
/* This gets an child by it's value of the given attribute. See reportxml_get_node_by_attribute() for more details. */
|
/* This gets an child by it's value of the given attribute. See reportxml_get_node_by_attribute() for more details. */
|
||||||
reportxml_node_t * reportxml_node_get_child_by_attribute(reportxml_node_t *node, const char *key, const char *value, int include_definitions);
|
reportxml_node_t * reportxml_node_get_child_by_attribute(reportxml_node_t *node, const char *key, const char *value, int include_definitions);
|
||||||
|
/* This gets a child by it's type. Otherwise identical to reportxml_node_get_child_by_attribute() */
|
||||||
|
reportxml_node_t * reportxml_node_get_child_by_type(reportxml_node_t *node, reportxml_node_type_t type, int include_definitions);
|
||||||
/* This gets and sets the text content of an node (used for <text>) */
|
/* This gets and sets the text content of an node (used for <text>) */
|
||||||
int reportxml_node_set_content(reportxml_node_t *node, const char *value);
|
int reportxml_node_set_content(reportxml_node_t *node, const char *value);
|
||||||
char * reportxml_node_get_content(reportxml_node_t *node);
|
char * reportxml_node_get_content(reportxml_node_t *node);
|
||||||
|
Loading…
Reference in New Issue
Block a user