From 346be509a30053f306811721fcc6ca26c85d4cb1 Mon Sep 17 00:00:00 2001
From: Michael R Sweet SAX event type.
- The XML node type.
- Add a node to a tree.
Adds the specified node to the parent. If the child argument is not
NULL, puts the new node before or after the specified child depending
@@ -136,131 +133,120 @@ on the value of the where argument. If the child argument is NULL,
puts the new node at the beginning of the child list (MXML_ADD_BEFORE)
or at the end of the child list (MXML_ADD_AFTER). The constant
MXML_ADD_TO_PARENT can be used to specify a NULL child pointer.
-
-void Nothing.Contents
-
-
-
-Enumerations
-
-
-
-mxml_sax_event_e
-Description
-Values
-
-
-
-Name Description
-MXML_SAX_CDATA CDATA node
-
-MXML_SAX_COMMENT Comment node
-
-MXML_SAX_DATA Data node
-
-MXML_SAX_DIRECTIVE Processing directive node
-
-MXML_SAX_ELEMENT_CLOSE Element closed
-
-MXML_SAX_ELEMENT_OPEN Element opened
- mxml_type_e
-Description
-Values
-
-
-
-Name Description
-MXML_CUSTOM Mini-XML 2.1 Custom data
-
-MXML_ELEMENT XML element with attributes
-
-MXML_IGNORE Mini-XML 2.3 Ignore/throw away node
-
-MXML_INTEGER Integer value
-
-MXML_OPAQUE Opaque string
-
-MXML_REAL Real value
-
-MXML_TEXT Text fragment
- Library
+Reference
+
Functions
-
-mxmlAdd()
-Description
+mxmlAdd
Syntax
-
-mxmlAdd(
- mxml_node_t * parent,
- int where,
- mxml_node_t * child,
- mxml_node_t * node);
-Arguments
-
-
-
-Name Description
-parent Parent node
-
-where Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER
-
-child Child node for where or MXML_ADD_TO_PARENT
-
-node Node to add
- Returns
-
+void mxmlAdd (
+ mxml_node_t *parent,
+ int where,
+ mxml_node_t *child,
+ mxml_node_t *node
+);
Delete a node and all of its children.
If the specified node has a parent, this function first removes the node from its parent using the mxmlRemove() function. -
-void
-mxmlDelete(
- mxml_node_t * node);
-
Name | Description |
---|---|
node | Node to delete - |
Nothing.
+ +
+void mxmlDelete (
+ mxml_node_t *node
+);
Delete an attribute. -
-void
-mxmlElementDeleteAttr(
- mxml_node_t * node,
- const char * name);
-
Name | Description |
---|---|
node | Element - |
name | Attribute name - |
Nothing.
+ +
+void mxmlElementDeleteAttr (
+ mxml_node_t *node,
+ const char *name
+);
Get an attribute.
This function returns NULL if the node is not an element or the named attribute does not exist. -
-const char *
-mxmlElementGetAttr(
- mxml_node_t * node,
- const char * name);
-
Name | Description |
---|---|
node | Element node - |
name | Name of attribute - |
+const char *mxmlElementGetAttr (
+ mxml_node_t *node,
+ const char *name
+);
Attribute value or NULL
-Set an attribute.
If the named attribute already exists, the value of the attribute is replaced by the new string value. The string value is copied into the element node. This function does nothing if the node is not an element. -
-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.
+ +
+void mxmlElementSetAttr (
+ mxml_node_t *node,
+ const char *name,
+ const char *value
+);
Set an attribute with a formatted value.
If the named attribute already exists, the value of the attribute is replaced by the new formatted string. The formatted string value is @@ -268,100 +254,83 @@ copied into the element node. This function does nothing if the node is not an element. -
-void
-mxmlElementSetAttrf(
- mxml_node_t * node,
- const char * name,
- const char * format,
- ...);
-
Name | Description |
---|---|
node | Element node - |
name | Name of attribute - |
format | Printf-style attribute value - |
... | Additional arguments as needed - |
Nothing.
+ +
+void mxmlElementSetAttrf (
+ mxml_node_t *node,
+ const char *name,
+ const char *format,
+ ...
+);
Add a callback to convert entities to Unicode. -
-int
-mxmlEntityAddCallback(void);
-
None.
-+int mxmlEntityAddCallback (void);
+0 on success, -1 on failure
-Get the name that corresponds to the character value.
If val does not need to be represented by a named entity, NULL is returned. -
-const char *
-mxmlEntityGetName(
- int val);
-
Name | Description |
---|---|
val | Character value - |
+const char *mxmlEntityGetName (
+ int val
+);
Entity name or NULL
-Get the character corresponding to a named entity.
The entity name can also be a numeric constant. -1 is returned if the name is not known. -
-int
-mxmlEntityGetValue(
- const char * name);
-
Name | Description |
---|---|
name | Entity name - |
+int mxmlEntityGetValue (
+ const char *name
+);
Character value or -1 on error
-Remove a callback. -
-void
-mxmlEntityRemoveCallback(void);
-
None.
-Nothing.
+ ++void mxmlEntityRemoveCallback (void);
-Find the named element.
The search is constrained by the name, attribute name, and value; any NULL names or values are treated as wildcards, so different kinds of @@ -371,159 +340,154 @@ whether the search descends into child nodes; normally you will use MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find additional direct descendents of the node. The top node argument constrains the search to a particular node's children. -
-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 - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST - |
+mxml_node_t *mxmlFindElement (
+ mxml_node_t *node,
+ mxml_node_t *top,
+ const char *name,
+ const char *attr,
+ const char *value,
+ int descend
+);
Element node or NULL
-Delete an index. -
-void
-mxmlIndexDelete(
- mxml_index_t * ind);
-
Name | Description |
---|---|
ind | Index to delete - |
Nothing.
+ +
+void mxmlIndexDelete (
+ mxml_index_t *ind
+);
Return the next node in the index.
Nodes are returned in the sorted order of the index. -
-mxml_node_t *
-mxmlIndexEnum(
- mxml_index_t * ind);
-
Name | Description |
---|---|
ind | Index to enumerate - |
+mxml_node_t *mxmlIndexEnum (
+ mxml_index_t *ind
+);
Next node or NULL if there is none
-Find the next matching node.
You should call mxmlIndexReset() prior to using this function for the first time with a particular set of "element" and "value" strings. Passing NULL for both "element" and "value" is equivalent to calling mxmlIndexEnum(). -
-mxml_node_t *
-mxmlIndexFind(
- mxml_index_t * ind,
- const char * element,
- const char * value);
-
Name | Description |
---|---|
ind | Index to search - |
element | Element name to find, if any - |
value | Attribute value, if any - |
+mxml_node_t *mxmlIndexFind (
+ mxml_index_t *ind,
+ const char *element,
+ const char *value
+);
Node or NULL if none found
-Create a new index.
The index will contain all nodes that contain the named element and/or attribute. If both "element" and "attr" are NULL, then the index will contain a sorted list of the elements in the node tree. Nodes are sorted by element name and optionally by attribute value if the "attr" argument is not NULL. -
-mxml_index_t *
-mxmlIndexNew(
- mxml_node_t * node,
- const char * element,
- const char * attr);
-
Name | Description |
---|---|
node | XML node tree - |
element | Element to index or NULL for all - |
attr | Attribute to index or NULL for none - |
+mxml_index_t *mxmlIndexNew (
+ mxml_node_t *node,
+ const char *element,
+ const char *attr
+);
New index
-Reset the enumeration/find pointer in the index and return the first node in the index.
This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time. -
-mxml_node_t *
-mxmlIndexReset(
- mxml_index_t * ind);
-
Name | Description |
---|---|
ind | Index to reset - |
+mxml_node_t *mxmlIndexReset (
+ mxml_index_t *ind
+);
First node or NULL if there is none
-Load a file descriptor into an XML node tree.
The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a @@ -534,30 +498,30 @@ MXML_ELEMENT or MXML_TEXT nodes.
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -
-mxml_node_t *
-mxmlLoadFd(
- mxml_node_t * top,
- int fd,
- mxml_load_cb_t cb);
-
Name | Description |
---|---|
top | Top node - |
fd | File descriptor to read from - |
cb | Callback function or MXML_NO_CALLBACK - |
+mxml_node_t *mxmlLoadFd (
+ mxml_node_t *top,
+ int fd,
+ mxml_load_cb_t cb
+);
First node or NULL if the file could not be read.
-Load a file into an XML node tree.
The nodes in the specified file are added to the specified top node. If no top node is provided, the XML file MUST be well-formed with a @@ -568,30 +532,30 @@ MXML_ELEMENT or MXML_TEXT nodes.
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -
-mxml_node_t *
-mxmlLoadFile(
- mxml_node_t * top,
- FILE * fp,
- mxml_load_cb_t cb);
-
Name | Description |
---|---|
top | Top node - |
fp | File to read from - |
cb | Callback function or MXML_NO_CALLBACK - |
+mxml_node_t *mxmlLoadFile (
+ mxml_node_t *top,
+ FILE *fp,
+ mxml_load_cb_t cb
+);
First node or NULL if the file could not be read.
-Load a string into an XML node tree.
The nodes in the specified string are added to the specified top node. If no top node is provided, the XML string MUST be well-formed with a @@ -602,30 +566,30 @@ MXML_ELEMENT or MXML_TEXT nodes.
The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading child nodes of the specified type. -
-mxml_node_t *
-mxmlLoadString(
- mxml_node_t * top,
- const char * s,
- mxml_load_cb_t cb);
-
Name | Description |
---|---|
top | Top node - |
s | String to load - |
cb | Callback function or MXML_NO_CALLBACK - |
+mxml_node_t *mxmlLoadString (
+ mxml_node_t *top,
+ const char *s,
+ mxml_load_cb_t cb
+);
First node or NULL if the string has errors.
-Create a new CDATA node.
The new CDATA node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new @@ -633,27 +597,26 @@ CDATA node has no parent. The data string must be nul-terminated and is copied into the new node. CDATA nodes use the MXML_ELEMENT type. -
-mxml_node_t *
-mxmlNewCDATA(
- mxml_node_t * parent,
- const char * data);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
data | Data string - |
+mxml_node_t *mxmlNewCDATA (
+ mxml_node_t *parent,
+ const char *data
+);
New node
-Create a new custom data node.
The new custom node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new @@ -661,282 +624,269 @@ element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed. -
-mxml_node_t *
-mxmlNewCustom(
- mxml_node_t * parent,
- void * data,
- mxml_custom_destroy_cb_t destroy);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
data | Pointer to data - |
destroy | Function to destroy data - |
+mxml_node_t *mxmlNewCustom (
+ mxml_node_t *parent,
+ void *data,
+ mxml_custom_destroy_cb_t destroy
+);
New node
-Create a new element node.
The new element node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new element node has no parent. -
-mxml_node_t *
-mxmlNewElement(
- mxml_node_t * parent,
- const char * name);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
name | Name of element - |
+mxml_node_t *mxmlNewElement (
+ mxml_node_t *parent,
+ const char *name
+);
New node
-Create a new integer node.
The new integer node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new integer node has no parent. -
-mxml_node_t *
-mxmlNewInteger(
- mxml_node_t * parent,
- int integer);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
integer | Integer value - |
+mxml_node_t *mxmlNewInteger (
+ mxml_node_t *parent,
+ int integer
+);
New node
-Create a new opaque string.
The new opaque node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new opaque node has no parent. The opaque string must be nul-terminated and is copied into the new node. -
-mxml_node_t *
-mxmlNewOpaque(
- mxml_node_t * parent,
- const char * opaque);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
opaque | Opaque string - |
+mxml_node_t *mxmlNewOpaque (
+ mxml_node_t *parent,
+ const char *opaque
+);
New node
-Create a new real number node.
The new real number node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new real number node has no parent. -
-mxml_node_t *
-mxmlNewReal(
- mxml_node_t * parent,
- double real);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
real | Real number value - |
+mxml_node_t *mxmlNewReal (
+ mxml_node_t *parent,
+ double real
+);
New node
-Create a new text fragment node.
The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The text string must be nul-terminated and is copied into the new node. -
-mxml_node_t *
-mxmlNewText(
- mxml_node_t * parent,
- int whitespace,
- const char * string);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
whitespace | 1 = leading whitespace, 0 = no whitespace - |
string | String - |
+mxml_node_t *mxmlNewText (
+ mxml_node_t *parent,
+ int whitespace,
+ const char *string
+);
New node
-Create a new formatted text fragment node.
The new text node is added to the end of the specified parent's child list. The constant MXML_NO_PARENT can be used to specify that the new text node has no parent. The whitespace parameter is used to specify whether leading whitespace is present before the node. The format string must be nul-terminated and is formatted into the new node. -
-mxml_node_t *
-mxmlNewTextf(
- mxml_node_t * parent,
- int whitespace,
- const char * format,
- ...);
-
Name | Description |
---|---|
parent | Parent node or MXML_NO_PARENT - |
whitespace | 1 = leading whitespace, 0 = no whitespace - |
format | Printf-style frmat string - |
... | Additional args as needed - |
+mxml_node_t *mxmlNewTextf (
+ mxml_node_t *parent,
+ int whitespace,
+ const char *format,
+ ...
+);
New node
-Create a new XML document tree.
The "version" argument specifies the version number to put in the ?xml element node. If NULL, version 1.0 is assumed. -
-mxml_node_t *
-mxmlNewXML(
- const char * version);
-
Name | Description |
---|---|
version | Version number to use - |
+mxml_node_t *mxmlNewXML (
+ const char *version
+);
New ?xml node
-Release a node.
When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete(). -
-int
-mxmlRelease(
- mxml_node_t * node);
-
Name | Description |
---|---|
node | Node - |
+int mxmlRelease (
+ mxml_node_t *node
+);
New reference count
-Remove a node from its parent.
Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent. -
-void
-mxmlRemove(
- mxml_node_t * node);
-
Name | Description |
---|---|
node | Node to remove - |
Nothing.
+ +
+void mxmlRemove (
+ mxml_node_t *node
+);
Retain a node. -
-int
-mxmlRetain(
- mxml_node_t * node);
-
Name | Description |
---|---|
node | Node - |
+int mxmlRetain (
+ mxml_node_t *node
+);
New reference count
-Load a file descriptor into an XML node tree using a SAX callback.
The nodes in the specified file are added to the specified top node. @@ -953,36 +903,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -
-mxml_node_t *
-mxmlSAXLoadFd(
- mxml_node_t * top,
- int fd,
- mxml_load_cb_t cb,
- mxml_sax_cb_t sax_cb,
- void * sax_data);
-
Name | Description |
---|---|
top | Top node - |
fd | File descriptor to read from - |
cb | Callback function or MXML_NO_CALLBACK - |
sax_cb | SAX callback or MXML_NO_CALLBACK - |
sax_data | SAX user data - |
+mxml_node_t *mxmlSAXLoadFd (
+ mxml_node_t *top,
+ int fd,
+ mxml_load_cb_t cb,
+ mxml_sax_cb_t sax_cb,
+ void *sax_data
+);
First node or NULL if the file could not be read.
-Load a file into an XML node tree using a SAX callback.
The nodes in the specified file are added to the specified top node. @@ -999,36 +951,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -
-mxml_node_t *
-mxmlSAXLoadFile(
- mxml_node_t * top,
- FILE * fp,
- mxml_load_cb_t cb,
- mxml_sax_cb_t sax_cb,
- void * sax_data);
-
Name | Description |
---|---|
top | Top node - |
fp | File to read from - |
cb | Callback function or MXML_NO_CALLBACK - |
sax_cb | SAX callback or MXML_NO_CALLBACK - |
sax_data | SAX user data - |
+mxml_node_t *mxmlSAXLoadFile (
+ mxml_node_t *top,
+ FILE *fp,
+ mxml_load_cb_t cb,
+ mxml_sax_cb_t sax_cb,
+ void *sax_data
+);
First node or NULL if the file could not be read.
-Load a string into an XML node tree using a SAX callback.
The nodes in the specified string are added to the specified top node. @@ -1045,36 +999,38 @@ be kept for later use. Otherwise, nodes are deleted when the parent node is closed or after each data, comment, CDATA, or directive node. -
-mxml_node_t *
-mxmlSAXLoadString(
- mxml_node_t * top,
- const char * s,
- mxml_load_cb_t cb,
- mxml_sax_cb_t sax_cb,
- void * sax_data);
-
Name | Description |
---|---|
top | Top node - |
s | String to load - |
cb | Callback function or MXML_NO_CALLBACK - |
sax_cb | SAX callback or MXML_NO_CALLBACK - |
sax_data | SAX user data - |
+mxml_node_t *mxmlSAXLoadString (
+ mxml_node_t *top,
+ const char *s,
+ mxml_load_cb_t cb,
+ mxml_sax_cb_t sax_cb,
+ void *sax_data
+);
First node or NULL if the string has errors.
-Save an XML node tree to an allocated string.
This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed @@ -1086,87 +1042,86 @@ string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. -
-char *
-mxmlSaveAllocString(
- mxml_node_t * node,
- mxml_save_cb_t cb);
-
Name | Description |
---|---|
node | Node to write - |
cb | Whitespace callback or MXML_NO_CALLBACK - |
+char *mxmlSaveAllocString (
+ mxml_node_t *node,
+ mxml_save_cb_t cb
+);
Allocated string or NULL
-Save an XML tree to a file descriptor.
The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. -
-int
-mxmlSaveFd(
- mxml_node_t * node,
- int fd,
- mxml_save_cb_t cb);
-
Name | Description |
---|---|
node | Node to write - |
fd | File descriptor to write to - |
cb | Whitespace callback or MXML_NO_CALLBACK - |
+int mxmlSaveFd (
+ mxml_node_t *node,
+ int fd,
+ mxml_save_cb_t cb
+);
0 on success, -1 on error.
-Save an XML tree to a file.
The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. -
-int
-mxmlSaveFile(
- mxml_node_t * node,
- FILE * fp,
- mxml_save_cb_t cb);
-
Name | Description |
---|---|
node | Node to write - |
fp | File to write to - |
cb | Whitespace callback or MXML_NO_CALLBACK - |
+int mxmlSaveFile (
+ mxml_node_t *node,
+ FILE *fp,
+ mxml_save_cb_t cb
+);
0 on success, -1 on error.
-Save an XML node tree to a string.
This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters @@ -1176,518 +1131,342 @@ string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. -
-int
-mxmlSaveString(
- mxml_node_t * node,
- char * buffer,
- int bufsize,
- mxml_save_cb_t cb);
-
Name | Description |
---|---|
node | Node to write - |
buffer | String buffer - |
bufsize | Size of string buffer - |
cb | Whitespace callback or MXML_NO_CALLBACK - |
+int mxmlSaveString (
+ mxml_node_t *node,
+ char *buffer,
+ int bufsize,
+ mxml_save_cb_t cb
+);
Size of string
-Set the element name of a CDATA node.
The node is not changed if it is not a CDATA element node. -
-int
-mxmlSetCDATA(
- mxml_node_t * node,
- const char * data);
-
Name | Description |
---|---|
node | Node to set - |
data | New data string - |
+int mxmlSetCDATA (
+ mxml_node_t *node,
+ const char *data
+);
0 on success, -1 on failure
-Set the data and destructor of a custom data node.
The node is not changed if it is not a custom node. -
-int
-mxmlSetCustom(
- mxml_node_t * node,
- void * data,
- mxml_custom_destroy_cb_t destroy);
-
Name | Description |
---|---|
node | Node to set - |
data | New data pointer - |
destroy | New destructor function - |
+int mxmlSetCustom (
+ mxml_node_t *node,
+ void *data,
+ mxml_custom_destroy_cb_t destroy
+);
0 on success, -1 on failure
-Set the handling functions for custom data.
The load function accepts a node pointer and a data string and must return 0 on success and non-zero on error.
The save function accepts a node pointer and must return a malloc'd string on success and NULL on error. -
-void
-mxmlSetCustomHandlers(
- mxml_custom_load_cb_t load,
- mxml_custom_save_cb_t save);
-
Name | Description |
---|---|
load | Load function - |
save | Save function - |
Nothing.
+ +
+void mxmlSetCustomHandlers (
+ mxml_custom_load_cb_t load,
+ mxml_custom_save_cb_t save
+);
Set the name of an element node.
The node is not changed if it is not an element node. -
-int
-mxmlSetElement(
- mxml_node_t * node,
- const char * name);
-
Name | Description |
---|---|
node | Node to set - |
name | New name string - |
+int mxmlSetElement (
+ mxml_node_t *node,
+ const char *name
+);
0 on success, -1 on failure
-Set the error message callback. -
-void
-mxmlSetErrorCallback(
- mxml_error_cb_t cb);
-
Name | Description |
---|---|
cb | Error callback function - |
Nothing.
+ +
+void mxmlSetErrorCallback (
+ mxml_error_cb_t cb
+);
Set the value of an integer node.
The node is not changed if it is not an integer node. -
-int
-mxmlSetInteger(
- mxml_node_t * node,
- int integer);
-
Name | Description |
---|---|
node | Node to set - |
integer | Integer value - |
+int mxmlSetInteger (
+ mxml_node_t *node,
+ int integer
+);
0 on success, -1 on failure
-Set the value of an opaque node.
The node is not changed if it is not an opaque node. -
-int
-mxmlSetOpaque(
- mxml_node_t * node,
- const char * opaque);
-
Name | Description |
---|---|
node | Node to set - |
opaque | Opaque string - |
+int mxmlSetOpaque (
+ mxml_node_t *node,
+ const char *opaque
+);
0 on success, -1 on failure
-Set the value of a real number node.
The node is not changed if it is not a real number node. -
-int
-mxmlSetReal(
- mxml_node_t * node,
- double real);
-
Name | Description |
---|---|
node | Node to set - |
real | Real number value - |
+int mxmlSetReal (
+ mxml_node_t *node,
+ double real
+);
0 on success, -1 on failure
-Set the value of a text node.
The node is not changed if it is not a text node. -
-int
-mxmlSetText(
- mxml_node_t * node,
- int whitespace,
- const char * string);
-
Name | Description |
---|---|
node | Node to set - |
whitespace | 1 = leading whitespace, 0 = no whitespace - |
string | String - |
+int mxmlSetText (
+ mxml_node_t *node,
+ int whitespace,
+ const char *string
+);
0 on success, -1 on failure
-Set the value of a text node to a formatted string.
The node is not changed if it is not a text node. -
-int
-mxmlSetTextf(
- mxml_node_t * node,
- int whitespace,
- const char * format,
- ...);
-
Name | Description |
---|---|
node | Node to set - |
whitespace | 1 = leading whitespace, 0 = no whitespace - |
format | Printf-style format string - |
... | Additional arguments as needed - |
+int mxmlSetTextf (
+ mxml_node_t *node,
+ int whitespace,
+ const char *format,
+ ...
+);
0 on success, -1 on failure
-Set the the wrap margin when saving XML data.
Wrapping is disabled when "column" is <= 0. -
-void
-mxmlSetWrapMargin(
- int column);
-
Name | Description |
---|---|
column | Column for wrapping - |
Nothing.
+ +
+void mxmlSetWrapMargin (
+ int column
+);
Walk to the next logical node in the tree.
The descend argument controls whether the first child is considered to be the next node. The top node argument constrains the walk to the node's children. -
-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 - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST - |
+mxml_node_t *mxmlWalkNext (
+ mxml_node_t *node,
+ mxml_node_t *top,
+ int descend
+);
Next node or NULL
-Walk to the previous logical node in the tree.
The descend argument controls whether the previous node's last child is considered to be the previous node. The top node argument constrains the walk to the node's children. -
-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 - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST - |
+mxml_node_t *mxmlWalkPrev (
+ mxml_node_t *node,
+ mxml_node_t *top,
+ int descend
+);
Previous node or NULL
-An XML element attribute value. -
-struct mxml_attr_s
-{
- char * name;
- char * value;
-};
Name | Description |
---|---|
name | Attribute name - |
value | Attribute value - |
An XML custom value. -
-struct mxml_custom_s
-{
- void * data;
- mxml_custom_destroy_cb_t destroy;
-};
Name | Description |
---|---|
data | Pointer to (allocated) custom data - |
destroy | Pointer to destructor function - |
An XML element value. -
-struct mxml_element_s
-{
- mxml_attr_t * attrs;
- char * name;
- int num_attrs;
-};
Name | Description |
---|---|
attrs | Attributes - |
name | Name of element - |
num_attrs | Number of attributes - |
An XML node index. -
-struct mxml_index_s
-{
- int alloc_nodes;
- char * attr;
- int cur_node;
- mxml_node_t ** nodes;
- int num_nodes;
-};
Name | Description |
---|---|
alloc_nodes | Allocated nodes in index - |
attr | Attribute used for indexing or NULL - |
cur_node | Current node - |
nodes | Node array - |
num_nodes | Number of nodes in index - |
An XML node. -
-struct mxml_node_s
-{
- struct mxml_node_s * child;
- struct mxml_node_s * last_child;
- struct mxml_node_s * next;
- struct mxml_node_s * parent;
- struct mxml_node_s * prev;
- int ref_count;
- mxml_type_t type;
- void * user_data;
- 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 - |
ref_count | Use count - |
type | Node type - |
user_data | User data - |
value | Node value - |
An XML text value. -
-struct mxml_text_s
-{
- char * string;
- int whitespace;
-};
Name | Description |
---|---|
string | Fragment string - |
whitespace | Leading whitespace? - |
An XML element attribute value. -
+
+typedef struct mxml_attr_s mxml_attr_t; -
+ -Custom data destructor -
+
+typedef void (*mxml_custom_destroy_cb_t)(void *); -
+ -Custom data load callback function -
+
+typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); -
+ -Custom data save callback function -
-typedef char * (*mxml_custom_save_cb_t)(mxml_node_t *); -
+ ++typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *); +
-An XML custom value. -
+
+typedef struct mxml_custom_s mxml_custom_t; -
+ -An XML element value. -
+
+typedef struct mxml_element_s mxml_element_t; -
+ -Error callback function -
+
+typedef void (*mxml_error_cb_t)(const char *); -
+ -An XML node index. -
+
+typedef struct mxml_index_s mxml_index_t; -
+ -Load callback function -
+
+typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *); -
+ -An XML node. -
+
+typedef struct mxml_node_s mxml_node_t; -
+ -Save callback function -
-typedef const char * (*mxml_save_cb_t)(mxml_node_t *, int); -
+ ++typedef const char *(*mxml_save_cb_t)(mxml_node_t *, int); +
-SAX callback function -
+
+typedef void (*mxml_sax_cb_t)(mxml_node_t *, mxml_sax_event_t, void *); -
+ -SAX event type. -
+
+typedef enum mxml_sax_event_e mxml_sax_event_t; -
+ -An XML text value. -
+
+typedef struct mxml_text_s mxml_text_t; -
+ -An XML node value. -
+
+typedef union mxml_value_u mxml_value_t; -
+ + +An XML element attribute value. +
+struct mxml_attr_s {
+ char *name;
+ char *value;
+};
An XML custom value. +
+struct mxml_custom_s {
+ void *data;
+ mxml_custom_destroy_cb_t destroy;
+};
An XML element value. +
+struct mxml_element_s {
+ mxml_attr_t *attrs;
+ char *name;
+ int num_attrs;
+};
An XML node index. +
+struct mxml_index_s {
+ int alloc_nodes;
+ char *attr;
+ int cur_node;
+ mxml_node_t **nodes;
+ int num_nodes;
+};
An XML node. +
+struct mxml_node_s {
+ struct mxml_node_s *child;
+ struct mxml_node_s *last_child;
+ struct mxml_node_s *next;
+ struct mxml_node_s *parent;
+ struct mxml_node_s *prev;
+ int ref_count;
+ mxml_type_t type;
+ void *user_data;
+ mxml_value_t value;
+};
An XML text value. +
+struct mxml_text_s {
+ char *string;
+ int whitespace;
+};
An XML node value. -
-union mxml_value_u
-{
- mxml_custom_t custom;
- mxml_element_t element;
- int integer;
- char * opaque;
- double real;
- mxml_text_t text;
-};
union mxml_value_u {
+ mxml_custom_t custom;
+ mxml_element_t element;
+ int integer;
+ char *opaque;
+ double real;
+ mxml_text_t text;
+};
Name | Description |
---|---|
custom Mini-XML 2.1 | Custom data - |
element | Element - |
integer | Integer number - |
opaque | Opaque string - |
real | Real number - |
text | Text fragment - |
SAX event type. +
+The XML node type. +
+