dancer-xml-0.8.2.1/loadxml.c File Reference

Internal functions used inside the XML parser. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dancer-xml.h"

Internal static functions used inside XML parser.

This section describes function that are used only inside the XML parsing system.

#define ERROR_RETURN   return NULL;
static void dxml_free_attrib (dxml_attribute *a)
 Free attribute of a XML element.
static void * mallocwm (int l)
 malloc with an error message on error, exits with 1.
static int skipwhitechars (FILE *f)
 skip whitechar characters.
static int checkchar (int expect, FILE *f)
 check if the next char is c and barf if not.
static dxml_elementinitialize_element (void)
 Initializes element for use.
static char * read_character_stream (FILE *f, const char *stop_chars)
 read character stream
static dxml_elementread_PCDATA (FILE *f)
 reads PCdata, and returns.
static dxml_attributeread_attribute (FILE *f)
 read attributes, and end with / (/>) or > and give it back to the caller name="string" -- no space allowed?
static int skip_read_PI (FILE *f, int strict)
 read PI or doctype decl, <? .
static int skip_read_comment (FILE *f)
 read comment, <!(--) -->
static int read_element_start (FILE *f)
 read the start of <.
static dxml_elementread_element (FILE *f)
 Read an element tag start -- end.

Functions

dxml_elementdxml_read_xml (FILE *f)
 Read the XML file and load it as the element structure.
void dxml_free_xml (dxml_element *e)
 free the allocated xml structure


Detailed Description

Internal functions used inside the XML parser.


Define Documentation

#define ERROR_RETURN   return NULL;


Function Documentation

static int checkchar ( int  expect,
FILE *  f 
) [static]

check if the next char is c and barf if not.

return 1 if error.

static void dxml_free_attrib ( dxml_attribute a  )  [static]

Free attribute of a XML element.

void dxml_free_xml ( dxml_element e  ) 

free the allocated xml structure

dxml_element* dxml_read_xml ( FILE *  f  ) 

Read the XML file and load it as the element structure.

Returns:
NULL on fail.
Parameters:
f  File pointer to the XML file

static dxml_element* initialize_element ( void   )  [static]

Initializes element for use.

allocate, and initialize

static void* mallocwm ( int  l  )  [static]

malloc with an error message on error, exits with 1.

Parameters:
l  size of memory to allocate

static dxml_attribute* read_attribute ( FILE *  f  )  [static]

read attributes, and end with / (/>) or > and give it back to the caller name="string" -- no space allowed?

Returns:
NULL if no attribute or error.

static char* read_character_stream ( FILE *  f,
const char *  stop_chars 
) [static]

read character stream

Returns:
NULL on error

static dxml_element* read_element ( FILE *  f  )  [static]

Read an element tag start -- end.

assume that the pointer is at <tagname att="..."> ^ i.e. "<" is already read.

Returns:
NULL if error.

static int read_element_start ( FILE *  f  )  [static]

read the start of <.

.. part

Returns:
0 if it is not a XML normal start tag, that no further processing is required. 1 if it is a normal start tag. 2 on error.

static dxml_element* read_PCDATA ( FILE *  f  )  [static]

reads PCdata, and returns.

Returns:
NULL on error.

static int skip_read_comment ( FILE *  f  )  [static]

read comment, <!(--) -->

Returns:
0 on success, 1 on error

static int skip_read_PI ( FILE *  f,
int  strict 
) [static]

read PI or doctype decl, <? .

.. ?>

Returns:
1 on error.
Parameters:
strict  Check for < ?

static int skipwhitechars ( FILE *  f  )  [static]

skip whitechar characters.

..

Returns:
0 on success, 1 on EOF


Generated on Sat May 12 19:46:30 2007 for dancer-xml Reference by  doxygen 1.5.1