#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_element * | initialize_element (void) |
Initializes element for use. | |
static char * | read_character_stream (FILE *f, const char *stop_chars) |
read character stream | |
static dxml_element * | read_PCDATA (FILE *f) |
reads PCdata, and returns. | |
static dxml_attribute * | read_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_element * | read_element (FILE *f) |
Read an element tag start -- end. | |
Functions | |
dxml_element * | dxml_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 |
#define ERROR_RETURN return NULL; |
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.
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.
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?
static char* read_character_stream | ( | FILE * | f, | |
const char * | stop_chars | |||
) | [static] |
read character stream
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.
static int read_element_start | ( | FILE * | f | ) | [static] |
read the start of <.
.. part
static dxml_element* read_PCDATA | ( | FILE * | f | ) | [static] |
reads PCdata, and returns.
static int skip_read_comment | ( | FILE * | f | ) | [static] |
read comment, <!(--) -->
static int skip_read_PI | ( | FILE * | f, | |
int | strict | |||
) | [static] |
read PI or doctype decl, <? .
.. ?>
strict | Check for < ? |
static int skipwhitechars | ( | FILE * | f | ) | [static] |
skip whitechar characters.
..