diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-05-25 03:58:20 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 06:55:04 +0200 |
commit | bc0b7338ed2d4c126c15eaf57aeb84655e0e1cc3 (patch) | |
tree | 0cb334708717bc6304d32320356df64df8f2778c /include | |
parent | 2f9cf2385a90920b1bcbe6cefa899f33c615e2a5 (diff) |
Allow reusing doc for multiple xpath searches
Diffstat (limited to 'include')
-rw-r--r-- | include/quickmedia/HtmlSearch.h | 9 |
1 files changed, 8 insertions, 1 deletions
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 } |