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

File XML document backend. More...

#include <stdlib.h>
#include <string.h>
#include "roxml_core.h"
#include "roxml_parser.h"
#include "roxml_internal.h"

Go to the source code of this file.

Functions

ROXML_INT int roxml_read_file (int pos, int size, char *buffer, node_t *node)
 read xml doc function
 
ROXML_INT void roxml_close_file (node_t *root)
 unload function
 
ROXML_INT int roxml_parse_file (roxml_load_ctx_t *context, roxml_parser_item_t *parser, FILE *file)
 generic load function
 
ROXML_API node_troxml_load_fd (int fd)
 load function for file descriptors
 
ROXML_API node_troxml_load_doc (char *filename)
 load function for files
 

Detailed Description

File XML document backend.

(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_file.c.

Function Documentation

◆ roxml_close_file()

void roxml_close_file ( node_t n)

unload function

This function clear a document that was opened as part of a file

Parameters
nis any node of the tree to be cleaned
Returns
void

Definition at line 28 of file roxml_file.c.

◆ roxml_load_doc()

node_t * roxml_load_doc ( char *  filename)

load function for files

This function load a file document by parsing all the corresponding nodes

Warning
the file is not fully copied and thus, it should stay untouched until roxml_close is called on the corresponding XML tree.
Parameters
filenamethe XML document to load
Returns
the root node or ROXML_INVALID_DOC (NULL). errno is set to EINVAL in case of parsing error
See also
roxml_close
roxml_load_fd
roxml_load_buf

Definition at line 90 of file roxml_file.c.

◆ roxml_load_fd()

node_t * roxml_load_fd ( int  fd)

load function for file descriptors

This function load a document by parsing all the corresponding nodes

Parameters
fdthe opened file descriptor to XML document to load
Returns
the root node or ROXML_INVALID_DOC (NULL). errno is set to EINVAL in case of parsing error
See also
roxml_close
roxml_load_doc
roxml_load_buf

Definition at line 73 of file roxml_file.c.

◆ roxml_parse_file()

node_t * roxml_parse_file ( roxml_load_ctx_t context,
roxml_parser_item_t parser,
FILE *  file 
)

generic load function

This function parse a file document and all the corresponding nodes

Parameters
contextinternal data used for parsing
parserthe parser object to run
filefile pointer to the document
Returns
an error code and filled context see roxml_close_buff

Definition at line 33 of file roxml_file.c.

◆ roxml_read_file()

roxml_read_file ( int  pos,
int  size,
char *  buffer,
node_t node 
)

read xml doc function

this function read inside a xml file and fill the given buffer

Parameters
posthe pos in the xml document
sizethe size of the data to read
bufferthe destination buffer
nodethe node that belong to the tree we want to read to
Returns
the number of bytes read

Definition at line 18 of file roxml_file.c.