46#define XPARSER_ALLOC 2
54 struct xparser_context;
55 typedef struct xparser_context xparser;
138 int xparser_init(xparser* parser, xparser_handlers* handlers,
void* userdata,
unsigned int options);
252 typedef void * (*xparser_alloc) (
int xparser_reset(xparser *parser, int full)
reset a parser to post-create state.
void xparser_setalloc(xparser_alloc pa, void *ud)
Install the default allocator for subsequent xparser_create calls.
xparser_textmode
flags for text handling
Definition: xparser.h:117
const char *const xparser_eventname[xparserLAST]
array lookup for event names
int xparser_finish(xparser *parser)
Check end of input without invoking callbacks.
xparser_event
events for user callbacks
Definition: xparser.h:58
unsigned int xparser_flags(xparser *parser)
Read whitespace-processing flags.
xparser * xparser_createalloc(xparser_alloc pa, void *ud)
Create a parser with its own allocator callback and context.
size_t xparser_count(xparser *parser)
Read the input position.
int(* xparser_callback)(xparser *parser, void *userdata, xparser_event event, const char *name, const char **attr, const char *data)
xparser user callback.
Definition: xparser.h:105
int xparser_parse(xparser *parser, const char *pData, size_t datalen)
parse a chunk of xml data.
int xparser_has_doc(xparser *parser)
Check whether the document node was parsed.
xparser * xparser_create(void)
create a parser.
void *(* xparser_alloc)(void *ud, void *ptr, size_t osize, size_t nsize)
define XPARSER_ALLOC non-zero to enable a user memory allocator.
Definition: xparser.h:252
unsigned int xparser_line(xparser *parser)
Read the source line.
const char * xparser_errormsg(xparser *parser)
Read the last parser error.
void * xparser_userdata(xparser *parser)
Retrieve the application context.
int xparser_term(xparser *parser)
destroy a parser, WITHOUT deallocating pointer.
unsigned int xparser_depth(xparser *parser)
Read the nesting depth.
unsigned int xparser_col(xparser *parser)
Read the source column.
void xparser_destroy(xparser *parser)
destroy a parser
int xparser_init(xparser *parser, xparser_handlers *handlers, void *userdata, unsigned int options)
initialise a parser.
@ xparserPI
processing instruction : <?name data?>
Definition: xparser.h:77
@ xparserEND_ELEMENT
end element : </name>
Definition: xparser.h:75
@ xparserCOMMENT
comment : <!–data-->
Definition: xparser.h:78
@ xparserCDATA
cdata : data
Definition: xparser.h:79
@ xparserINIT
called from xparser_init()
Definition: xparser.h:65
@ xparserSTART_ELEMENT
start element : <name attrs >
Definition: xparser.h:74
@ xparserSTART
called from xparser_parse(), on first call since init() or reset()
Definition: xparser.h:68
@ xparserXML
xml declaration : <?xml attrs ?>
Definition: xparser.h:73
@ xparserLAST
dummy for array sizing
Definition: xparser.h:81
@ xparserTERM
called from xparser_destroy()
Definition: xparser.h:67
@ xparserRESET
called from xparser_reset()
Definition: xparser.h:66
@ xparserNOEVENT
internal flag for no event set.
Definition: xparser.h:60
@ xparserEMPTY_ELEMENT
empty element : <name attrs />
Definition: xparser.h:76
@ xparserTEXT
text : data
Definition: xparser.h:80