Node Type
Name | Description |
---|---|
MXML_ELEMENT | XML element with attributes |
MXML_INTEGER | Integer value |
MXML_OPAQUE | Opaque string |
MXML_REAL | Real value |
MXML_TEXT | Text fragment |
Local functions...
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
mxml_node_t *Top nodeFILE *File to read frommxml_type_tCallback functionNew nodemxml_node_t *Create a new element node.mxml_node_t *Parent nodeconst char *Name of elementNew nodemxml_node_t *Create a new integer node.mxml_node_t *Parent nodeintInteger valueNew nodemxml_node_t *Create a new opaque string.mxml_node_t *Parent nodeconst char *Opaque stringNew nodemxml_node_t *Create a new real number node.mxml_node_t *Parent nodedoubleReal number valueNew nodemxml_node_t *Create a new text fragment node.mxml_node_t *Parent nodeintLeading whitespace?const char *StringRemove a node from its parent.mxml_node_t *Node to remove0 on success, -1 on errorintSave an XML tree to a file.mxml_node_t *Node to writeFILE *File to write tointWhitespace callbackNext node or NULLmxml_node_t *Walk to the next logical node in the tree.mxml_node_t *Current nodemxml_node_t *Top nodeintDescend into tree?Previous node or NULLmxml_node_t *Walk to the previous logical node in the tree.mxml_node_t *Current nodemxml_node_t *Top nodeintDescend into tree?Data types...char *Attribute namechar *Attribute valuestruct mxml_attr_sstruct mxml_value_smxml_node_t *First child nodemxml_node_t *Last child nodemxml_node_t *Next node under same parentmxml_node_t *Parent nodemxml_node_t *Previous node under same parentmxml_type_tNode typemxml_value_tNode valuechar *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column
mxml_node_t * mxmlLoadFile( mxml_node_t * top, FILE * fp, mxml_type_t (*cb)(mxml_node_t *));
Name | Description |
---|---|
top | Top node |
fp | File to read from |
(*cb)(mxml_node_t *) | Callback function |
Local functions...
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)(mxml_node_t *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
Data types...
struct mxml_attr_s { char * name; char * value; };
Name | Description |
---|---|
name | Attribute name |
value | Attribute value |
mxml_node_t *First child nodemxml_node_t *Last child nodemxml_node_t *Next node under same parentmxml_node_t *Parent nodemxml_node_t *Previous node under same parentmxml_type_tNode typemxml_value_tNode valuechar *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column
struct mxml_node_s { mxml_node_t * child; mxml_node_t * last_child; mxml_node_t * next; mxml_node_t * parent; mxml_node_t * prev; mxml_type_t type; mxml_value_t value; };
Name | Description |
---|---|
child | First child node |
last_child | Last child node |
next | Next node under same parent |
parent | Parent node |
prev | Previous node under same parent |
type | Node type |
value | Node value |
char *Fragment stringintLeading whitespace?struct mxml_text_sNode TypeXML element with attributesInteger valueOpaque stringReal valueText fragmentAttribute ValueElement ValueText ValueNode ValueNodeC++ support...Prototypes...C++ support...End of "$Id: documentation.html,v 1.3 2003/06/07 21:27:05 mike Exp $".enum mxml_type_emxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column
struct mxml_text_s { char * string; int whitespace; };
Name | Description |
---|---|
string | Fragment string |
whitespace | Leading whitespace? |
mxml_attr_t *Attributeschar *Name of elementintNumber of attributesunion mxml_value_umxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column
struct mxml_value_s { mxml_attr_t * attrs; char * name; int num_attrs; };
Name | Description |
---|---|
attrs | Attributes |
name | Name of element |
num_attrs | Number of attributes |
typedef struct mxml_attr_s mxml_attr_t;
typedef struct mxml_value_s mxml_element_t;
typedef struct mxml_text_s mxml_text_t;
typedef enum mxml_type_e mxml_type_t;
typedef union mxml_value_u mxml_value_t;
mxml_element_tElementintInteger numberchar *Opaque stringdoubleReal numbermxml_text_tText fragmentmxml_node_t *Current nodemxml_node_t *Parent nodeNode typeconst char *String to writeFile to write toint(*cb)(mxml_node_t *int) intWhere valueCurrent column
struct mxml_value_u { mxml_element_t element; int integer; char * opaque; double real; mxml_text_t text; };
Name | Description |
---|---|
element | Element |
integer | Integer number |
opaque | Opaque string |
real | Real number |
text | Text fragment |