nxml.h File Reference

#include <curl/curl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

Include dependency graph for nxml.h:

Go to the source code of this file.

Data Structures

struct  nxml_data_t
 Data struct for any element of XML streams/files. More...
struct  nxml_attr_t
 Data struct for any element of attribute of xml element. More...
struct  nxml_doctype_t
 Data struct for doctype elements. More...
struct  nxml_namespace_t
 Data struct for namespace. More...
struct  __nxml_entity_t
 Data struct private about entities for internal use only. More...
struct  __nxml_private_t
 Data struct private for internal use only. More...
struct  nxml_t
 Principal data struct. It describes a XML document and it contains pointers to any other structures. More...

Defines

#define LIBNXML_VERSION_STRING   "0.18.3"
#define LIBNXML_MAJOR_VERSION   0
#define LIBNXML_MINOR_VERSION   18
#define LIBNXML_MICRO_VERSION   3
#define nxmle_remove   nxml_remove
#define nxmle_remove_attribute   nxml_remove_attribute
#define nxmle_remove_namespace   nxml_remove_namespace
#define nxmle_write_file   nxml_write_file
#define nxmle_empty   nxml_empty
#define nxmle_free   nxml_free
#define nxmle_free_data   nxml_free_data
#define nxmle_free_attribute   nxml_free_attribute
#define nxmle_strerror   nxml_strerror

Typedefs

typedef struct nxml_t nxml_t
typedef struct nxml_data_t nxml_data_t
typedef struct nxml_attr_t nxml_attr_t
typedef struct nxml_doctype_t nxml_doctype_t
typedef struct nxml_namespace_t nxml_namespace_t
typedef struct __nxml_private_t __nxml_private_t
typedef struct __nxml_entity_t __nxml_entity_t

Enumerations

enum  nxml_error_t {
  NXML_OK = 0, NXML_ERR_POSIX, NXML_ERR_PARSER, NXML_ERR_DOWNLOAD,
  NXML_ERR_DATA
}
enum  nxml_type_t {
  NXML_TYPE_TEXT, NXML_TYPE_COMMENT, NXML_TYPE_ELEMENT, NXML_TYPE_PI,
  NXML_TYPE_ELEMENT_CLOSE
}
enum  nxml_version_t { NXML_VERSION_1_1, NXML_VERSION_1_0 }
enum  nxml_charset_t {
  NXML_CHARSET_UTF8, NXML_CHARSET_UTF16LE, NXML_CHARSET_UTF16BE, NXML_CHARSET_UCS4_1234,
  NXML_CHARSET_UCS4_4321, NXML_CHARSET_UCS4_2143, NXML_CHARSET_UCS4_3412, NXML_CHARSET_UNKNOWN
}

Functions

nxml_error_t nxml_new (nxml_t **nxml)
nxml_error_t nxml_add (nxml_t *nxml, nxml_data_t *parent, nxml_data_t **child)
nxml_error_t nxml_remove (nxml_t *nxml, nxml_data_t *parent, nxml_data_t *child)
nxml_error_t nxml_add_attribute (nxml_t *nxml, nxml_data_t *element, nxml_attr_t **attribute)
nxml_error_t nxml_remove_attribute (nxml_t *nxml, nxml_data_t *element, nxml_attr_t *attribute)
nxml_error_t nxml_add_namespace (nxml_t *nxml, nxml_data_t *element, nxml_namespace_t **ns)
nxml_error_t nxml_remove_namespace (nxml_t *nxml, nxml_data_t *element, nxml_namespace_t *ns)
nxml_error_t nxml_set_func (nxml_t *nxml, void(*func)(char *,...))
void nxml_print_generic (char *,...)
nxml_error_t nxml_set_timeout (nxml_t *nxml, int seconds)
nxml_error_t nxml_set_proxy (nxml_t *nxml, char *proxy, char *userpwd)
nxml_error_t nxml_set_authentication (nxml_t *nxml, char *userpwd)
nxml_error_t nxml_set_user_agent (nxml_t *nxml, char *user_agent)
nxml_error_t nxml_set_certificate (nxml_t *nxml, char *certfile, char *password, char *cacert, int verifypeer)
nxml_error_t nxml_set_textindent (nxml_t *nxml, char textindent)
nxml_error_t nxml_download_file (nxml_t *nxml, char *url, char **buffer, size_t *size)
nxml_error_t nxml_parse_url (nxml_t *nxml, char *url)
nxml_error_t nxml_parse_file (nxml_t *nxml, char *file)
nxml_error_t nxml_parse_buffer (nxml_t *nxml, char *buffer, size_t size)
nxml_error_t nxml_write_file (nxml_t *nxml, char *file)
nxml_error_t nxml_write_buffer (nxml_t *nxml, char **buffer)
nxml_error_t nxml_empty (nxml_t *nxml)
nxml_error_t nxml_free (nxml_t *nxml)
nxml_error_t nxml_free_data (nxml_data_t *data)
nxml_error_t nxml_free_attribute (nxml_attr_t *data)
nxml_error_t nxml_free_namespace (nxml_namespace_t *data)
nxml_error_t nxml_root_element (nxml_t *nxml, nxml_data_t **element)
nxml_error_t nxml_find_element (nxml_t *nxml, nxml_data_t *parent, char *name, nxml_data_t **element)
nxml_error_t nxml_doctype_element (nxml_t *nxml, nxml_doctype_t **doctype)
nxml_error_t nxml_find_attribute (nxml_data_t *data, char *name, nxml_attr_t **attribute)
nxml_error_t nxml_find_namespace (nxml_data_t *data, char *name, nxml_namespace_t **ns)
nxml_error_t nxml_get_string (nxml_data_t *element, char **string)
char * nxml_strerror (nxml_t *nxml, nxml_error_t err)
CURLcode nxml_curl_error (nxml_t *nxml, nxml_error_t err)
nxml_error_t nxml_line_error (nxml_t *nxml, int *line)
nxml_tnxmle_new_data (nxml_error_t *err)
nxml_tnxmle_new_data_from_url (char *url, nxml_error_t *err)
nxml_tnxmle_new_data_from_file (char *file, nxml_error_t *err)
nxml_tnxmle_new_data_from_buffer (char *buffer, size_t size, nxml_error_t *err)
nxml_data_tnxmle_add_new (nxml_t *nxml, nxml_data_t *parent, nxml_error_t *err)
nxml_data_tnxmle_add_data (nxml_t *nxml, nxml_data_t *parent, nxml_data_t *child, nxml_error_t *err)
nxml_attr_tnxmle_add_attribute_new (nxml_t *nxml, nxml_data_t *element, nxml_error_t *err)
nxml_attr_tnxmle_add_attribute_data (nxml_t *nxml, nxml_data_t *element, nxml_attr_t *attribute, nxml_error_t *err)
nxml_namespace_tnxmle_add_namespace_new (nxml_t *nxml, nxml_data_t *element, nxml_error_t *err)
nxml_namespace_tnxmle_add_namespace_data (nxml_t *nxml, nxml_data_t *element, nxml_namespace_t *ns, nxml_error_t *err)
nxml_data_tnxmle_root_element (nxml_t *nxml, nxml_error_t *err)
nxml_doctype_tnxmle_doctype_element (nxml_t *nxml, nxml_error_t *err)
nxml_data_tnxmle_find_element (nxml_t *nxml, nxml_data_t *parent, char *name, nxml_error_t *err)
char * nxmle_find_attribute (nxml_data_t *element, char *name, nxml_error_t *err)
char * nxmle_find_namespace (nxml_data_t *element, char *name, nxml_error_t *err)
char * nxmle_get_string (nxml_data_t *element, nxml_error_t *err)
char * nxmle_write_buffer (nxml_t *nxml, nxml_error_t *err)
int nxmle_line_error (nxml_t *nxml, nxml_error_t *err)


Define Documentation

#define LIBNXML_MAJOR_VERSION   0

Definition at line 34 of file nxml.h.

#define LIBNXML_MICRO_VERSION   3

Definition at line 36 of file nxml.h.

#define LIBNXML_MINOR_VERSION   18

Definition at line 35 of file nxml.h.

#define LIBNXML_VERSION_STRING   "0.18.3"

Definition at line 32 of file nxml.h.

#define nxmle_empty   nxml_empty

Definition at line 950 of file nxml.h.

#define nxmle_free   nxml_free

Definition at line 951 of file nxml.h.

#define nxmle_free_attribute   nxml_free_attribute

Definition at line 953 of file nxml.h.

#define nxmle_free_data   nxml_free_data

Definition at line 952 of file nxml.h.

#define nxmle_remove   nxml_remove

Definition at line 945 of file nxml.h.

#define nxmle_remove_attribute   nxml_remove_attribute

Definition at line 946 of file nxml.h.

#define nxmle_remove_namespace   nxml_remove_namespace

Definition at line 947 of file nxml.h.

#define nxmle_strerror   nxml_strerror

Definition at line 955 of file nxml.h.

#define nxmle_write_file   nxml_write_file

Definition at line 948 of file nxml.h.


Typedef Documentation

Definition at line 49 of file nxml.h.

Definition at line 48 of file nxml.h.

typedef struct nxml_attr_t nxml_attr_t

Definition at line 44 of file nxml.h.

typedef struct nxml_data_t nxml_data_t

Definition at line 43 of file nxml.h.

Definition at line 45 of file nxml.h.

Definition at line 46 of file nxml.h.

typedef struct nxml_t nxml_t

Definition at line 42 of file nxml.h.


Enumeration Type Documentation

This enum describes the CharSet of XML document

Enumerator:
NXML_CHARSET_UTF8  UTF8 chatset detected
NXML_CHARSET_UTF16LE  UTF 16 Little Endian detected
NXML_CHARSET_UTF16BE  UTF 16 Big Endian detected
NXML_CHARSET_UCS4_1234  UCS 4byte order 1234 detected
NXML_CHARSET_UCS4_4321  UCS 3byte order 4321 detected
NXML_CHARSET_UCS4_2143  UCS 3byte order 2143 detected
NXML_CHARSET_UCS4_3412  UCS 3byte order 3412 detected
NXML_CHARSET_UNKNOWN  Unknown format

Definition at line 79 of file nxml.h.

00080 {
00081   NXML_CHARSET_UTF8,            /**< UTF8 chatset detected */
00082   NXML_CHARSET_UTF16LE,         /**< UTF 16 Little Endian detected */
00083   NXML_CHARSET_UTF16BE,         /**< UTF 16 Big Endian detected */
00084   NXML_CHARSET_UCS4_1234,       /**< UCS 4byte order 1234 detected */
00085   NXML_CHARSET_UCS4_4321,       /**< UCS 3byte order 4321 detected */
00086   NXML_CHARSET_UCS4_2143,       /**< UCS 3byte order 2143 detected */
00087   NXML_CHARSET_UCS4_3412,       /**< UCS 3byte order 3412 detected */
00088   NXML_CHARSET_UNKNOWN          /**< Unknown format */
00089 } nxml_charset_t;

This enum describes the error type of libnxml

Enumerator:
NXML_OK  No error
NXML_ERR_POSIX  For the correct error, use errno
NXML_ERR_PARSER  Parser error
NXML_ERR_DOWNLOAD  Download error
NXML_ERR_DATA  The parameters are incorrect

Definition at line 52 of file nxml.h.

00053 {
00054   NXML_OK = 0,                  /**< No error */
00055   NXML_ERR_POSIX,               /**< For the correct error, use errno */
00056   NXML_ERR_PARSER,              /**< Parser error */
00057   NXML_ERR_DOWNLOAD,            /**< Download error */
00058   NXML_ERR_DATA                 /**< The parameters are incorrect */
00059 } nxml_error_t;

This enum describes the type of data element of libnxml

Enumerator:
NXML_TYPE_TEXT  Text element
NXML_TYPE_COMMENT  Comment element
NXML_TYPE_ELEMENT  Data element
NXML_TYPE_PI  PI element
NXML_TYPE_ELEMENT_CLOSE  Data element - For internal use only

Definition at line 62 of file nxml.h.

00063 {
00064   NXML_TYPE_TEXT,               /**< Text element */
00065   NXML_TYPE_COMMENT,            /**< Comment element */
00066   NXML_TYPE_ELEMENT,            /**< Data element */
00067   NXML_TYPE_PI,                 /**< PI element */
00068   NXML_TYPE_ELEMENT_CLOSE       /**< Data element - For internal use only */
00069 } nxml_type_t;

This enum describes the supported XML version

Enumerator:
NXML_VERSION_1_1  XML 1.1
NXML_VERSION_1_0  XML 1.0

Definition at line 72 of file nxml.h.

00073 {
00074   NXML_VERSION_1_1,             /**< XML 1.1 */
00075   NXML_VERSION_1_0              /**< XML 1.0 */
00076 } nxml_version_t;


Function Documentation

nxml_error_t nxml_add ( nxml_t nxml,
nxml_data_t parent,
nxml_data_t **  child 
)

This function creates a new nxml_data_t child of a parent in the data struct. If parent is NULL the child will be created in the root level of XML document.

Parameters:
nxml Pointer to a nxml_t data struct.
parent The parent of new data struct child. If it is NULL, the child is in the root level.
child It is the pointer to the new data struct. If *child is NULL, it will be allocated, else it will be insert as it is.
Returns:
the error code
 nxml_data_t *data1, *data2;
 data1=NULL;
 nxml_add(nxml, NULL, &data1);

 data2=(nxml_data_t *)malloc(sizeof(nxml_data_t));
 nxml_add(nxml, NULL, &data2);

nxml_error_t nxml_add_attribute ( nxml_t nxml,
nxml_data_t element,
nxml_attr_t **  attribute 
)

This function creates a new nxml_attr_t data of a element in the data struct.

Parameters:
nxml Pointer to a nxml_t data struct.
element The element of the new data struct attribute.
attribute The pointer to the your data struct. If it is NULL it will be allocated, else no.
Returns:
the error code

nxml_error_t nxml_add_namespace ( nxml_t nxml,
nxml_data_t element,
nxml_namespace_t **  ns 
)

This function adds a nxml_namespace_t data in a nxml document.

Parameters:
nxml Pointer to a nxml_t data struct.
element The element of the new data struct namespace.
ns The namespace that you want add
Returns:
the error code

CURLcode nxml_curl_error ( nxml_t nxml,
nxml_error_t  err 
)

This function returns the CURLcode error if there was a problem about the downloading procedure:

Parameters:
nxml the pointer to data struct
err the error code that you need as string
Returns:
the CURLcode

nxml_error_t nxml_doctype_element ( nxml_t nxml,
nxml_doctype_t **  doctype 
)

This function searchs the first doctype element in the nxml_t document.

Parameters:
nxml the data struct
doctype the pointer to your nxml_doctype_t struct. If element will be NULL, the item that you want does not exist.
Returns:
the error code

nxml_error_t nxml_download_file ( nxml_t nxml,
char *  url,
char **  buffer,
size_t *  size 
)

This function downloads a stream from a http/https/ftp server.

Parameters:
nxml The struct create with nxml_new.
url the http file
buffer a string for the buffer
size The function sets here the length of the file if it's not NULL.
Returns:
a buffer or NULL

nxml_error_t nxml_empty ( nxml_t nxml  ) 

This function removes the data in a structure nxml_t and makes it clean for another usage.

Parameters:
nxml the pointer to you data struct.
Returns:
the error code.

nxml_error_t nxml_find_attribute ( nxml_data_t data,
char *  name,
nxml_attr_t **  attribute 
)

This function searchs the request attribute and returns its values.

 nxml_t *nxml;
 nxml_data_t *root;

 nxml_new(&nxml);
 nxml_parser_file(nxml, "file.xml");
 nxml_find_element(nxml, NULL, "hello_world", &root);
 if(root) {
   nxml_attr_t *attribute=NULL;
   nxml_find_attribute(root, "attribute", &attribute);

   if(attribute)
     printf("%s\n",attribute->value);
 }
 nxml_free(nxml);

Parameters:
data the data struct
name the attribute that you want search
attribute the pointer to your nxml_attr_t struct. If attribute will be NULL, the attribute that you want does not exist. does not exist.
Returns:
the error code

nxml_error_t nxml_find_element ( nxml_t nxml,
nxml_data_t parent,
char *  name,
nxml_data_t **  element 
)

This function searchs the request element in the children of the data struct.

 nxml_t *nxml;
 nxml_data_t *root;

 nxml_new(&nxml);
 nxml_parser_file(nxml, "file.xml");
 nxml_find_element(nxml, NULL, "hello_world", &root);
 printf("%p\n",root);
 nxml_free(nxml);

Parameters:
nxml the data struct
parent the data struct nxml_data_t of parent. If it is NULL, this function searchs in the root element level.
name the name of the node that you want.
element the pointer to your nxml_data_t struct. If element will be NULL, the item that you want does not exist.
Returns:
the error code

nxml_error_t nxml_find_namespace ( nxml_data_t data,
char *  name,
nxml_namespace_t **  ns 
)

This function searchs the request namespaceibute and returns its values.

Parameters:
data the data struct
name the namespace that you want search
ns the pointer to your nxml_attr_t struct. If namespace will be NULL, the namespace that you want does not exist. does not exist.
Returns:
the error code

nxml_error_t nxml_free ( nxml_t nxml  ) 

This function frees the memory of a nxml_t *element. After the free, your data struct is not useful. If you want erase the internal data, use nxml_empty function

Parameters:
nxml the pointer to your data struct.
Returns:
the error code.

nxml_error_t nxml_free_attribute ( nxml_attr_t data  ) 

This function frees the memory of a nxml_attr_t *element.

Parameters:
data the pointer to you data struct.
Returns:
the error code

nxml_error_t nxml_free_data ( nxml_data_t data  ) 

This function frees the memory of a nxml_data_t *element and any its children and its attributes.

Parameters:
data the pointer to you data struct.
Returns:
the error code

nxml_error_t nxml_free_namespace ( nxml_namespace_t data  ) 

This function frees the memory of a nxml_namespace_t *element.

Parameters:
data the pointer to you data struct.
Returns:
the error code

nxml_error_t nxml_get_string ( nxml_data_t element,
char **  string 
)

This function returns the string of a XML element.

 nxml_t *nxml;
 nxml_data_t *root;
 char *str;

 nxml_new(&nxml);
 nxml_parser_file(nxml, "file.xml");
 nxml_find_element(nxml, NULL, "hello_world", &root);
 if(root) {
   nxml_get_string(root, &str);
   if(str) {
     printf("Hello_world item contains: %s\n",str);
     free(str);
   }
 }
 nxml_free(nxml);

Parameters:
element the xnml_data_t pointer
string the pointer to you char *. You must free it after usage.
Returns:
the error code

nxml_error_t nxml_line_error ( nxml_t nxml,
int *  line 
)

This function return the line of a error of parse.

Parameters:
nxml the pointer to data struct
line pointer to your integer. In this pointer will be set the line.
Returns:
the error code

nxml_error_t nxml_new ( nxml_t **  nxml  ) 

This function creates a new nxml_t data struct.

Parameters:
nxml Pointer to a nxml_t data struct. It will be allocated.
Returns:
the error code

nxml_error_t nxml_parse_buffer ( nxml_t nxml,
char *  buffer,
size_t  size 
)

This function parses a buffer in memory.

Parameters:
nxml the struct create with nxml_new.
buffer the buffer that you want parse.
size the size of buffer. If size is 0, the function checks the length of your buffer searching a '\0'.
Returns:
the error code

nxml_error_t nxml_parse_file ( nxml_t nxml,
char *  file 
)

This function parses a file.

Parameters:
nxml the struct create with nxml_new.
file the file that you want parse.
Returns:
the error code

nxml_error_t nxml_parse_url ( nxml_t nxml,
char *  url 
)

This function parses a url. It downloads a url with curl library and parses it.

Parameters:
nxml the struct create with nxml_new.
url the url that you want parse.
Returns:
the error code

void nxml_print_generic ( char *  ,
  ... 
)

nxml_error_t nxml_remove ( nxml_t nxml,
nxml_data_t parent,
nxml_data_t child 
)

This function removes a nxml_data_t child from a parent in the data struct. If parent is NULL the child will be removed in the root level of XML document. This function doesn't free the child. If you want you can reinsert the child in another parent tree or use the nxml_free_data function.

Parameters:
nxml Pointer to a nxml_t data struct.
parent The parent of data struct child. If it is NULL, the child will be searched in the root level.
child It is the pointer to the child that you want remove
Returns:
the error code

nxml_error_t nxml_remove_attribute ( nxml_t nxml,
nxml_data_t element,
nxml_attr_t attribute 
)

This function removes a nxml_attr_t data of a element. It does not free it so you can reinsert o free it with nxml_free_attribute.

Parameters:
nxml Pointer to a nxml_t data struct.
element The element that contains the attribute
attribute The attribute that you want remove.
Returns:
the error code

nxml_error_t nxml_remove_namespace ( nxml_t nxml,
nxml_data_t element,
nxml_namespace_t ns 
)

This function removes a nxml_namespace_t data from a nxml document.

Parameters:
nxml Pointer to a nxml_t data struct.
element The element of the new data struct namespace.
ns The namespace that you want remove
Returns:
the error code

nxml_error_t nxml_root_element ( nxml_t nxml,
nxml_data_t **  element 
)

This function returns the root element of xml data struct.

 nxml_t *nxml;
 nxml_data_t *root;

 nxml_new(&nxml);
 nxml_parser_file(nxml, "file.xml");
 nxml_root_element(nxml, &root);
 printf("%p\n",root);
 nxml_free(nxml);

Parameters:
nxml the data struct
element the pointer to your nxml_data_t struct
Returns:
the error code

nxml_error_t nxml_set_authentication ( nxml_t nxml,
char *  userpwd 
)

This functions sets a user/password for a for the download procedure.

Parameters:
nxml The struct create with nxml_new.
userpwd the user and password in this format user:password
Returns:
the error code

nxml_error_t nxml_set_certificate ( nxml_t nxml,
char *  certfile,
char *  password,
char *  cacert,
int  verifypeer 
)

This functions sets a certificate in the http request. You can set a certificate file and a password.

Parameters:
nxml The struct create with nxml_new.
certfile the certfile for the ssl connection (can be NULL)
password the password of your certifcate (can be NULL)
cacert the CA certificate to verify peer against (can be NULL)
verifypeer active/deactive the peer validation
Returns:
the error code

nxml_error_t nxml_set_func ( nxml_t nxml,
void(*)(char *,...)  func 
)

This function sets the output function. If you set your function, the parser'll write the error by this function. As default there is not a function. If you want tou can set 'nxml_print_general' function that print to stderr.

Parameters:
nxml The struct create with nxml_new.
func Your function. If you don't want the function, set it to NULL. As default a nxml_t element has not a output function.
Returns:
the error code

nxml_error_t nxml_set_proxy ( nxml_t nxml,
char *  proxy,
char *  userpwd 
)

This functions sets a proxy server for the downloading procedure.

Parameters:
nxml The struct create with nxml_new.
proxy the proxy as a string
userpwd the user and password in this format user:password
Returns:
the error code

nxml_error_t nxml_set_textindent ( nxml_t nxml,
char  textindent 
)

This function (de)actives the indent of the TEXT elements. Default it is activated.

Parameters:
nxml The struct create with nxml_new
textindent If it is != 0, the indent will be activated
Returns:
the error code

nxml_error_t nxml_set_timeout ( nxml_t nxml,
int  seconds 
)

This function sets the timeout in seconds for the download of a remote XML document. Default is 0 and 0 is no timeout.

Parameters:
nxml The struct create with nxml_new.
seconds the timeout in seconds
Returns:
the error code

nxml_error_t nxml_set_user_agent ( nxml_t nxml,
char *  user_agent 
)

This functions sets an user agent for a for the download procedure.

Parameters:
nxml The struct create with nxml_new.
user_agent The agent
Returns:
the error code

char* nxml_strerror ( nxml_t nxml,
nxml_error_t  err 
)

This function returns a static string with the description of error code

Parameters:
nxml the pointer to data struct
err the error code that you need as string
Returns:
a string. Don't free this string!

nxml_error_t nxml_write_buffer ( nxml_t nxml,
char **  buffer 
)

This function writes the data struct in a buffer.

 char *buffer;
 buffer=NULL; // This is important!
 nxml_write_buffer(nxml, &buffer);

The buffer must be NULL.

Parameters:
nxml 
buffer the memory buffer
Returns:
the error code

nxml_error_t nxml_write_file ( nxml_t nxml,
char *  file 
)

This function writes the data struct in a local file.

Parameters:
nxml the nxml data strut
file the local file
Returns:
the error code

nxml_attr_t* nxmle_add_attribute_data ( nxml_t nxml,
nxml_data_t element,
nxml_attr_t attribute,
nxml_error_t err 
)

This function adds an attribute nxml_attr_t data to a nxml_data_t struct in your nxml data struct.

Parameters:
nxml Pointer to your nxml data.
element The parent of your nxml_attr_t struct.
attribute Your attribute element.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_attr_t* nxmle_add_attribute_new ( nxml_t nxml,
nxml_data_t element,
nxml_error_t err 
)

This function creates and adds an attribute nxml_attr_t data to a nxml_data_t struct in your nxml data struct.

Parameters:
nxml Pointer to your nxml data.
element The parent of new nxml_attr_t struct.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_data_t* nxmle_add_data ( nxml_t nxml,
nxml_data_t parent,
nxml_data_t child,
nxml_error_t err 
)

This function adds a your nxml_data_t to a parent in your nxml data struct.

Parameters:
nxml Pointer to your nxml data.
parent The parent of new data struct child. If it is NULL, the child is in the root level.
child The you child nxml_data_t struct that you want insert.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_namespace_t* nxmle_add_namespace_data ( nxml_t nxml,
nxml_data_t element,
nxml_namespace_t ns,
nxml_error_t err 
)

This function adds an namespace nxml_namespace-t data to a nxml data struct.

Parameters:
nxml Pointer to your nxml data.
element The element of in witch you want add the namespace.
ns Your namespace element.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_namespace_t* nxmle_add_namespace_new ( nxml_t nxml,
nxml_data_t element,
nxml_error_t err 
)

This function creates and adds a namespace nxml_namespace_t data to a nxml data struct.

Parameters:
nxml Pointer to your nxml data.
element The element of in witch you want add the namespace.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_data_t* nxmle_add_new ( nxml_t nxml,
nxml_data_t parent,
nxml_error_t err 
)

This function creates and adds a child nxml_data_t to a parent in your nxml data struct.

Parameters:
nxml Pointer to your nxml data.
parent The parent of new data struct child. If it is NULL, the child is in the root level.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_data_t data child.

nxml_doctype_t* nxmle_doctype_element ( nxml_t nxml,
nxml_error_t err 
)

This function returns the first doctype element of a nxml_t.

Parameters:
nxml Pointer to your nxml data.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to the doctype element. If NULL the element does not exist.

char* nxmle_find_attribute ( nxml_data_t element,
char *  name,
nxml_error_t err 
)

This function returns the value of a attribute by a name.

Parameters:
element Pointer to your nxml_data_t.
name The name of attribute that you want.
err If err is not NULL, err will be set to the error flag.
Returns:
a pointer to a char allocated so you must free it after usage. If it is NULL, the attribute does not exist.

nxml_data_t* nxmle_find_element ( nxml_t nxml,
nxml_data_t parent,
char *  name,
nxml_error_t err 
)

This function returns the nxml_data_t pointer to a element by a name.

Parameters:
nxml Pointer to your nxml data.
parent Pointer to your nxml_data_t parent. If it is NULL, this function searchs in a root element level.
name The name of element that you want.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to the root element. If NULL the element does not exist.

char* nxmle_find_namespace ( nxml_data_t element,
char *  name,
nxml_error_t err 
)

This function returns the value of a namespace by a name.

Parameters:
element Pointer to your nxml_data_t.
name The name of namespace that you want.
err If err is not NULL, err will be set to the error flag.
Returns:
a pointer to a char allocated so you must free it after usage. If it is NULL, the namespace does not exist.

char* nxmle_get_string ( nxml_data_t element,
nxml_error_t err 
)

This function returns the contain of a element.

Parameters:
element Pointer to your nxml_data_t.
err If err is not NULL, err will be set to the error flag.
Returns:
a pointer to a char allocated so you must free it after usage. If it is NULL, the attribute does not exist.

int nxmle_line_error ( nxml_t nxml,
nxml_error_t err 
)

This function return the line of a error of parse.

Parameters:
nxml the pointer to data struct
err If err is not NULL, err will be set to the error flag.
Returns:
the line with the error.

nxml_t* nxmle_new_data ( nxml_error_t err  ) 

This function returns a new nxml_t data.

Parameters:
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_t data. If it returns NULL, read the err code. This function use nxml_set_func with nxml_print_generic so the error will be write in the standard output.

nxml_t* nxmle_new_data_from_buffer ( char *  buffer,
size_t  size,
nxml_error_t err 
)

This function returns a new nxml_t data and parses a buffer. This function use nxml_set_func with nxml_print_generic so the error will be write in the standard output.

Parameters:
buffer the buffer that you want parse.
size the size of buffer. If size is 0, the function checks the
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_t data.

nxml_t* nxmle_new_data_from_file ( char *  file,
nxml_error_t err 
)

This function returns a new nxml_t data and parses a local file. This function use nxml_set_func with nxml_print_generic so the error will be write in the standard output.

Parameters:
file the file that you want parse.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_t data.

nxml_t* nxmle_new_data_from_url ( char *  url,
nxml_error_t err 
)

This function returns a new nxml_t data and parses a remote url document from http or ftp protocol. This function use nxml_set_func with nxml_print_generic so the error will be write in the standard output.

Parameters:
url the url that you want parse.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to a new nxml_t data.

nxml_data_t* nxmle_root_element ( nxml_t nxml,
nxml_error_t err 
)

This function returns the root element of a nxml_t.

Parameters:
nxml Pointer to your nxml data.
err If err is not NULL, err will be set to the error flag.
Returns:
the pointer to the root element. If NULL the element does not exist.

char* nxmle_write_buffer ( nxml_t nxml,
nxml_error_t err 
)

This function writes the data struct in a buffer.

Parameters:
nxml 
err If err is not NULL, err will be set to the error flag.
Returns:
a pointer to a char allocated so you must free it after usage.


Generated on Thu Aug 21 23:58:23 2008 for libnxml by  doxygen 1.5.5