libgutenprint API Reference: include/gutenprint/mxml.h File Reference

libgutenprint API Reference 5.3.4

Data Structures | Macros | Typedefs | Enumerations | Functions
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>`
`#include <gutenprint/types.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

## Macros
#define | STP_MXML_WRAP 70 /* Wrap XML output at this column position */
#define | STP_MXML_TAB 8 /* Tabs every N columns */
#define | STP_MXML_NO_CALLBACK 0 /* Don't use a type callback */
#define | STP_MXML_NO_PARENT 0 /* No parent for the node */
#define | STP_MXML_DESCEND 1 /* Descend when finding/walking */
#define | STP_MXML_NO_DESCEND 0 /* Don't descend when finding/walking */
#define | STP_MXML_DESCEND_FIRST -1 /* Descend for first find */
#define | STP_MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */
#define | STP_MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */
#define | STP_MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */
#define | STP_MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */
#define | STP_MXML_ADD_BEFORE 0 /* Add node before specified node */
#define | STP_MXML_ADD_AFTER 1 /* Add node after specified node */
#define | STP_MXML_ADD_TO_PARENT NULL /* Add node relative to parent */

## Typedefs
typedef enum stp_mxml_type_e | stp_mxml_type_t
typedef struct stp_mxml_attr_s | stp_mxml_attr_t
typedef struct stp_mxml_value_s | stp_mxml_element_t
typedef struct stp_mxml_text_s | stp_mxml_text_t
typedef union stp_mxml_value_u | stp_mxml_value_t
typedef struct 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, STP_MXML_DIMENSION }

## 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_mxmlLoadFromFile (stp_mxml_node_t *top, const char *file, 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_mxmlNewDimension (stp_mxml_node_t *parent, stp_dimension_t real)
stp_mxml_node_t * | stp_mxmlNewText (stp_mxml_node_t *parent, int whitespace, const char *string)
stp_mxml_node_t * | stp_mxmlParent (stp_mxml_node_t *node)
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_mxmlSaveToFile (stp_mxml_node_t *node, const char *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.

## Macro Definition Documentation

## ◆ STP_MXML_ADD_AFTER

#define STP_MXML_ADD_AFTER 1 /* Add node after specified node */

## ◆ STP_MXML_ADD_BEFORE

#define STP_MXML_ADD_BEFORE 0 /* Add node before specified node */

## ◆ STP_MXML_ADD_TO_PARENT

#define STP_MXML_ADD_TO_PARENT NULL /* Add node relative to parent */

## ◆ STP_MXML_DESCEND

#define STP_MXML_DESCEND 1 /* Descend when finding/walking */

## ◆ STP_MXML_DESCEND_FIRST

#define STP_MXML_DESCEND_FIRST -1 /* Descend for first find */

## ◆ STP_MXML_NO_CALLBACK

#define STP_MXML_NO_CALLBACK 0 /* Don't use a type callback */

## ◆ STP_MXML_NO_DESCEND

#define STP_MXML_NO_DESCEND 0 /* Don't descend when finding/walking */

## ◆ STP_MXML_NO_PARENT

#define STP_MXML_NO_PARENT 0 /* No parent for the node */

## ◆ STP_MXML_TAB

#define STP_MXML_TAB 8 /* Tabs every N columns */

## ◆ STP_MXML_WRAP

#define STP_MXML_WRAP 70 /* Wrap XML output at this column position */

## ◆ STP_MXML_WS_AFTER_CLOSE

#define STP_MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */

## ◆ STP_MXML_WS_AFTER_OPEN

#define STP_MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */

## ◆ STP_MXML_WS_BEFORE_CLOSE

#define STP_MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */

## ◆ STP_MXML_WS_BEFORE_OPEN

#define STP_MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */

## Typedef Documentation

## ◆ stp_mxml_attr_t

typedef struct stp_mxml_attr_s stp_mxml_attr_t

## ◆ stp_mxml_element_t

typedef struct stp_mxml_value_s stp_mxml_element_t

## ◆ stp_mxml_node_t

typedef struct stp_mxml_node_s stp_mxml_node_t

## ◆ stp_mxml_text_t

typedef struct stp_mxml_text_s stp_mxml_text_t

## ◆ stp_mxml_type_t

typedef enum stp_mxml_type_e stp_mxml_type_t

## ◆ stp_mxml_value_t

typedef union stp_mxml_value_u stp_mxml_value_t

## Enumeration Type Documentation

## ◆ stp_mxml_type_e

enum stp_mxml_type_e

Enumerator
STP_MXML_ELEMENT |
STP_MXML_INTEGER |
STP_MXML_OPAQUE |
STP_MXML_REAL |
STP_MXML_TEXT |
STP_MXML_DIMENSION |

## Function Documentation

## ◆ stp_mxmlAdd()

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

## ◆ stp_mxmlDelete()

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

## ◆ stp_mxmlElementGetAttr()

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

## ◆ stp_mxmlElementSetAttr()

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

## ◆ stp_mxmlFindElement()

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_mxmlLoadFile()

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

## ◆ stp_mxmlLoadFromFile()

stp_mxml_node_t* stp_mxmlLoadFromFile | ( | stp_mxml_node_t * | top,
|  | const char * | file,
|  | stp_mxml_type_t(*)(stp_mxml_node_t *) | cb
| ) |  |

## ◆ stp_mxmlLoadString()

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

## ◆ stp_mxmlNewDimension()

stp_mxml_node_t* stp_mxmlNewDimension | ( | stp_mxml_node_t * | parent,
|  | stp_dimension_t | real
| ) |  |

## ◆ stp_mxmlNewElement()

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

## ◆ stp_mxmlNewInteger()

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

## ◆ stp_mxmlNewOpaque()

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

## ◆ stp_mxmlNewReal()

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

## ◆ stp_mxmlNewText()

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

## ◆ stp_mxmlParent()

stp_mxml_node_t* stp_mxmlParent | ( | stp_mxml_node_t * | node | ) |

## ◆ stp_mxmlRemove()

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

## ◆ stp_mxmlSaveAllocString()

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

## ◆ stp_mxmlSaveFile()

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

## ◆ stp_mxmlSaveString()

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

## ◆ stp_mxmlSaveToFile()

int stp_mxmlSaveToFile | ( | stp_mxml_node_t * | node,
|  | const char * | fp,
|  | int(*)(stp_mxml_node_t *, int) | cb
| ) |  |

## ◆ stp_mxmlWalkNext()

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

## ◆ stp_mxmlWalkPrev()

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