Commit cc13aba1 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Feature: Added constants for XML namespaces

parent a8a3207c
......@@ -456,9 +456,9 @@ void admin_send_response(xmlDocPtr doc,
char *json;
if (strcmp((const char *)xmlroot->name, "iceresponse") == 0) {
ns = "http://icecast.org/specs/legacyresponse-0.0.1";
ns = XMLNS_LEGACY_RESPONSE;
} else {
ns = "http://icecast.org/specs/legacystats-0.0.1";
ns = XMLNS_LEGACY_STATS;
}
json = xml2json_render_doc_simple(doc, ns);
......
......@@ -15,6 +15,13 @@
#include "compat.h"
/* ---[ * ]--- */
/* XML namespaces */
#define XMLNS_REPORTXML "http://icecast.org/specs/reportxml-0.0.1"
#define XMLNS_XSPF "http://xspf.org/ns/0/"
#define XMLNS_LEGACY_STATS "http://icecast.org/specs/legacystats-0.0.1"
#define XMLNS_LEGACY_RESPONSE "http://icecast.org/specs/legacyresponse-0.0.1"
/* ---[ client.[ch] ]--- */
typedef struct _client_tag client_t;
......
......@@ -165,7 +165,7 @@ xmlNodePtr playlist_render_xspf(playlist_t *playlist)
rootnode = xmlNewNode(NULL, XMLSTR("playlist"));
xmlSetProp(rootnode, XMLSTR("version"), XMLSTR("1"));
xmlSetProp(rootnode, XMLSTR("xmlns"), XMLSTR("http://xspf.org/ns/0/"));
xmlSetProp(rootnode, XMLSTR("xmlns"), XMLSTR(XMLNS_XSPF));
tracklist = xmlNewNode(NULL, XMLSTR("trackList"));
xmlAddChild(rootnode, tracklist);
......
......@@ -309,7 +309,7 @@ static void render_node_legacystats(json_renderer_t *renderer, xmlDocPtr doc, xm
json_renderer_write_key(renderer, "name", JSON_RENDERER_FLAGS_NONE);
json_renderer_write_string(renderer, "icestats", JSON_RENDERER_FLAGS_NONE);
json_renderer_write_key(renderer, "ns", JSON_RENDERER_FLAGS_NONE);
json_renderer_write_string(renderer, "http://icecast.org/specs/legacystats-0.0.1", JSON_RENDERER_FLAGS_NONE);
json_renderer_write_string(renderer, XMLNS_LEGACY_STATS, JSON_RENDERER_FLAGS_NONE);
json_renderer_end(renderer);
}
json_renderer_begin(renderer, JSON_ELEMENT_TYPE_OBJECT);
......@@ -634,11 +634,11 @@ static void render_node(json_renderer_t *renderer, xmlDocPtr doc, xmlNodePtr nod
href = (const char *)workaroundProp;
if (href) {
if (strcmp(href, "http://icecast.org/specs/legacyresponse-0.0.1") == 0) {
if (strcmp(href, XMLNS_LEGACY_RESPONSE) == 0) {
render = render_node_legacyresponse;
} else if (strcmp(href, "http://icecast.org/specs/legacystats-0.0.1") == 0) {
} else if (strcmp(href, XMLNS_LEGACY_STATS) == 0) {
render = render_node_legacystats;
} else if (strcmp(href, "http://xspf.org/ns/0/") == 0) {
} else if (strcmp(href, XMLNS_XSPF) == 0) {
render = render_node_xspf;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment