## GstXML

GstXML — XML save/restore operations of pipelines

## Synopsis

    #include <gst/gst.h>

                GstXML;
    xmlDocPtr   gst_xml_write                   (GstElement *element);
    gint        gst_xml_write_file              (GstElement *element,
                                                 FILE *out);
    GstXML*     gst_xml_new                     (void);
    gboolean    gst_xml_parse_doc               (GstXML *xml,
                                                 xmlDocPtr doc,
                                                 const guchar *root);
    gboolean    gst_xml_parse_file              (GstXML *xml,
                                                 const guchar *fname,
                                                 const guchar *root);
    gboolean    gst_xml_parse_memory            (GstXML *xml,
                                                 guchar *buffer,
                                                 guint size,
                                                 const gchar *root);
    GstElement* gst_xml_get_element             (GstXML *xml,
                                                 const guchar *name);
    GList*      gst_xml_get_topelements         (GstXML *xml);
    GstElement* gst_xml_make_element            (xmlNodePtr cur,
                                                 GstObject *parent);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstXML

## Signal Prototypes

    "object-loaded"
                void        user_function      (GstXML *gstxml,
                                                GstObject *arg1,
                                                gpointer arg2,
                                                gpointer user_data);

## Description

## Details

### GstXML

    typedef struct _GstXML GstXML;

### gst_xml_write ()

    xmlDocPtr   gst_xml_write                   (GstElement *element);

Converts the given element into an XML presentation.

`element` : | The element to write out
Returns : | a pointer to an XML document

### gst_xml_write_file ()

    gint        gst_xml_write_file              (GstElement *element,
                                                 FILE *out);

Converts the given element into XML and writes the formatted XML to an open file.

`element` : | The element to write out
`out` : | an open file, like stdout
Returns : | number of bytes written on success, -1 otherwise.

### gst_xml_new ()

    GstXML*     gst_xml_new                     (void);

Create a new GstXML parser object.

Returns : | a pointer to a new GstXML object.

### gst_xml_parse_doc ()

    gboolean    gst_xml_parse_doc               (GstXML *xml,
                                                 xmlDocPtr doc,
                                                 const guchar *root);

Fills the GstXML object with the elements from the xmlDocPtr.

`xml` : | a pointer to a GstXML object
`doc` : | a pointer to an xml document to parse
`root` : | The name of the root object to build
Returns : | TRUE on success, FALSE otherwise

### gst_xml_parse_file ()

    gboolean    gst_xml_parse_file              (GstXML *xml,
                                                 const guchar *fname,
                                                 const guchar *root);

Fills the GstXML object with the corresponding elements from the XML file fname. Optionally it will only build the element from the element node root (if it is not NULL). This feature is useful if you only want to build a specific element from an XML file but not the pipeline it is embedded in.

Pass "-" as fname to read from stdin. You can also pass a URI of any format that libxml supports, including http.

`xml` : | a pointer to a GstXML object
`fname` : | The filename with the xml description
`root` : | The name of the root object to build
Returns : | TRUE on success, FALSE otherwise

### gst_xml_parse_memory ()

    gboolean    gst_xml_parse_memory            (GstXML *xml,
                                                 guchar *buffer,
                                                 guint size,
                                                 const gchar *root);

Fills the GstXML object with the corresponding elements from an in memory XML buffer.

`xml` : | a pointer to a GstXML object
`buffer` : | a pointer to the in memory XML buffer
`size` : | the size of the buffer
`root` : | the name of the root objects to build
Returns : | TRUE on success

### gst_xml_get_element ()

    GstElement* gst_xml_get_element             (GstXML *xml,
                                                 const guchar *name);

This function is used to get a pointer to the GstElement corresponding to name in the pipeline description. You would use this if you have to do anything to the element after loading.

`xml` : | The GstXML to get the element from
`name` : | The name of element to retreive
Returns : | a pointer to a new GstElement

### gst_xml_get_topelements ()

    GList*      gst_xml_get_topelements         (GstXML *xml);

Retrive a list of toplevel elements.

`xml` : | The GstXML to get the elements from
Returns : | a GList of elements

### gst_xml_make_element ()

    GstElement* gst_xml_make_element            (xmlNodePtr cur,
                                                 GstObject *parent);

Load the element from the XML description

`cur` : | the xml node
`parent` : | the parent of this object when it's loaded
Returns : | the new element

## Signals

### The "object-loaded" signal

    void        user_function                  (GstXML *gstxml,
                                                GstObject *arg1,
                                                gpointer arg2,
                                                gpointer user_data);

@: @: @:

`gstxml` : | the object which received the signal.
`arg1` : |
`arg2` : |
`user_data` : | user data set when the signal handler was connected.