Add a node to a tree.
void
mxmlAdd(
mxml_node_t * parent,
int where,
mxml_node_t * child,
mxml_node_t * node);
| Name | Description |
|---|---|
| parent | Parent node |
| where | Where to add |
| child | Child node for where |
| node | Node to add |
Nothing.
Delete a node and all of its children.
void
mxmlDelete(
mxml_node_t * node);
| Name | Description |
|---|---|
| node | Node |
Nothing.
Get an attribute.
const char *
mxmlElementGetAttr(
mxml_node_t * node,
const char * name);
| Name | Description |
|---|---|
| node | Element node |
| name | Name of attribute |
Attribute value or NULL
Set an attribute.
void
mxmlElementSetAttr(
mxml_node_t * node,
const char * name,
const char * value);
| Name | Description |
|---|---|
| node | Element node |
| name | Name of attribute |
| value | Attribute value |
Nothing.
Find the named element.
mxml_node_t *
mxmlFindElement(
mxml_node_t * node,
mxml_node_t * top,
const char * name,
const char * attr,
const char * value,
int descend);
| Name | Description |
|---|---|
| node | Current node |
| top | Top node |
| name | Element name or NULL for any |
| attr | Attribute name, or NULL for none |
| value | Attribute value, or NULL for any |
| descend | Descend into tree? |
Element node or NULL
Load a file into an XML node tree.
mxml_node_t *
mxmlLoadFile(
mxml_node_t * top,
FILE * fp,
mxml_type_t * cb);
| Name | Description |
|---|---|
| top | Top node |
| fp | File to read from |
| cb | Callback function |
First node
Create a new element node.
mxml_node_t *
mxmlNewElement(
mxml_node_t * parent,
const char * name);
| Name | Description |
|---|---|
| parent | Parent node |
| name | Name of element |
New node
Create a new integer node.
mxml_node_t *
mxmlNewInteger(
mxml_node_t * parent,
int integer);
| Name | Description |
|---|---|
| parent | Parent node |
| integer | Integer value |
New node
Create a new opaque string.
mxml_node_t *
mxmlNewOpaque(
mxml_node_t * parent,
const char * opaque);
| Name | Description |
|---|---|
| parent | Parent node |
| opaque | Opaque string |
New node
Create a new real number node.
mxml_node_t *
mxmlNewReal(
mxml_node_t * parent,
double real);
| Name | Description |
|---|---|
| parent | Parent node |
| real | Real number value |
New node
Create a new text fragment node.
mxml_node_t *
mxmlNewText(
mxml_node_t * parent,
int whitespace,
const char * string);
| Name | Description |
|---|---|
| parent | Parent node |
| whitespace | Leading whitespace? |
| string | String |
New node
Remove a node from its parent.
void
mxmlRemove(
mxml_node_t * node);
| Name | Description |
|---|---|
| node | Node to remove |
Nothing.
Save an XML tree to a file.
int
mxmlSaveFile(
mxml_node_t * node,
FILE * fp,
int * cb,
mxml_node_t * int);
| Name | Description |
|---|---|
| node | Node to write |
| fp | File to write to |
| cb | |
| int | Whitespace callback |
0 on success, -1 on error
Walk to the next logical node in the tree.
mxml_node_t *
mxmlWalkNext(
mxml_node_t * node,
mxml_node_t * top,
int descend);
| Name | Description |
|---|---|
| node | Current node |
| top | Top node |
| descend | Descend into tree? |
Next node or NULL
Walk to the previous logical node in the tree.
mxml_node_t *
mxmlWalkPrev(
mxml_node_t * node,
mxml_node_t * top,
int descend);
| Name | Description |
|---|---|
| node | Current node |
| top | Top node |
| descend | Descend into tree? |
Previous node or NULL