-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnxml.h
65 lines (53 loc) · 1.01 KB
/
nxml.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* NXML is not an XML parser.
*
* Project: svg2ass
* File: nxml.h
* Created: 2014-10-27
* Author: Urban Wallasch
*
* See LICENSE file for more details.
*/
#ifndef H_NXML_INCLUDED
#define H_NXML_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
typedef enum nxmlTagtype {
NXML_TYPE_EMPTY = 0,
NXML_TYPE_CONTENT,
NXML_TYPE_PARENT,
NXML_TYPE_SELF,
NXML_TYPE_END,
NXML_TYPE_COMMENT,
NXML_TYPE_CDATA,
NXML_TYPE_PROC,
NXML_TYPE_DOCTYPE,
} nxmlTagtype_t;
typedef enum nxmlEvent {
NXML_EVT_BEGIN = 0,
NXML_EVT_END,
NXML_EVT_TEXT,
NXML_EVT_OPEN,
NXML_EVT_CLOSE,
} nxmlEvent_t;
typedef struct {
const char *name;
const char *val;
} nxmlAttrib_t;
typedef struct {
nxmlTagtype_t type;
const char *name;
nxmlAttrib_t *att;
size_t att_num;
size_t att_sz;
int error;
} nxmlNode_t;
typedef int (*nxmlCb_t)( nxmlEvent_t evt, const nxmlNode_t *node, void *usr );
int nxmlParse( char *buf, nxmlCb_t cb, void *usr );
#ifdef __cplusplus
}
#endif
#endif // H_NXML_INCLUDED
/* EOF */