aboutsummaryrefslogtreecommitdiff
path: root/include/quickmedia/HtmlSearch.h
blob: e3bea33219888b49fa1bd075688da1657c6a9a2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef QUICKMEDIA_HTML_SEARCH_H
#define QUICKMEDIA_HTML_SEARCH_H

#include "NodeSearch.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    const void *doc;
    const void *node;
    void *text;
} QuickMediaHtmlNode;

/* 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);

/* Returns StringView where data is NULL and size is 0 if node doesn't have any text */
const QuickMediaStringView quickmedia_html_node_get_text(QuickMediaHtmlNode *self);

/* @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);

#ifdef __cplusplus
}
#endif

#endif