Enlightenment CVS committal Author : werkt Project : e17 Module : libs/exml
Dir : e17/libs/exml/src Modified Files: EXML.h exml.c Log Message: Added exml_node_goto for simpler backwards traversal. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/exml/src/EXML.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- EXML.h 18 Jan 2006 21:51:48 -0000 1.3 +++ EXML.h 20 Jan 2006 16:52:32 -0000 1.4 @@ -1,6 +1,9 @@ #ifndef _EXML_H # define _EXML_H +#include <Ecore.h> +#include <Ecore_Data.h> + /** * @file EXML.h * @brief Contains XML reading/writing functions @@ -116,6 +119,7 @@ * the hierarchy (down returns NULL if there are no children) */ inline char *exml_goto_top(EXML *xml); +inline char *exml_goto_node(EXML *xml, EXML_Node *node); inline char *exml_goto(EXML *xml, char *tag, char *value); inline char *exml_next(EXML *xml); inline char *exml_next_nomove(EXML *xml); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/exml/src/exml.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- exml.c 18 Jan 2006 21:51:48 -0000 1.3 +++ exml.c 20 Jan 2006 16:52:32 -0000 1.4 @@ -1,7 +1,5 @@ #include <string.h> -#include <Ecore.h> -#include <Ecore_Data.h> #include <EXML.h> #include <libxml/xmlreader.h> #include <libxml/xmlwriter.h> @@ -289,6 +287,45 @@ } /** + * Move the current xml document pointer to the indicated node + * @param xml The xml document + * @param node The position within the document to move to + * @return The current xml tag name + * @ingroup EXML_Traversal_Group + */ +char *exml_goto_node(EXML *xml, EXML_Node *node) +{ + Ecore_List *stack; + EXML_Node *n, *l; + + CHECK_PARAM_POINTER_RETURN("xml", xml, NULL); + + stack = ecore_list_new(); + n = node; + + while( n->parent != NULL ) { + ecore_list_prepend(stack, n); + n = n->parent; + } + + l = xml->top; + + if( n != l ) + return NULL; + + while( (n = ecore_list_remove_first(stack)) ) { + l = ecore_list_goto(l->children, n); + + if( !l ) + return NULL; + } + + xml->current = node; + + return xml->current ? xml->current->tag : NULL; +} + +/** * Move the current xml document pointer to the tag indicated by @c tag * and @c value * @param xml The xml document ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs