diff options
author | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-05-08 17:17:55 +0000 |
---|---|---|
committer | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-05-08 17:17:55 +0000 |
commit | 8762c62ed2ead22f86319d456c89f33a408937b0 (patch) | |
tree | a04ead699a0a0ef7af0ae50be8aeb991ce12119e /libnautilus-extensions/nautilus-xml-extensions.c | |
parent | 52a27e1c5ff6313c0f97927ad1c88c26823babbd (diff) | |
download | nautilus-8762c62ed2ead22f86319d456c89f33a408937b0.tar.gz |
*** empty log message ***
Diffstat (limited to 'libnautilus-extensions/nautilus-xml-extensions.c')
-rw-r--r-- | libnautilus-extensions/nautilus-xml-extensions.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/libnautilus-extensions/nautilus-xml-extensions.c b/libnautilus-extensions/nautilus-xml-extensions.c index 3e1302895..07424fec5 100644 --- a/libnautilus-extensions/nautilus-xml-extensions.c +++ b/libnautilus-extensions/nautilus-xml-extensions.c @@ -83,3 +83,57 @@ nautilus_xml_get_root_child_by_name_and_property (xmlDocPtr document, property_name, property_value); } + +/** + * nautilus_xml_get_property_for_children + * + * Returns a list of the values for the specified property for all + * children of the node that have the specified name. + * + * @parent: xmlNodePtr representing the node in question. + * @child_name: child element name to look for + * @property: name of propety to reutnr for matching children that have the property + * + * Returns: A list of keywords. + * + **/ +GList * +nautilus_xml_get_property_for_children (xmlNodePtr parent, + const char *child_name, + const char *property_name) +{ + GList *properties; + xmlNode *child; + xmlChar *property; + + properties = NULL; + + for (child = nautilus_xml_get_children (parent); + child != NULL; + child = child->next) { + if (strcmp (child->name, child_name) == 0) { + property = xmlGetProp (child, property_name); + if (property != NULL) { + properties = g_list_prepend (properties, + g_strdup (property)); + xmlFree (property); + } + } + } + + /* + * Reverse so you get them in the same order as the XML file. + */ + properties = g_list_reverse (properties); + + return properties; +} + + + + + + + + + |