Xml Utils

Xml Utils — An api to read and write xml.

Synopsis

GladeXmlNode *      glade_xml_search_child              (GladeXmlNode *node,
                                                         const gchar *name);
GladeXmlNode *      glade_xml_search_child_required     (GladeXmlNode *tree,
                                                         const gchar *name);
gchar *             glade_xml_get_content               (GladeXmlNode *node_in);
void                glade_xml_set_content               (GladeXmlNode *node_in,
                                                         const gchar *content);
gboolean            glade_xml_get_value_int             (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         int *val);
gboolean            glade_xml_get_value_int_required    (GladeXmlNode *node,
                                                         const gchar *name,
                                                         int *val);
gchar *             glade_xml_get_value_string          (GladeXmlNode *node,
                                                         const gchar *name);
gchar *             glade_xml_get_value_string_required (GladeXmlNode *node,
                                                         const gchar *name,
                                                         const gchar *xtra_info);
gboolean            glade_xml_get_boolean               (GladeXmlNode *node,
                                                         const gchar *name,
                                                         gboolean _default);
void                glade_xml_set_value                 (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *val);
gchar *             glade_xml_get_property_string_required
                                                        (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *xtra);
gchar *             glade_xml_get_property_string       (GladeXmlNode *node_in,
                                                         const gchar *name);
gboolean            glade_xml_get_property_boolean      (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gboolean _default);
gdouble             glade_xml_get_property_double       (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gdouble _default);
gint                glade_xml_get_property_int          (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gint _default);
void                glade_xml_node_set_property_string  (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *string);
void                glade_xml_node_set_property_boolean (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gboolean value);
GladeXmlNode *      glade_xml_node_new                  (GladeXmlContext *context,
                                                         const gchar *name);
GladeXmlNode *      glade_xml_node_new_comment          (GladeXmlContext *context,
                                                         const gchar *comment);
void                glade_xml_node_delete               (GladeXmlNode *node);
GladeXmlNode *      glade_xml_node_get_children         (GladeXmlNode *node);
GladeXmlNode *      glade_xml_node_next                 (GladeXmlNode *node_in);
gboolean            glade_xml_node_verify               (GladeXmlNode *node_in,
                                                         const gchar *name);
gboolean            glade_xml_node_verify_silent        (GladeXmlNode *node_in,
                                                         const gchar *name);
const gchar *       glade_xml_node_get_name             (GladeXmlNode *node_in);
void                glade_xml_node_append_child         (GladeXmlNode *node,
                                                         GladeXmlNode *child);
void                glade_xml_node_remove               (GladeXmlNode *node_in);
gboolean            glade_xml_node_is_comment           (GladeXmlNode *node_in);
GladeXmlNode *      glade_xml_node_next_with_comments   (GladeXmlNode *node_in);
GladeXmlNode *      glade_xml_node_get_children_with_comments
                                                        (GladeXmlNode *node);
GladeXmlNode *      glade_xml_doc_get_root              (GladeXmlDoc *doc);
GladeXmlDoc *       glade_xml_doc_new                   (void);
void                glade_xml_doc_set_root              (GladeXmlDoc *doc,
                                                         GladeXmlNode *node);
void                glade_xml_doc_free                  (GladeXmlDoc *doc_in);
gint                glade_xml_doc_save                  (GladeXmlDoc *doc_in,
                                                         const gchar *full_path);
GladeXmlContext *   glade_xml_context_new               (GladeXmlDoc *doc,
                                                         const gchar *name_space);
void                glade_xml_context_destroy           (GladeXmlContext *context);
void                glade_xml_context_free              (GladeXmlContext *context);
GladeXmlContext *   glade_xml_context_new_from_path     (const gchar *full_path,
                                                         const gchar *nspace,
                                                         const gchar *root_name);
GladeXmlDoc *       glade_xml_context_get_doc           (GladeXmlContext *context);
gboolean            glade_xml_load_sym_from_node        (GladeXmlNode *node_in,
                                                         GModule *module,
                                                         gchar *tagname,
                                                         gpointer *sym_location);

Description

You may need these tools if you are implementing GladeReadWidgetFunc and/or GladeWriteWidgetFunc on your GladeWidgetAdaptor to read and write widgets in custom ways

Details

glade_xml_search_child ()

GladeXmlNode *      glade_xml_search_child              (GladeXmlNode *node,
                                                         const gchar *name);

glade_xml_search_child_required ()

GladeXmlNode *      glade_xml_search_child_required     (GladeXmlNode *tree,
                                                         const gchar *name);

just a small wrapper arround glade_xml_search_child that displays an error if the child was not found

Returns :


glade_xml_get_content ()

gchar *             glade_xml_get_content               (GladeXmlNode *node_in);

Gets a string containing the content of node_in.

node_in :

a GladeXmlNode

Returns :

A newly allocated string

glade_xml_set_content ()

void                glade_xml_set_content               (GladeXmlNode *node_in,
                                                         const gchar *content);

Sets the content of node to content.

node_in :

a GladeXmlNode

content :

a string

glade_xml_get_value_int ()

gboolean            glade_xml_get_value_int             (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         int *val);

Gets an integer value for a node either carried as an attribute or as the content of a child.

node_in :

a GladeXmlNode

name :

a string

val :

a pointer to an int

Returns :

TRUE if the node is found, FALSE otherwise

glade_xml_get_value_int_required ()

gboolean            glade_xml_get_value_int_required    (GladeXmlNode *node,
                                                         const gchar *name,
                                                         int *val);

This is a wrapper around glade_xml_get_value_int(), only it emits a g_warning() if node_in did not contain the requested tag

node :

a GladeXmlNode

name :

a string

val :

a pointer to an int

Returns :


glade_xml_get_value_string ()

gchar *             glade_xml_get_value_string          (GladeXmlNode *node,
                                                         const gchar *name);

glade_xml_get_value_string_required ()

gchar *             glade_xml_get_value_string_required (GladeXmlNode *node,
                                                         const gchar *name,
                                                         const gchar *xtra_info);

glade_xml_get_boolean ()

gboolean            glade_xml_get_boolean               (GladeXmlNode *node,
                                                         const gchar *name,
                                                         gboolean _default);

glade_xml_set_value ()

void                glade_xml_set_value                 (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *val);

Sets the property name in node_in to val

node_in :

a GladeXmlNode

name :

a string

val :

a string

glade_xml_get_property_string_required ()

gchar *             glade_xml_get_property_string_required
                                                        (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *xtra);

glade_xml_get_property_string ()

gchar *             glade_xml_get_property_string       (GladeXmlNode *node_in,
                                                         const gchar *name);

glade_xml_get_property_boolean ()

gboolean            glade_xml_get_property_boolean      (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gboolean _default);

glade_xml_get_property_double ()

gdouble             glade_xml_get_property_double       (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gdouble _default);

glade_xml_get_property_int ()

gint                glade_xml_get_property_int          (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gint _default);

glade_xml_node_set_property_string ()

void                glade_xml_node_set_property_string  (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         const gchar *string);

glade_xml_node_set_property_boolean ()

void                glade_xml_node_set_property_boolean (GladeXmlNode *node_in,
                                                         const gchar *name,
                                                         gboolean value);

glade_xml_node_new ()

GladeXmlNode *      glade_xml_node_new                  (GladeXmlContext *context,
                                                         const gchar *name);

glade_xml_node_new_comment ()

GladeXmlNode *      glade_xml_node_new_comment          (GladeXmlContext *context,
                                                         const gchar *comment);

glade_xml_node_delete ()

void                glade_xml_node_delete               (GladeXmlNode *node);

glade_xml_node_get_children ()

GladeXmlNode *      glade_xml_node_get_children         (GladeXmlNode *node);

glade_xml_node_next ()

GladeXmlNode *      glade_xml_node_next                 (GladeXmlNode *node_in);

glade_xml_node_verify ()

gboolean            glade_xml_node_verify               (GladeXmlNode *node_in,
                                                         const gchar *name);

This is a wrapper around glade_xml_node_verify_silent(), only it emits a g_warning() if node_in has a name different than name.

node_in :

a GladeXmlNode

name :

a string

Returns :

TRUE if node_in's name is equal to name, FALSE otherwise

glade_xml_node_verify_silent ()

gboolean            glade_xml_node_verify_silent        (GladeXmlNode *node_in,
                                                         const gchar *name);

node_in :

a GladeXmlNode

name :

a string

Returns :

TRUE if node_in's name is equal to name, FALSE otherwise

glade_xml_node_get_name ()

const gchar *       glade_xml_node_get_name             (GladeXmlNode *node_in);

glade_xml_node_append_child ()

void                glade_xml_node_append_child         (GladeXmlNode *node,
                                                         GladeXmlNode *child);

glade_xml_node_remove ()

void                glade_xml_node_remove               (GladeXmlNode *node_in);

glade_xml_node_is_comment ()

gboolean            glade_xml_node_is_comment           (GladeXmlNode *node_in);

glade_xml_node_next_with_comments ()

GladeXmlNode *      glade_xml_node_next_with_comments   (GladeXmlNode *node_in);

glade_xml_node_get_children_with_comments ()

GladeXmlNode *      glade_xml_node_get_children_with_comments
                                                        (GladeXmlNode *node);

glade_xml_doc_get_root ()

GladeXmlNode *      glade_xml_doc_get_root              (GladeXmlDoc *doc);

doc :

a GladeXmlDoc

Returns :

the GladeXmlNode that is the document root of doc

glade_xml_doc_new ()

GladeXmlDoc *       glade_xml_doc_new                   (void);

glade_xml_doc_set_root ()

void                glade_xml_doc_set_root              (GladeXmlDoc *doc,
                                                         GladeXmlNode *node);

glade_xml_doc_free ()

void                glade_xml_doc_free                  (GladeXmlDoc *doc_in);

glade_xml_doc_save ()

gint                glade_xml_doc_save                  (GladeXmlDoc *doc_in,
                                                         const gchar *full_path);

glade_xml_context_new ()

GladeXmlContext *   glade_xml_context_new               (GladeXmlDoc *doc,
                                                         const gchar *name_space);

glade_xml_context_destroy ()

void                glade_xml_context_destroy           (GladeXmlContext *context);

glade_xml_context_free ()

void                glade_xml_context_free              (GladeXmlContext *context);

Similar to glade_xml_context_destroy but it also frees the document set in the context


glade_xml_context_new_from_path ()

GladeXmlContext *   glade_xml_context_new_from_path     (const gchar *full_path,
                                                         const gchar *nspace,
                                                         const gchar *root_name);

glade_xml_context_get_doc ()

GladeXmlDoc *       glade_xml_context_get_doc           (GladeXmlContext *context);

glade_xml_load_sym_from_node ()

gboolean            glade_xml_load_sym_from_node        (GladeXmlNode *node_in,
                                                         GModule *module,
                                                         gchar *tagname,
                                                         gpointer *sym_location);