Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7858 views
1
#ifndef MUPDF_FITZ_XML_H
2
#define MUPDF_FITZ_XML_H
3
4
#include "mupdf/fitz/system.h"
5
#include "mupdf/fitz/context.h"
6
7
/*
8
XML document model
9
*/
10
11
typedef struct fz_xml_s fz_xml;
12
13
/*
14
fz_parse_xml: Parse a zero-terminated string into a tree of xml nodes.
15
16
preserve_white: whether to keep or delete all-whitespace nodes.
17
*/
18
fz_xml *fz_parse_xml(fz_context *ctx, unsigned char *buf, int len, int preserve_white);
19
20
/*
21
fz_xml_prev: Return previous sibling of XML node.
22
*/
23
fz_xml *fz_xml_prev(fz_xml *item);
24
25
/*
26
fz_xml_next: Return next sibling of XML node.
27
*/
28
fz_xml *fz_xml_next(fz_xml *item);
29
30
/*
31
fz_xml_up: Return parent of XML node.
32
*/
33
fz_xml *fz_xml_up(fz_xml *item);
34
35
/*
36
fz_xml_down: Return first child of XML node.
37
*/
38
fz_xml *fz_xml_down(fz_xml *item);
39
40
/*
41
fz_xml_is_tag: Return true if the tag name matches.
42
*/
43
int fz_xml_is_tag(fz_xml *item, const char *name);
44
45
/*
46
fz_xml_tag: Return tag of XML node. Return NULL for text nodes.
47
*/
48
char *fz_xml_tag(fz_xml *item);
49
50
/*
51
fz_xml_att: Return the value of an attribute of an XML node.
52
NULL if the attribute doesn't exist.
53
*/
54
char *fz_xml_att(fz_xml *item, const char *att);
55
56
/*
57
fz_xml_text: Return the text content of an XML node.
58
Return NULL if the node is a tag.
59
*/
60
char *fz_xml_text(fz_xml *item);
61
62
/*
63
fz_drop_xml: Free the XML node and all its children and siblings.
64
*/
65
void fz_drop_xml(fz_context *doc, fz_xml *item);
66
67
/*
68
fz_detach_xml: Detach a node from the tree, unlinking it from its parent.
69
*/
70
void fz_detach_xml(fz_xml *node);
71
72
/*
73
fz_debug_xml: Pretty-print an XML tree to stdout.
74
*/
75
void fz_debug_xml(fz_xml *item, int level);
76
77
fz_xml *fz_xml_find(fz_xml *item, const char *tag);
78
fz_xml *fz_xml_find_next(fz_xml *item, const char *tag);
79
fz_xml *fz_xml_find_down(fz_xml *item, const char *tag);
80
81
#endif
82
83