From c5f4811d0ba74715c8e128da133248cc399a6a6a Mon Sep 17 00:00:00 2001 From: Aleksi Lindeman Date: Sat, 25 May 2019 03:58:20 +0200 Subject: Allow reusing doc for multiple xpath searches --- include/quickmedia/HtmlSearch.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/quickmedia') diff --git a/include/quickmedia/HtmlSearch.h b/include/quickmedia/HtmlSearch.h index e3bea33..568e101 100644 --- a/include/quickmedia/HtmlSearch.h +++ b/include/quickmedia/HtmlSearch.h @@ -13,6 +13,10 @@ typedef struct { void *text; } QuickMediaHtmlNode; +typedef struct { + const void *doc; +} QuickMediaHtmlSearch; + /* Returns NULL if attribute doesn't exist or if it doesn't have any value */ const char* quickmedia_html_node_get_attribute_value(QuickMediaHtmlNode *self, const char *attribute_name); @@ -22,7 +26,10 @@ const QuickMediaStringView quickmedia_html_node_get_text(QuickMediaHtmlNode *sel /* @node is only valid within the callback function scope */ typedef void (*QuickMediaHtmlSearchResultCallback)(QuickMediaHtmlNode *node, void *userdata); -int quickmedia_html_find_nodes_xpath(const char *html_source, const char *xpath, QuickMediaHtmlSearchResultCallback result_callback, void *userdata); +int quickmedia_html_search_init(QuickMediaHtmlSearch *self, const char *html_source); +void quickmedia_html_search_deinit(QuickMediaHtmlSearch *self); + +int quickmedia_html_find_nodes_xpath(QuickMediaHtmlSearch *self, const char *xpath, QuickMediaHtmlSearchResultCallback result_callback, void *userdata); #ifdef __cplusplus } -- cgit v1.2.3