blob: bedde033aa5627d6491a34e10e30d4d528b1d98c (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ifndef QUICKMEDIA_HTML_SEARCH_H
#define QUICKMEDIA_HTML_SEARCH_H
#include "NodeSearch.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
char *data;
size_t size;
size_t capacity;
} QuickMediaString;
typedef struct {
const void *doc;
const void *node;
QuickMediaString text;
} QuickMediaHtmlNode;
typedef struct {
const void *doc;
} QuickMediaHtmlSearch;
/*
Returns NULL if attribute doesn't exist or if it doesn't have any value.
The result is only valid within the callback function scope.
*/
const char* quickmedia_html_node_get_attribute_value(QuickMediaHtmlNode *self, const char *attribute_name);
/*
Returns NULL if the node doesn't have any text.
The result is only valid within the callback function scope.
*/
const char* 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_search_init(QuickMediaHtmlSearch *self, const char *html_source);
void quickmedia_html_search_deinit(QuickMediaHtmlSearch *self);
/* Non-standard xpath. Doesn't use '@' symbol for accessing properties */
int quickmedia_html_find_nodes_xpath(QuickMediaHtmlSearch *self, const char *xpath, QuickMediaHtmlSearchResultCallback result_callback, void *userdata);
#ifdef __cplusplus
}
#endif
#endif
|