#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dancer-xml.h"
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; |
Referenced by read_element().
static int checkchar | ( | int | expect, | |
FILE * | f | |||
) | [static] |
check if the next char is c and barf if not.
return 1 if error.
Referenced by dxml_read_xml(), read_attribute(), and read_element().
static void dxml_free_attrib | ( | dxml_attribute * | a | ) | [static] |
Free attribute of a XML element.
References dxml_attribute::attribute_data, dxml_attribute::attribute_name, and dxml_attribute::next.
Referenced by dxml_free_xml(), read_attribute(), and read_element().
void dxml_free_xml | ( | dxml_element * | e | ) |
free the allocated xml structure
References dxml_element::child, dxml_free_attrib(), dxml_free_xml(), dxml_element::element_attribute, dxml_element::element_name, and dxml_element::next.
Referenced by dxml_free_xml(), main(), process_file(), read_element(), and read_PCDATA().
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 |
References checkchar(), read_element(), and skipwhitechars().
Referenced by main(), process_file(), and read_open().
static dxml_element* initialize_element | ( | void | ) | [static] |
Initializes element for use.
allocate, and initialize
References dxml_element::child, dxml_element::element_attribute, dxml_element::element_name, dxml_element::element_type_element, mallocwm(), and dxml_element::next.
Referenced by read_element(), and read_PCDATA().
static void* mallocwm | ( | int | l | ) | [static] |
malloc with an error message on error, exits with 1.
l | size of memory to allocate |
Referenced by initialize_element(), read_attribute(), and read_character_stream().
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?
References dxml_attribute::attribute_data, dxml_attribute::attribute_name, checkchar(), dxml_free_attrib(), mallocwm(), dxml_element::next, read_character_stream(), and skipwhitechars().
Referenced by read_element().
static char* read_character_stream | ( | FILE * | f, | |
const char * | stop_chars | |||
) | [static] |
read character stream
References mallocwm().
Referenced by read_attribute(), read_element(), and read_PCDATA().
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.
References checkchar(), dxml_element::child, dxml_free_attrib(), dxml_free_xml(), dxml_element::element_attribute, dxml_element::element_name, ERROR_RETURN, initialize_element(), dxml_element::next, read_attribute(), read_character_stream(), read_element_start(), read_PCDATA(), and skipwhitechars().
Referenced by dxml_read_xml().
static int read_element_start | ( | FILE * | f | ) | [static] |
read the start of <.
.. part
References skip_read_comment(), and skip_read_PI().
Referenced by read_element().
static dxml_element* read_PCDATA | ( | FILE * | f | ) | [static] |
reads PCdata, and returns.
References dxml_free_xml(), dxml_element::element_name, dxml_element::element_type_pcdata, initialize_element(), and read_character_stream().
Referenced by read_element().
static int skip_read_comment | ( | FILE * | f | ) | [static] |
read comment, <!(--) -->
References skip_read_PI(), and skipwhitechars().
Referenced by read_element_start().
static int skip_read_PI | ( | FILE * | f, | |
int | strict | |||
) | [static] |
read PI or doctype decl, <? .
.. ?>
strict | Check for < ? |
References skipwhitechars().
Referenced by read_element_start(), and skip_read_comment().
static int skipwhitechars | ( | FILE * | f | ) | [static] |
skip whitechar characters.
..
Referenced by dxml_read_xml(), read_attribute(), read_element(), skip_read_comment(), and skip_read_PI().