#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "bstring.h"
Go to the source code of this file.
Data Structures | |
struct | hpx_ctrl_t |
struct | hpx_attr_t |
struct | hpx_tag_t |
struct | hpx_tree_t |
Macros | |
#define | IS_XML1CHAR(x) (isalpha(x) || (x == '_') || (x == ':')) |
#define | IS_XMLCHAR(x) (isalpha(x) || isdigit(x) || (x == '.') || (x == '-') || (x == '_') || (x == ':')) |
#define | hpx_init_simple() hpx_init(0, 10*1024*1024) |
#define | MMAP_PAGES (1L << 15) |
Enumerations | |
enum | { HPX_ILL, HPX_OPEN, HPX_SINGLE, HPX_CLOSE, HPX_LITERAL, HPX_ATT, HPX_INSTR, HPX_COMMENT } |
Functions | |
long | hpx_lineno (void) |
void | hpx_tm_free (hpx_tag_t *t) |
void | hpx_tm_free_tree (hpx_tree_t *) |
hpx_tag_t * | hpx_tm_create (int n) |
int | hpx_process_elem (bstring_t b, hpx_tag_t *p) |
hpx_ctrl_t * | hpx_init (int fd, long len) |
void | hpx_init_membuf (hpx_ctrl_t *ctl, void *buf, int len) |
void | hpx_free (hpx_ctrl_t *ctl) |
int | hpx_get_elem (hpx_ctrl_t *ctl, bstring_t *b, int *in_tag, long *lno) |
long | hpx_get_eleml (hpx_ctrl_t *ctl, bstringl_t *b, int *in_tag, long *lno) |
int | hpx_fprintf_tag (FILE *f, const hpx_tag_t *p) |
int | hpx_tree_resize (hpx_tree_t **tl, int n) |
This file contains all structures and prototypes for the high performance XML parser library libhpxml.
long hpx_get_eleml | ( | hpx_ctrl_t * | ctl, |
bstringl_t * | b, | ||
int * | in_tag, | ||
long * | lno | ||
) |
ctl | Pointer to valid hpx_ctrl_t structure. |
b | Pointer to bstring_t. This structure will be filled out by this function. |
in_tag | is set to 1 or 0, either it is a tag or not. It is optional and may be NULL. |
lno | Pointer to integer which will contain the starting line number of b. lno may be NULL. |
hpx_ctrl_t* hpx_init | ( | int | fd, |
long | len | ||
) |
fd | Input file descriptor. |
len | Read buffer length. If len is negative, the file is memory mapped with mmap(). This works only if it was compiled with WITH_MMAP. |
mattr | Maximum number of attributes per tag. |
void hpx_init_membuf | ( | hpx_ctrl_t * | ctl, |
void * | buf, | ||
int | len | ||
) |
This function initializes a hpx_ctrl_t structure to be used for input from a memory buffer (instead of a file).
ctl | Pointer to hpx_ctrl_t structure which will be initialized properly. |
buf | Pointer to memory buffer. |
len | Number of bytes within memory buffer. |
Parses bstring into hpx_tag_t structure. The bstring buffer must contain a single XML element with correct boundaries. This is either a tag (<....>) or just text.
b | Bstring containing pointer to an element. |
in | Must be set to 0 if element is literal text, otherwise 1 if it is a tag. |
p | Pointer to valid hpx_tag_t structure. The structure will we filled out. |
void hpx_tm_free_tree | ( | hpx_tree_t * | tlist | ) |
This function recursively frees a tree with all its subtrees and tags.
tlist | Pointer to tree which should be freed. |
int hpx_tree_resize | ( | hpx_tree_t ** | tl, |
int | n | ||
) |
Resize tag tree.
n | Number of sub tags to add to tree. |