# mxml.h File Reference

Mini-XML XML parsing functions. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <errno.h>`

## Data Structures

struct | stp_mxml_attr_s
struct | stp_mxml_value_s
struct | stp_mxml_text_s
union | stp_mxml_value_u
struct | stp_mxml_node_s

## Defines

#define | STP_MXML_WRAP 70
#define | STP_MXML_TAB 8
#define | STP_MXML_NO_CALLBACK 0
#define | STP_MXML_NO_PARENT 0
#define | STP_MXML_DESCEND 1
#define | STP_MXML_NO_DESCEND 0
#define | STP_MXML_DESCEND_FIRST -1
#define | STP_MXML_WS_BEFORE_OPEN 0
#define | STP_MXML_WS_AFTER_OPEN 1
#define | STP_MXML_WS_BEFORE_CLOSE 2
#define | STP_MXML_WS_AFTER_CLOSE 3
#define | STP_MXML_ADD_BEFORE 0
#define | STP_MXML_ADD_AFTER 1
#define | STP_MXML_ADD_TO_PARENT NULL

## Typedefs

typedef enum stp_mxml_type_e | stp_mxml_type_t
typedef stp_mxml_attr_s | stp_mxml_attr_t
typedef stp_mxml_value_s | stp_mxml_element_t
typedef stp_mxml_text_s | stp_mxml_text_t
typedef stp_mxml_value_u | stp_mxml_value_t
typedef stp_mxml_node_s | stp_mxml_node_t

## Enumerations

enum | stp_mxml_type_e { STP_MXML_ELEMENT, STP_MXML_INTEGER, STP_MXML_OPAQUE, STP_MXML_REAL, STP_MXML_TEXT }

## Functions

void | stp_mxmlAdd (stp_mxml_node_t *parent, int where, stp_mxml_node_t *child, stp_mxml_node_t *node)
void | stp_mxmlDelete (stp_mxml_node_t *node)
const char * | stp_mxmlElementGetAttr (stp_mxml_node_t *node, const char *name)
void | stp_mxmlElementSetAttr (stp_mxml_node_t *node, const char *name, const char *value)
stp_mxml_node_t * | stp_mxmlFindElement (stp_mxml_node_t *node, stp_mxml_node_t *top, const char *name, const char *attr, const char *value, int descend)
stp_mxml_node_t * | stp_mxmlLoadFile (stp_mxml_node_t *top, FILE *fp, stp_mxml_type_t(*cb)(stp_mxml_node_t *))
stp_mxml_node_t * | stp_mxmlLoadString (stp_mxml_node_t *top, const char *s, stp_mxml_type_t(*cb)(stp_mxml_node_t *))
stp_mxml_node_t * | stp_mxmlNewElement (stp_mxml_node_t *parent, const char *name)
stp_mxml_node_t * | stp_mxmlNewInteger (stp_mxml_node_t *parent, int integer)
stp_mxml_node_t * | stp_mxmlNewOpaque (stp_mxml_node_t *parent, const char *opaque)
stp_mxml_node_t * | stp_mxmlNewReal (stp_mxml_node_t *parent, double real)
stp_mxml_node_t * | stp_mxmlNewText (stp_mxml_node_t *parent, int whitespace, const char *string)
void | stp_mxmlRemove (stp_mxml_node_t *node)
char * | stp_mxmlSaveAllocString (stp_mxml_node_t *node, int(*cb)(stp_mxml_node_t *, int))
int | stp_mxmlSaveFile (stp_mxml_node_t *node, FILE *fp, int(*cb)(stp_mxml_node_t *, int))
int | stp_mxmlSaveString (stp_mxml_node_t *node, char *buffer, int bufsize, int(*cb)(stp_mxml_node_t *, int))
stp_mxml_node_t * | stp_mxmlWalkNext (stp_mxml_node_t *node, stp_mxml_node_t *top, int descend)
stp_mxml_node_t * | stp_mxmlWalkPrev (stp_mxml_node_t *node, stp_mxml_node_t *top, int descend)

## Detailed Description

Mini-XML XML parsing functions.

## Define Documentation

#define STP_MXML_ADD_AFTER 1

#define STP_MXML_ADD_BEFORE 0

#define STP_MXML_ADD_TO_PARENT NULL

#define STP_MXML_DESCEND 1

#define STP_MXML_DESCEND_FIRST -1

#define STP_MXML_NO_CALLBACK 0

#define STP_MXML_NO_DESCEND 0

#define STP_MXML_NO_PARENT 0

#define STP_MXML_TAB 8

#define STP_MXML_WRAP 70

#define STP_MXML_WS_AFTER_CLOSE 3

#define STP_MXML_WS_AFTER_OPEN 1

#define STP_MXML_WS_BEFORE_CLOSE 2

#define STP_MXML_WS_BEFORE_OPEN 0

## Typedef Documentation

typedef struct stp_mxml_attr_s stp_mxml_attr_t

typedef struct stp_mxml_value_s stp_mxml_element_t

typedef struct stp_mxml_node_s stp_mxml_node_t

typedef struct stp_mxml_text_s stp_mxml_text_t

typedef enum stp_mxml_type_e stp_mxml_type_t

typedef union stp_mxml_value_u stp_mxml_value_t

## Enumeration Type Documentation

enum stp_mxml_type_e

Enumerator:

  STP_MXML_ELEMENT |
  STP_MXML_INTEGER |
  STP_MXML_OPAQUE |
  STP_MXML_REAL |
  STP_MXML_TEXT |

## Function Documentation

void stp_mxmlAdd | ( | stp_mxml_node_t * | parent,
|  | int | where,
|  | stp_mxml_node_t * | child,
|  | stp_mxml_node_t * | node
| ) |

void stp_mxmlDelete | ( | stp_mxml_node_t * | node | ) |

const char* stp_mxmlElementGetAttr | ( | stp_mxml_node_t * | node,
|  | const char * | name
| ) |

void stp_mxmlElementSetAttr | ( | stp_mxml_node_t * | node,
|  | const char * | name,
|  | const char * | value
| ) |

stp_mxml_node_t* stp_mxmlFindElement | ( | stp_mxml_node_t * | node,
|  | stp_mxml_node_t * | top,
|  | const char * | name,
|  | const char * | attr,
|  | const char * | value,
|  | int | descend
| ) |

stp_mxml_node_t* stp_mxmlLoadFile | ( | stp_mxml_node_t * | top,
|  | FILE * | fp,
|  | stp_mxml_type_t(*)(stp_mxml_node_t *) | cb
| ) |

stp_mxml_node_t* stp_mxmlLoadString | ( | stp_mxml_node_t * | top,
|  | const char * | s,
|  | stp_mxml_type_t(*)(stp_mxml_node_t *) | cb
| ) |

stp_mxml_node_t* stp_mxmlNewElement | ( | stp_mxml_node_t * | parent,
|  | const char * | name
| ) |

stp_mxml_node_t* stp_mxmlNewInteger | ( | stp_mxml_node_t * | parent,
|  | int | integer
| ) |

stp_mxml_node_t* stp_mxmlNewOpaque | ( | stp_mxml_node_t * | parent,
|  | const char * | opaque
| ) |

stp_mxml_node_t* stp_mxmlNewReal | ( | stp_mxml_node_t * | parent,
|  | double | real
| ) |

stp_mxml_node_t* stp_mxmlNewText | ( | stp_mxml_node_t * | parent,
|  | int | whitespace,
|  | const char * | string
| ) |

void stp_mxmlRemove | ( | stp_mxml_node_t * | node | ) |

char* stp_mxmlSaveAllocString | ( | stp_mxml_node_t * | node,
|  | int(*)(stp_mxml_node_t *, int) | cb
| ) |

int stp_mxmlSaveFile | ( | stp_mxml_node_t * | node,
|  | FILE * | fp,
|  | int(*)(stp_mxml_node_t *, int) | cb
| ) |

int stp_mxmlSaveString | ( | stp_mxml_node_t * | node,
|  | char * | buffer,
|  | int | bufsize,
|  | int(*)(stp_mxml_node_t *, int) | cb
| ) |

stp_mxml_node_t* stp_mxmlWalkNext | ( | stp_mxml_node_t * | node,
|  | stp_mxml_node_t * | top,
|  | int | descend
| ) |

stp_mxml_node_t* stp_mxmlWalkPrev | ( | stp_mxml_node_t * | node,
|  | stp_mxml_node_t * | top,
|  | int | descend
| ) |