Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 87 lines (68 sloc) 2.039 kB
712f3a6 tentative rename, etc
Kyle Maxwell authored
1 #ifndef PARSLEY_H_INCLUDED
2 #define PARSLEY_H_INCLUDED
080c0e2 refactored
Kyle Maxwell authored
3
712f3a6 tentative rename, etc
Kyle Maxwell authored
4 #define PARSLEY_BUF_SIZE 1024
080c0e2 refactored
Kyle Maxwell authored
5
960ead7 xslt integrations
Kyle Maxwell authored
6 #include <stdbool.h>
377f684 rprogress
Kyle Maxwell authored
7 #include <libxslt/xslt.h>
8 #include <libxslt/xsltInternals.h>
9 #include <libxslt/transform.h>
c09092a unbundle json
Kyle Maxwell authored
10 #include <json/json.h>
807b446 WIP
Kyle Maxwell authored
11 #include "parsed_xpath.h"
5c7e976 memory handling
Kyle Maxwell authored
12
13
712f3a6 tentative rename, etc
Kyle Maxwell authored
14 static int parsley_debug_mode = 0;
15 static char* last_parsley_error;
efb6e2a fixed bus error
Kyle Maxwell authored
16
080c0e2 refactored
Kyle Maxwell authored
17
712f3a6 tentative rename, etc
Kyle Maxwell authored
18 typedef struct __compiled_parsley {
377f684 rprogress
Kyle Maxwell authored
19 xsltStylesheetPtr stylesheet;
20 char* error;
712f3a6 tentative rename, etc
Kyle Maxwell authored
21 } compiled_parsley;
377f684 rprogress
Kyle Maxwell authored
22
712f3a6 tentative rename, etc
Kyle Maxwell authored
23 typedef struct __parsed_parsley {
ccd5edf parsed dex header
Kyle Maxwell authored
24 xmlDocPtr xml;
1cf8492 free
Kyle Maxwell authored
25 char *error;
712f3a6 tentative rename, etc
Kyle Maxwell authored
26 compiled_parsley *parsley;
27 } parsed_parsley;
ccd5edf parsed dex header
Kyle Maxwell authored
28
712f3a6 tentative rename, etc
Kyle Maxwell authored
29 typedef compiled_parsley * parsleyPtr;
30 typedef parsed_parsley * parsedParsleyPtr;
014bf88 stuff
Kyle Maxwell authored
31
091b7d1 it's alive, muahhahah
Kyle Maxwell authored
32 typedef struct __key_node {
33 char* name;
34 char* use;
35 struct __key_node * next;
36 } key_node;
37
38 typedef key_node * keyPtr;
39
712f3a6 tentative rename, etc
Kyle Maxwell authored
40 typedef struct __parsley_context {
1c80d5d WIP
Kyle Maxwell authored
41 xmlNsPtr ns;
42 xmlNodePtr node;
091b7d1 it's alive, muahhahah
Kyle Maxwell authored
43 struct json_object * json;
44 char* tag;
807b446 WIP
Kyle Maxwell authored
45 pxpathPtr filter;
46 pxpathPtr expr;
187d8bb doc
Kyle Maxwell authored
47 bool magic;
48 bool array;
49 bool string;
50 int flags; //bitmask over following enum
807b446 WIP
Kyle Maxwell authored
51 struct __parsley_context * parent;
52 struct __parsley_context *child;
53 struct __parsley_context *next;
712f3a6 tentative rename, etc
Kyle Maxwell authored
54 } parsley_context;
46d499a checkpoint
Kyle Maxwell authored
55
187d8bb doc
Kyle Maxwell authored
56 enum {
1c3f237 array bang
Kyle Maxwell authored
57 PARSLEY_OPTIONAL = 1,
58 PARSLEY_BANG = 2
187d8bb doc
Kyle Maxwell authored
59 };
60
f15a70f update parsley to take parsing options as bitmask, allow uri specific…
Kyle Maxwell authored
61 enum {
bae7661 WIP, groundwork for new api
Kyle Maxwell authored
62 PARSLEY_OPTIONS_HTML = 1,
63 PARSLEY_OPTIONS_PRUNE = 2,
3859f1f test for disabling remote access
Kyle Maxwell authored
64 PARSLEY_OPTIONS_ALLOW_NET = 4,
137dcf2 fix crash case
Kyle Maxwell authored
65 PARSLEY_OPTIONS_ALLOW_LOCAL = 8,
01ba68f SG optional (failing) [0.607572]
Kyle Maxwell authored
66 PARSLEY_OPTIONS_COLLATE = 16,
4d4ec4f @fizx add option to force input to be utf-8
authored
67 PARSLEY_OPTIONS_SGWRAP = 32,
68 PARSLEY_OPTIONS_FORCE_UTF8 = 64
f15a70f update parsley to take parsing options as bitmask, allow uri specific…
Kyle Maxwell authored
69 };
70
712f3a6 tentative rename, etc
Kyle Maxwell authored
71 typedef parsley_context * contextPtr;
46d499a checkpoint
Kyle Maxwell authored
72
712f3a6 tentative rename, etc
Kyle Maxwell authored
73 void parsed_parsley_free(parsedParsleyPtr);
1cf8492 free
Kyle Maxwell authored
74
4a762e2 default namespaces now work
Kyle Maxwell authored
75 void killDefaultNS(xmlDocPtr doc);
712f3a6 tentative rename, etc
Kyle Maxwell authored
76 void parsley_free(parsleyPtr);
77 parsleyPtr parsley_compile(char* parsley, char* incl);
f15a70f update parsley to take parsing options as bitmask, allow uri specific…
Kyle Maxwell authored
78 parsedParsleyPtr parsley_parse_file(parsleyPtr parsley, char* file, int flags);
79 parsedParsleyPtr parsley_parse_string(parsleyPtr parsley, char* string, size_t size, char* base_uri, int flags);
3859f1f test for disabling remote access
Kyle Maxwell authored
80 parsedParsleyPtr parsley_parse_doc(parsleyPtr, xmlDocPtr, int);
014bf88 stuff
Kyle Maxwell authored
81
1825a62 added sg wrapping feature
pivotal authored
82 void parsleyXsltError(void * ctx, const char * msg, ...);
83
4a45ae6 user-agent support
Kyle Maxwell authored
84 void parsley_set_user_agent(char const *agent);
712f3a6 tentative rename, etc
Kyle Maxwell authored
85 static contextPtr parsley_parsing_context;
091b7d1 it's alive, muahhahah
Kyle Maxwell authored
86
080c0e2 refactored
Kyle Maxwell authored
87 #endif
Something went wrong with that request. Please try again.