mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 13:53:19 +00:00
updated example with correct code to add namespaces to root element.
Original commit message from CVS: updated example with correct code to add namespaces to root element.
This commit is contained in:
parent
a2d4f04d97
commit
605279f143
2 changed files with 14 additions and 6 deletions
|
@ -9,10 +9,14 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
|
||||||
xmlNodePtr child;
|
xmlNodePtr child;
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
|
|
||||||
/* i'm not sure why both of these Ns things are necessary, but they are */
|
/* first see if the namespace is already known */
|
||||||
ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
|
ns = xmlSearchNsByHref (parent->doc, parent, "http://gstreamer.net/gst-test/1.0/");
|
||||||
|
if (ns == NULL) {
|
||||||
|
xmlNodePtr root = xmlDocGetRootElement (parent->doc);
|
||||||
|
/* add namespace to root node */
|
||||||
|
ns = xmlNewNs (root, "http://gstreamer.net/gst-test/1.0/", "test");
|
||||||
|
}
|
||||||
child = xmlNewChild(parent, ns, "comment", NULL);
|
child = xmlNewChild(parent, ns, "comment", NULL);
|
||||||
xmlNewNs (child, "http://gstreamer.net/gst-test/1.0/", "test");
|
|
||||||
|
|
||||||
xmlNewChild(child, NULL, "text", (gchar *)data);
|
xmlNewChild(child, NULL, "text", (gchar *)data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,14 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
|
||||||
xmlNodePtr child;
|
xmlNodePtr child;
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
|
|
||||||
/* i'm not sure why both of these Ns things are necessary, but they are */
|
/* first see if the namespace is already known */
|
||||||
ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
|
ns = xmlSearchNsByHref (parent->doc, parent, "http://gstreamer.net/gst-test/1.0/");
|
||||||
|
if (ns == NULL) {
|
||||||
|
xmlNodePtr root = xmlDocGetRootElement (parent->doc);
|
||||||
|
/* add namespace to root node */
|
||||||
|
ns = xmlNewNs (root, "http://gstreamer.net/gst-test/1.0/", "test");
|
||||||
|
}
|
||||||
child = xmlNewChild(parent, ns, "comment", NULL);
|
child = xmlNewChild(parent, ns, "comment", NULL);
|
||||||
xmlNewNs (child, "http://gstreamer.net/gst-test/1.0/", "test");
|
|
||||||
|
|
||||||
xmlNewChild(child, NULL, "text", (gchar *)data);
|
xmlNewChild(child, NULL, "text", (gchar *)data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue