Functions


mxmlAdd()

Add a node to a tree.

Syntax

void
mxmlAdd(
    mxml_node_t * parent,
    int where,
    mxml_node_t * child,
    mxml_node_t * node);

Arguments

NameDescription
parentParent node
whereWhere to add
childChild node for where
nodeNode to add

Returns

Nothing.


mxmlDelete()

Delete a node and all of its children.

Syntax

void
mxmlDelete(
    mxml_node_t * node);

Arguments

NameDescription
nodeNode

Returns

Nothing.


mxmlElementGetAttr()

Get an attribute.

Syntax

const char *
mxmlElementGetAttr(
    mxml_node_t * node,
    const char * name);

Arguments

NameDescription
nodeElement node
nameName of attribute

Returns

Attribute value or NULL


mxmlElementSetAttr()

Set an attribute.

Syntax

void
mxmlElementSetAttr(
    mxml_node_t * node,
    const char * name,
    const char * value);

Arguments

NameDescription
nodeElement node
nameName of attribute
valueAttribute value

Returns

Nothing.


mxmlFindElement()

Find the named element.

Syntax

mxml_node_t *
mxmlFindElement(
    mxml_node_t * node,
    mxml_node_t * top,
    const char * name,
    const char * attr,
    const char * value,
    int descend);

Arguments

NameDescription
nodeCurrent node
topTop node
nameElement name or NULL for any
attrAttribute name, or NULL for none
valueAttribute value, or NULL for any
descendDescend into tree?

Returns

Element node or NULL


mxmlLoadFile()

Load a file into an XML node tree.

Syntax

mxml_node_t *
mxmlLoadFile(
    mxml_node_t * top,
    FILE * fp,
    mxml_type_t (*cb)(mxml_node_t *));

Arguments

NameDescription
topTop node
fpFile to read from
(*cb)(mxml_node_t *)Callback function

Returns

First node


mxmlNewElement()

Create a new element node.

Syntax

mxml_node_t *
mxmlNewElement(
    mxml_node_t * parent,
    const char * name);

Arguments

NameDescription
parentParent node
nameName of element

Returns

New node


mxmlNewInteger()

Create a new integer node.

Syntax

mxml_node_t *
mxmlNewInteger(
    mxml_node_t * parent,
    int integer);

Arguments

NameDescription
parentParent node
integerInteger value

Returns

New node


mxmlNewOpaque()

Create a new opaque string.

Syntax

mxml_node_t *
mxmlNewOpaque(
    mxml_node_t * parent,
    const char * opaque);

Arguments

NameDescription
parentParent node
opaqueOpaque string

Returns

New node


mxmlNewReal()

Create a new real number node.

Syntax

mxml_node_t *
mxmlNewReal(
    mxml_node_t * parent,
    double real);

Arguments

NameDescription
parentParent node
realReal number value

Returns

New node


mxmlNewText()

Create a new text fragment node.

Syntax

mxml_node_t *
mxmlNewText(
    mxml_node_t * parent,
    int whitespace,
    const char * string);

Arguments

NameDescription
parentParent node
whitespaceLeading whitespace?
stringString

Returns

New node


mxmlRemove()

Remove a node from its parent.

Syntax

void
mxmlRemove(
    mxml_node_t * node);

Arguments

NameDescription
nodeNode to remove

Returns

Nothing.


mxmlSaveFile()

Save an XML tree to a file.

Syntax

int
mxmlSaveFile(
    mxml_node_t * node,
    FILE * fp,
    int (*cb)(mxml_node_t *int));

Arguments

NameDescription
nodeNode to write
fpFile to write to
(*cb)(mxml_node_t *int)Whitespace callback

Returns

0 on success, -1 on error


mxmlWalkNext()

Walk to the next logical node in the tree.

Syntax

mxml_node_t *
mxmlWalkNext(
    mxml_node_t * node,
    mxml_node_t * top,
    int descend);

Arguments

NameDescription
nodeCurrent node
topTop node
descendDescend into tree?

Returns

Next node or NULL


mxmlWalkPrev()

Walk to the previous logical node in the tree.

Syntax

mxml_node_t *
mxmlWalkPrev(
    mxml_node_t * node,
    mxml_node_t * top,
    int descend);

Arguments

NameDescription
nodeCurrent node
topTop node
descendDescend into tree?

Returns

Previous node or NULL