<libroxml  version="3.0.2" />
contact: tristan.lelong@libroxml.net
Functions
roxml_core.c File Reference

XML parsing core module. More...

#include <stdlib.h>
#include <string.h>
#include "roxml_core.h"
#include "roxml_file.h"
#include "roxml_buff.h"
#include "roxml_parser.h"

Go to the source code of this file.

Functions

ROXML_API void roxml_close (node_t *n)
 unload function More...
 
ROXML_INT node_troxml_create_node (int pos, void *src, int type)
 internal function More...
 
ROXML_STATIC ROXML_INT void roxml_close_node (node_t *n, node_t *close)
 internal function More...
 
ROXML_INT void roxml_free_node (node_t *n)
 internal function More...
 
ROXML_INT void roxml_del_tree (node_t *n)
 internal function More...
 
ROXML_INT int roxml_is_separator (char sep)
 separator tester More...
 
ROXML_STATIC ROXML_INT void roxml_process_unaliased_ns (roxml_load_ctx_t *context)
 namespace without alias name creation during parsing More...
 
ROXML_STATIC ROXML_INT void roxml_process_begin_node (roxml_load_ctx_t *context, int position)
 node creation during parsing More...
 
ROXML_INT node_troxml_load (node_t *current_node, FILE *file, char *buffer)
 generic load function More...
 
ROXML_INT node_troxml_create_root (node_t *n)
 internal function More...
 
ROXML_STATIC ROXML_INT node_troxml_lookup_nsdef (node_t *nsdef, char *ns)
 name space lookup in list More...
 
ROXML_STATIC ROXML_INT void roxml_set_type (node_t *n, int type)
 node type setter function More...
 
ROXML_INT node_troxml_set_parent (node_t *parent, node_t *n)
 node parenting function More...
 
ROXML_STATIC ROXML_INT node_troxml_append_attr (node_t *parent, node_t *n)
 
ROXML_STATIC ROXML_INT node_troxml_append_other (node_t *parent, node_t *n)
 
ROXML_INT node_troxml_append_node (node_t *parent, node_t *n)
 node append function More...
 
ROXML_INT int _func_load_quoted (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_dquoted (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_open_node (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_close_node (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_open_spec_node (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_close_comment (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_close_cdata (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_close_pi (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_end_node (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_white (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_colon (roxml_parser_item_t *parser, char *chunk, void *data)
 
ROXML_INT int _func_load_default (roxml_parser_item_t *parser, char *chunk, void *data)
 

Detailed Description

XML parsing core module.

(C) Copyright 2014 Tristan Lelong trist.nosp@m.an.l.nosp@m.elong.nosp@m.@lib.nosp@m.roxml.nosp@m..net

SPDX-Licence-Identifier: LGPL-2.1+ The author added a static linking exception, see License.txt.

Definition in file roxml_core.c.

Function Documentation

◆ roxml_append_node()

roxml_append_node ( node_t parent,
node_t n 
)

node append function

this function add a given node as the last child of another node

Parameters
parentthe parent node
nthe node to parent
Returns

Definition at line 347 of file roxml_core.c.

◆ roxml_close()

void roxml_close ( node_t n)

unload function

This function clear a document and all the corresponding nodes It release all memory allocated during roxml_load_doc or roxml_load_file or roxml_add_node. All nodes from the tree are not available anymore.

Parameters
nis any node of the tree to be cleaned
Returns
void
See also
roxml_load_doc
roxml_load_buf
roxml_add_node

Definition at line 25 of file roxml_core.c.

◆ roxml_close_node()

void ROXML_STATIC ROXML_INT roxml_close_node ( node_t n,
node_t close 
)

internal function

This function close the node (add the end offset) and parent the node

Parameters
nis the node to close
closeis the node that close node n
Returns
void

Definition at line 65 of file roxml_core.c.

◆ roxml_create_node()

node_t *ROXML_INT roxml_create_node ( int  pos,
void *  src,
int  type 
)

internal function

This function allocate a new node

Parameters
posis the beginning offset of the node in the file
srcis the pointer to the buffer or file
typeis the type of node between arg and val
Returns
the new node

Definition at line 46 of file roxml_core.c.

◆ roxml_create_root()

ROXML_INT node_t * roxml_create_root ( node_t n)

internal function

This function initialize the root node with xpath table

Parameters
nis the node to initialize
Returns
void see roxml_close

Definition at line 251 of file roxml_core.c.

◆ roxml_del_tree()

void ROXML_INT roxml_del_tree ( node_t n)

internal function

This function delete a tree recursively

Parameters
nis one node of the tree
Returns
void see roxml_close

Definition at line 115 of file roxml_core.c.

◆ roxml_free_node()

void ROXML_INT roxml_free_node ( node_t n)

internal function

This function delete a node without handling its tree

Parameters
nis one node of the tree
Returns
void

Definition at line 82 of file roxml_core.c.

◆ roxml_is_separator()

roxml_is_separator ( char  sep)
inline

separator tester

This function tells if a char is a string separator

Parameters
sepchar to test
Returns
1 if the char was a separator else 0

Definition at line 128 of file roxml_core.c.

◆ roxml_load()

node_t * roxml_load ( node_t current_node,
FILE *  file,
char *  buffer 
)

generic load function

This function load a document and all the corresponding nodes file and buffer params are exclusive. You usualy want to load either a file OR a buffer

Parameters
current_nodethe XML root
filefile descriptor of document
bufferaddress of buffer that contains xml
Returns
the root node or NULL see roxml_close

Definition at line 201 of file roxml_core.c.

◆ roxml_lookup_nsdef()

roxml_lookup_nsdef ( node_t nsdef,
char *  ns 
)

name space lookup in list

this function look for requested name space in nsdef list

Parameters
nsdefthe nsdef list
nsthe namespace to find
Returns
the nsdef node or NULL

Definition at line 273 of file roxml_core.c.

◆ roxml_process_begin_node()

roxml_process_begin_node ( roxml_load_ctx_t context,
int  position 
)

node creation during parsing

this function create a new node upon finding new opening sign. It closes previous node if necessary

Parameters
contextthe parsing context
positionthe position in the file
Returns

Definition at line 180 of file roxml_core.c.

◆ roxml_process_unaliased_ns()

roxml_process_unaliased_ns ( roxml_load_ctx_t context)

namespace without alias name creation during parsing

this function create a new namespace without alias (default ns or remove ns)

Parameters
contextthe parsing context
Returns

Definition at line 146 of file roxml_core.c.

◆ roxml_set_parent()

node_t * roxml_set_parent ( node_t parent,
node_t n 
)

node parenting function

this function updates a node to set its parent and namespace if necessary.

Parameters
parentthe parent node
nthe node to parent
Returns

Definition at line 308 of file roxml_core.c.

◆ roxml_set_type()

roxml_set_type ( node_t n,
int  type 
)
inline

node type setter function

this function change the type of a node

Parameters
nthe node to modify
typethe new type to set
Returns

Definition at line 302 of file roxml_core.c.