- g_warning("document %s is of wrong type. root *root is "
- "not 'openbox_config'", path);
+ g_warning("document %s is of wrong type. root node is "
+ "not '%s'", path, rootname);
+ }
+ }
+ }
+ if (!*doc)
+ return FALSE;
+ return TRUE;
+}
+
+gboolean parse_load_mem(gpointer data, guint len, const char *rootname,
+ xmlDocPtr *doc, xmlNodePtr *root)
+{
+ if ((*doc = xmlParseMemory(data, len))) {
+ *root = xmlDocGetRootElement(*doc);
+ if (!*root) {
+ xmlFreeDoc(*doc);
+ *doc = NULL;
+ g_warning("Given memory is an empty document");
+ } else {
+ if (xmlStrcasecmp((*root)->name, (const xmlChar*)rootname)) {
+ xmlFreeDoc(*doc);
+ *doc = NULL;
+ g_warning("document in given memory is of wrong type. root "
+ "node is not '%s'", rootname);