20 unsigned int _nb_node = 0;
21 unsigned int _nb_attr = 0;
22 unsigned int _nb_text = 0;
32 while (root->
prnt != NULL)
92 unsigned char id = *(
unsigned char *)n->
priv;
94 if (
id == ROXML_REQTABLE_ID) {
98 roxml_lock_destroy(n);
107 }
else if (
id == ROXML_NS_ID) {
131 char separators[32] =
"\r\t\n ";
133 while (separators[i] != 0)
134 if (sep == separators[i++])
148 if (context->
nsdef) {
160 ns->
id = ROXML_NS_ID;
183 #ifdef IGNORE_EMPTY_TEXT_NODES 191 #ifdef IGNORE_EMPTY_TEXT_NODES 204 node_t *root = current_node;
255 table->
id = ROXML_REQTABLE_ID;
256 table->
ids[ROXML_REQTABLE_ID] = 1;
258 n->
priv = (
void *)table;
278 for (len = 0; ns[len] !=
'\0' && ns[len] !=
':' && len <
MAX_NAME_LEN; len++)
279 namespace[len] = ns[len];
281 if (len == MAX_NAME_LEN)
284 namespace[len] =
'\0';
316 && parent->
ns->priv && ((
roxml_ns_t *)parent->
ns->priv)->alias[0] ==
'\0')
339 parent->
next->sibl = n;
353 roxml_append_attr(parent, n);
355 roxml_append_other(parent, n);
363 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
380 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
397 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
402 switch (context->
state) {
409 ROXML_PARSE_ERROR(
"unexpected '<' within node definition");
424 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
429 switch (context->
state) {
437 node_t *to_be_closed = NULL;
499 #ifdef IGNORE_EMPTY_TEXT_NODES 500 while (chunk[cur] !=
'\0') {
501 if (chunk[cur] ==
'<') {
510 while ((chunk[cur] !=
'<') && (chunk[cur] !=
'\0'))
517 ROXML_INT
int _func_load_open_spec_node(
roxml_parser_item_t *parser,
char *chunk,
void *data)
520 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
527 if (strncmp(chunk,
"!--", 3) == 0) {
532 while ((chunk[cur] !=
'-') && (chunk[cur] !=
'\0'))
534 }
else if (strncmp(chunk,
"![CDATA[", 8) == 0) {
538 while ((chunk[cur] !=
'[') && (chunk[cur] !=
'\0'))
555 ROXML_INT
int _func_load_close_comment(
roxml_parser_item_t *parser,
char *chunk,
void *data)
558 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
564 if (chunk[1] ==
'-') {
578 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
584 if (chunk[1] ==
']') {
599 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
627 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
632 switch (context->
state) {
637 if (context->
lvl < 0)
638 ROXML_PARSE_ERROR(
"missing opening node");
647 node_t *to_be_closed = NULL;
674 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
679 switch (context->
state) {
690 node_t *to_be_closed = NULL;
717 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
756 fprintf(stderr,
"calling func %s chunk %c\n", __func__, chunk[0]);
759 switch (context->
state) {
764 if (context->
ns == 0) {
771 while (!
ROXML_WHITE(chunk[cur]) && (chunk[cur] !=
'>') && (chunk[cur] !=
'/') && (chunk[cur] !=
':')
772 && (chunk[cur] !=
'\0')) {
779 if (context->
nsdef) {
787 }
else if (context->
ns == 0) {
796 while ((chunk[cur] !=
'=') && (chunk[cur] !=
'>') && (chunk[cur] !=
':')
797 && (chunk[cur] !=
'\0')) {
801 if (context->
nsdef) {
803 ns->
id = ROXML_NS_ID;
#define ROXML_INVALID_DOC
ROXML_INT int roxml_parse_buff(roxml_load_ctx_t *context, roxml_parser_item_t *parser, char *buffer)
generic load function
#define STATE_INSIDE_VAL_BEG
ROXML_INT roxml_parser_item_t * roxml_append_parser_item(roxml_parser_item_t *parser, char *key, roxml_parse_func func)
parser item creation function
ROXML_INT int roxml_is_separator(char sep)
separator tester
ROXML_INT void roxml_close_buff(node_t *n)
unload function
ROXML_STATIC ROXML_INT node_t * roxml_lookup_nsdef(node_t *nsdef, char *ns)
name space lookup in list
ROXML_STATIC ROXML_INT void roxml_set_type(node_t *n, int type)
node type setter function
ROXML_INT node_t * roxml_create_root(node_t *n)
internal function
#define STATE_NODE_SINGLE
#define MODE_COMMENT_DQUOTE
ROXML_INT void roxml_free_node(node_t *n)
internal function
#define MODE_COMMENT_NONE
#define ROXML_DOCTYPE_NODE
File XML document backend.
#define STATE_INSIDE_ARG_BEG
ROXML_INT int roxml_parse_file(roxml_load_ctx_t *context, roxml_parser_item_t *parser, FILE *file)
generic load function
ROXML_API void roxml_close(node_t *n)
unload function
ROXML_INT node_t * roxml_set_parent(node_t *parent, node_t *n)
node parenting function
#define MODE_COMMENT_QUOTE
char curr_name[MAX_NAME_LEN+1]
ROXML_STATIC ROXML_INT void roxml_close_node(node_t *n, node_t *close)
internal function
ROXML_STATIC ROXML_INT void roxml_process_begin_node(roxml_load_ctx_t *context, int position)
node creation during parsing
ROXML_INT node_t * roxml_create_node(int pos, void *src, int type)
internal function
ROXML_INT void roxml_parser_free(roxml_parser_item_t *parser)
parser table deletion
#define STATE_NODE_CONTENT
ROXML_STATIC ROXML_INT void roxml_process_unaliased_ns(roxml_load_ctx_t *context)
namespace without alias name creation during parsing
ROXML_INT node_t * roxml_load(node_t *current_node, FILE *file, char *buffer)
generic load function
ROXML_INT void roxml_close_file(node_t *root)
unload function
buffer XML document backend
ROXML_INT node_t * roxml_append_node(node_t *parent, node_t *n)
node append function
ROXML_INT roxml_parser_item_t * roxml_parser_prepare(roxml_parser_item_t *parser)
parser preparation function
#define STATE_NODE_COMMENT
ROXML_INT void roxml_del_tree(node_t *n)
internal function