mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 14:43:21 -05:00
75b8f06e25
mxml 4 is binary and source incompatible with 3, and there is no easy way to stay compatible with both. Not great for a library. So replace with libxml2, hopefully that is more stable. Also means we can get rid of all the mxml hacks
45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
#ifndef SRC_MISC_XML_H_
|
|
#define SRC_MISC_XML_H_
|
|
|
|
// This wraps libxml2 and adds some convenience functions
|
|
|
|
typedef void xml_node;
|
|
|
|
char *
|
|
xml_to_string(xml_node *top, const char *xml_declaration);
|
|
|
|
xml_node *
|
|
xml_from_string(const char *string);
|
|
|
|
xml_node *
|
|
xml_from_file(const char *path);
|
|
|
|
void
|
|
xml_free(xml_node *top);
|
|
|
|
xml_node *
|
|
xml_get_node(xml_node *top, const char *path);
|
|
|
|
// Only returns sibling nodes that have the same name as input node
|
|
xml_node *
|
|
xml_get_next(xml_node *top, xml_node *node);
|
|
|
|
const char *
|
|
xml_get_val(xml_node *top, const char *path);
|
|
|
|
const char *
|
|
xml_get_attr(xml_node *top, const char *path, const char *name);
|
|
|
|
// Will create a new XML document with the node as root if parent is NULL
|
|
xml_node *
|
|
xml_new_node(xml_node *parent, const char *name, const char *val);
|
|
|
|
xml_node *
|
|
xml_new_node_textf(xml_node *parent, const char *name, const char *format, ...);
|
|
|
|
// Adds a text node to parent, which must be an element node
|
|
void
|
|
xml_new_text(xml_node *parent, const char *val);
|
|
|
|
#endif /* SRC_MISC_XML_H_ */
|