中文文档地址http://blog.csdn.net/bluesonic/article/details/3887143#comments
Library Reference
Contents
- Functions
- mxmlAdd
- mxmlDelete
- mxmlElementDeleteAttr
- mxmlElementGetAttr
- mxmlElementSetAttr
- mxmlElementSetAttrf
- mxmlEntityAddCallback
- mxmlEntityGetName
- mxmlEntityGetValue
- mxmlEntityRemoveCallback
- mxmlFindElement
- mxmlFindPath
- mxmlGetCDATA
- mxmlGetCustom
- mxmlGetElement
- mxmlGetFirstChild
- mxmlGetInteger
- mxmlGetLastChild
- mxmlGetNextSibling
- @L_301_23@
- mxmlGetParent
- mxmlGetPrevSibling
- mxmlGetReal
- mxmlGetRefCount
- mxmlGetText
- mxmlGetType
- mxmlGetUserData
- mxmlIndexDelete
- mxmlIndexEnum
- mxmlIndexFind
- mxmlIndexGetCount
- mxmlIndexNew
- mxmlIndexReset
- mxmlLoadFd
- mxmlLoadFile
- mxmlLoadString
- mxmlNewCDATA
- mxmlNewCustom
- mxmlNewElement
- mxmlNewInteger
- mxmlNewOpaque
- mxmlNewReal
- mxmlNewText
- mxmlNewTextf
- mxmlNewXML
- mxmlRelease
- mxmlRemove
- mxmlRetain
- mxmlSAXLoadFd
- mxmlSAXLoadFile
- mxmlSAXLoadString
- mxmlSaveAllocString
- mxmlSaveFd
- mxmlSaveFile
- mxmlSaveString
- mxmlSetCDATA
- mxmlSetCustom
- mxmlSetCustomHandlers
- mxmlSetElement
- mxmlSetErrorCallback
- mxmlSetInteger
- mxmlSetOpaque
- mxmlSetReal
- mxmlSetText
- mxmlSetTextf
- @L_502_69@
- mxmlSetWrapMargin
- mxmlWalkNext
- mxmlWalkPrev
- Data Types
- Constants
Functions
mxmlAdd
Add a node to a tree.
void mxmlAdd (
mxml_node_t*parent,
int where,
mxml_node_t*child,
mxml_node_t*node
);
Parameters
- 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
Discussion
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 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.
mxmlDelete
Delete a node and all of its children.
void mxmlDelete (
mxml_node_t*node
);
node
Node to delete
If the specified node has a parent,this function first removes the node from its parent using the mxmlRemove() function.
Mini-XML 2.4mxmlElementDeleteAttr
Mini-XML 2.4mxmlElementDeleteAttr
Delete an attribute.
void mxmlElementDeleteAttr (
mxml_node_t*node,
const char *name
);
node
Element
name
Attribute name
mxmlElementGetAttr
Get an attribute.
const char *mxmlElementGetAttr (
mxml_node_t*node,sans-serif; font-size:14px">
Return Value
Attribute value or NULL
This function returns NULL if the node is not an element or the named attribute does not exist.
mxmlElementSetAttr
Set an attribute.
void mxmlElementSetAttr (
mxml_node_t*node,
const char *name,
const char *value
);
node
Element node
name
Name of attribute
value
Attribute value
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.
Mini-XML 2.3mxmlElementSetAttrf
Mini-XML 2.3mxmlElementSetAttrf
Set an attribute with a formatted value.
void mxmlElementSetAttrf (
mxml_node_t*node,
const char *format,
...
);
node
Element node
name
Name of attribute
format
Printf-style attribute value
...
Additional arguments as needed
mxmlEntityAddCallback
Add a callback to convert entities to Unicode.
int mxmlEntityAddCallback (
mxml_entity_cb_tcb
);
cb
Callback function to add
0 on success,-1 on failure
mxmlEntityGetName
mxmlEntityGetName
Get the name that corresponds to the character value.
const char *mxmlEntityGetName (
int val
);
val
Character value
Entity name or NULL
If val does not need to be represented by a named entity,NULL is returned.
mxmlEntityGetValue
If val does not need to be represented by a named entity,NULL is returned.
mxmlEntityGetValue
Get the character corresponding to a named entity.
int mxmlEntityGetValue (
const char *name
);
name
Entity name
Character value or -1 on error
The entity name can also be a numeric constant. -1 is returned if the name is not known.
mxmlEntityRemoveCallback
The entity name can also be a numeric constant. -1 is returned if the name is not known.
mxmlEntityRemoveCallback
Remove a callback.
void mxmlEntityRemoveCallback (
mxml_entity_cb_tcb
);
cb
Callback function to remove
mxmlFindElement
Find the named element.
mxml_node_t*mxmlFindElement (
mxml_node_t*node,
mxml_node_t*top,
const char *attr,
const char *value,
int descend
);
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
Element node or NULL
The search is constrained by the name,attribute name,and value; any NULL names or values are treated as wildcards,so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines 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.
Mini-XML 2.7mxmlFindPath
The search is constrained by the name,attribute name,and value; any NULL names or values are treated as wildcards,so different kinds of searches can be implemented by looking for all elements of a given name or all elements with a specific attribute. The descend argument determines 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.
Mini-XML 2.7mxmlFindPath
Find a node with the given path.
mxml_node_t*mxmlFindPath (
mxml_node_t*top,
const char *path
);
top
Top node
path
Path to element
Found node or NULL
The "path" is a slash-separated list of element names. The name "*" is considered a wildcard for one or more levels of elements. For example,"foo/one/two","bar/two/one","*/one",and so forth.
The first child node of the found node is returned if the given node has children and the first child is a value node.
Mini-XML 2.7mxmlGetCDATA
The "path" is a slash-separated list of element names. The name "*" is considered a wildcard for one or more levels of elements. For example,"foo/one/two","bar/two/one","*/one",and so forth.
The first child node of the found node is returned if the given node has children and the first child is a value node.
Mini-XML 2.7mxmlGetCDATA
Get the value for a CDATA node.
const char *mxmlGetCDATA (
mxml_node_t*node
);
node
Node to get
CDATA value or NULL
@H_34_502@NULLis returned if the node is not a CDATA element.
Mini-XML 2.7mxmlGetCustom
@H_34_502@NULLis returned if the node is not a CDATA element.
Mini-XML 2.7mxmlGetCustom
Get the value for a custom node.
const void *mxmlGetCustom (
mxml_node_t*node
);
Custom value or NULL
NULLis returned if the node (or its first child) is not a custom value node.
Mini-XML 2.7mxmlGetElement
Mini-XML 2.7mxmlGetElement
Get the name for an element node.
const char *mxmlGetElement (
mxml_node_t*node
);
Element name or NULL
NULLis returned if the node is not an element node.
Mini-XML 2.7mxmlGetFirstChild
Mini-XML 2.7mxmlGetFirstChild
Get the first child of an element node.
mxml_node_t*mxmlGetFirstChild (
mxml_node_t*node
);
First child or NULL
NULLis returned if the node is not an element node or if the node has no children.
Mini-XML 2.7mxmlGetInteger
Mini-XML 2.7mxmlGetInteger
Get the integer value from the specified node or its first child.
int mxmlGetInteger (
mxml_node_t*node
);
Integer value or 0
0 is returned if the node (or its first child) is not an integer value node.
Mini-XML 2.7mxmlGetLastChild
Mini-XML 2.7mxmlGetLastChild
Get the last child of an element node.
mxml_node_t*mxmlGetLastChild (
mxml_node_t*node
);
Last child or NULL
mxmlGetNextSibling
Return the node type...
mxml_node_t*mxmlGetNextSibling (
mxml_node_t*node
);
Get the next node for the current parent.
NULLis returned if this is the last child for the current parent.
Mini-XML 2.7mxmlGetOpaque
Get an opaque string value for a node or its first child.
const char *mxmlGetOpaque (
mxml_node_t*node
);
Opaque string or NULL
NULLis returned if the node (or its first child) is not an opaque value node.
Mini-XML 2.7mxmlGetParent
Mini-XML 2.7mxmlGetParent
Get the parent node.
mxml_node_t*mxmlGetParent (
mxml_node_t*node
);
Parent node or NULL
NULLis returned for a root node.
Mini-XML 2.7mxmlGetPrevSibling
Mini-XML 2.7mxmlGetPrevSibling
Get the prevIoUs node for the current parent.
mxml_node_t*mxmlGetPrevSibling (
mxml_node_t*node
);
PrevIoUs node or NULL
NULLis returned if this is the first child for the current parent.
Mini-XML 2.7mxmlGetReal
Mini-XML 2.7mxmlGetReal
Get the real value for a node or its first child.
double mxmlGetReal (
mxml_node_t*node
);
Real value or 0.0
0.0 is returned if the node (or its first child) is not a real value node.
Mini-XML 2.7mxmlGetRefCount
Mini-XML 2.7mxmlGetRefCount
Get the current reference (use) count for a node.
int mxmlGetRefCount (
mxml_node_t*node
);
node
Node
Reference count
The initial reference count of new nodes is 1. Use themxmlRetain
andmxmlRelease
functions to increment and decrement a node's reference count. .
Mini-XML 2.7mxmlGetText
The initial reference count of new nodes is 1. Use themxmlRetain
andmxmlRelease
functions to increment and decrement a node's reference count. .
Mini-XML 2.7mxmlGetText
Get the text value for a node or its first child.
const char *mxmlGetText (
mxml_node_t*node,
int *whitespace
);
node
Node to get
whitespace
1 if string is preceded by whitespace,0 otherwise
Text string or NULL
NULLis returned if the node (or its first child) is not a text node. The "whitespace" argument can be NULL.
Mini-XML 2.7mxmlGetType
NULLis returned if the node (or its first child) is not a text node. The "whitespace" argument can be NULL.
Mini-XML 2.7mxmlGetType
Get the node type.
mxml_type_tmxmlGetType (
mxml_node_t*node
);
Type of node
MXML_IGNOREis returned if "node" is@H_34_502@NULL.
Mini-XML 2.7mxmlGetUserData
Mini-XML 2.7mxmlGetUserData
Get the user data pointer for a node.
void *mxmlGetUserData (
mxml_node_t*node
);
User data pointer
mxmlIndexDelete
Delete an index.
void mxmlIndexDelete (
mxml_index_t*ind
);
ind
Index to delete
mxmlIndexEnum
Return the next node in the index.
mxml_node_t*mxmlIndexEnum (
mxml_index_t*ind
);
ind
Index to enumerate
Next node or NULL if there is none
Nodes are returned in the sorted order of the index.
mxmlIndexFind
Nodes are returned in the sorted order of the index.
mxmlIndexFind
Find the next matching node.
mxml_node_t*mxmlIndexFind (
mxml_index_t*ind,
const char *element,sans-serif; font-size:14px">
Node or NULL if none found
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().
Mini-XML 2.7mxmlIndexGetCount
Mini-XML 2.7mxmlIndexGetCount
Get the number of nodes in an index.
int mxmlIndexGetCount (
mxml_index_t*ind
);
ind
Index of nodes
Number of nodes in index
mxmlIndexNew
mxmlIndexNew
Create a new index.
mxml_index_t*mxmlIndexNew (
mxml_node_t*node,
const char *attr
);
node
XML node tree
element
Element to index or NULL for all
attr
Attribute to index or NULL for none
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.
mxmlIndexReset
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.
mxmlIndexReset
Reset the enumeration/find pointer in the index and return the first node in the index.
mxml_node_t*mxmlIndexReset (
mxml_index_t*ind
);
ind
Index to reset
First node or NULL if there is none
This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time.
mxmlLoadFd
This function should be called prior to using mxmlIndexEnum() or mxmlIndexFind() for the first time.
mxmlLoadFd
Load a file descriptor into an XML node tree.
mxml_node_t*mxmlLoadFd (
mxml_node_t*top,
int fd,
mxml_load_cb_tcb
);
top
Top node
fd
File descriptor to read from
cb
Callback function or MXML_NO_CALLBACK
First node or NULL if the file could not be read.
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 single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either 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.
mxmlLoadFile
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 single parent node like <?xml> for the entire file. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either 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.
mxmlLoadFile
Load a file into an XML node tree.
mxml_node_t*mxmlLoadFile (
mxml_node_t*top,
FILE *fp,sans-serif; font-size:14px">
mxmlLoadString
Load a string into an XML node tree.
mxml_node_t*mxmlLoadString (
mxml_node_t*top,
const char *s,sans-serif; font-size:14px">
First node or NULL if the string has errors.
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 single parent node like <?xml> for the entire string. The callback function returns the value type that should be used for child nodes. If MXML_NO_CALLBACK is specified then all child nodes will be either MXML_ELEMENT or MXML_TEXT nodes.
The constants MXML_INTEGER_CALLBACK,sans-serif; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:gray; margin-bottom:0.5em; font-size:24px; margin-top:1.5em"> Mini-XML 2.3mxmlNewCDATA
The constants MXML_INTEGER_CALLBACK,sans-serif; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:gray; margin-bottom:0.5em; font-size:24px; margin-top:1.5em"> Mini-XML 2.3mxmlNewCDATA
Create a new CDATA node.
mxml_node_t*mxmlNewCDATA (
mxml_node_t*parent,
const char *data
);
parent
Parent node or MXML_NO_PARENT
data
Data string
New 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 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.
Mini-XML 2.1mxmlNewCustom
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 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.
Mini-XML 2.1mxmlNewCustom
Create a new custom data node.
mxml_node_t*mxmlNewCustom (
mxml_node_t*parent,
void *data,
mxml_custom_destroy_cb_tdestroy
);
parent
Parent node or MXML_NO_PARENT
data
Pointer to data
destroy
Function to destroy data
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 element node has no parent. NULL can be passed when the data in the node is not dynamically allocated or is separately managed.
mxmlNewElement
mxmlNewElement
Create a new element node.
mxml_node_t*mxmlNewElement (
mxml_node_t*parent,sans-serif; font-size:14px">
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.
mxmlNewInteger
Create a new integer node.
mxml_node_t*mxmlNewInteger (
mxml_node_t*parent,
int integer
);
parent
Parent node or MXML_NO_PARENT
integer
Integer value
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.
mxmlNewOpaque
mxmlNewOpaque
Create a new opaque string.
mxml_node_t*mxmlNewOpaque (
mxml_node_t*parent,
const char *opaque
);
parent
Parent node or MXML_NO_PARENT
opaque
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.
mxmlNewReal
mxmlNewReal
Create a new real number node.
mxml_node_t*mxmlNewReal (
mxml_node_t*parent,
double real
);
parent
Parent node or MXML_NO_PARENT
real
Real number value
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.
mxmlNewText
mxmlNewText
Create a new text fragment node.
mxml_node_t*mxmlNewText (
mxml_node_t*parent,
int whitespace,
const char *string
);
parent
Parent node or MXML_NO_PARENT
whitespace
1 = leading whitespace,0 = no whitespace
string
String
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.
mxmlNewTextf
mxmlNewTextf
Create a new formatted text fragment node.
mxml_node_t*mxmlNewTextf (
mxml_node_t*parent,0 = no whitespace
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.
Mini-XML 2.3mxmlNewXML
Create a new XML document tree.
mxml_node_t*mxmlNewXML (
const char *version
);
version
Version number to use
New ?xml node
The "version" argument specifies the version number to put in the ?xml element node. If NULL,version 1.0 is assumed.
Mini-XML 2.3mxmlRelease
The "version" argument specifies the version number to put in the ?xml element node. If NULL,version 1.0 is assumed.
Mini-XML 2.3mxmlRelease
Release a node.
int mxmlRelease (
mxml_node_t*node
);
New reference count
When the reference count reaches zero,the node (and any children) is deleted via mxmlDelete().
mxmlRemove
mxmlRemove
Remove a node from its parent.
void mxmlRemove (
mxml_node_t*node
);
node
Node to remove
Does not free memory used by the node - use mxmlDelete() for that. This function does nothing if the node has no parent.
Mini-XML 2.3mxmlRetain
Mini-XML 2.3mxmlRetain
Retain a node.
int mxmlRetain (
mxml_node_t*node
);
New reference count
Mini-XML 2.3mxmlSAXLoadFd
Load a file descriptor into an XML node tree using a SAX callback.
mxml_node_t*mxmlSAXLoadFd (
mxml_node_t*top,
mxml_load_cb_tcb,
mxml_sax_cb_tsax_cb,
void *sax_data
);
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
Mini-XML 2.3mxmlSAXLoadFile
Load a file into an XML node tree using a SAX callback.
mxml_node_t*mxmlSAXLoadFile (
mxml_node_t*top,sans-serif; font-size:14px">
Mini-XML 2.3mxmlSAXLoadString
Load a string into an XML node tree using a SAX callback.
mxml_node_t*mxmlSAXLoadString (
mxml_node_t*top,sans-serif; font-size:14px">
mxmlSaveAllocString
Save an XML tree to an allocated string.
char *mxmlSaveAllocString (
mxml_node_t*node,
mxml_save_cb_tcb
);
node
Node to write
cb
Whitespace callback or MXML_NO_CALLBACK
Allocated string or NULL
This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated.
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.
mxmlSaveFd
This function returns a pointer to a string containing the textual representation of the XML node tree. The string should be freed using the free() function when you are done with it. NULL is returned if the node would produce an empty string or if the string cannot be allocated.
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.
mxmlSaveFd
Save an XML tree to a file descriptor.
int mxmlSaveFd (
mxml_node_t*node,sans-serif; font-size:14px">
The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified,sans-serif; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:gray; margin-bottom:0.5em; font-size:24px; margin-top:1.5em"> mxmlSaveFile
Save an XML tree to a file.
int mxmlSaveFile (
mxml_node_t*node,sans-serif; font-size:14px">
mxmlSaveString
Save an XML node tree to a string.
int mxmlSaveString (
mxml_node_t*node,
char *buffer,
int bufsize,sans-serif; font-size:14px">
Size of string
This function returns the total number of bytes that would be required for the string but only copies (bufsize - 1) characters into the specified buffer.
The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified,sans-serif; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:gray; margin-bottom:0.5em; font-size:24px; margin-top:1.5em"> Mini-XML 2.3mxmlSetCDATA
The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified,sans-serif; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:gray; margin-bottom:0.5em; font-size:24px; margin-top:1.5em"> Mini-XML 2.3mxmlSetCDATA
Set the element name of a CDATA node.
int mxmlSetCDATA (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it (or its first child) is not a CDATA element node.
Mini-XML 2.1mxmlSetCustom
Set the data and destructor of a custom data node.
int mxmlSetCustom (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it (or its first child) is not a custom node.
mxmlSetCustomHandlers
Set the handling functions for custom data.
void mxmlSetCustomHandlers (
mxml_custom_load_cb_tload,
mxml_custom_save_cb_tsave
);
load
Load function
save
Save function
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.
mxmlSetElement
The save function accepts a node pointer and must return a malloc'd string on success and NULL on error.
mxmlSetElement
Set the name of an element node.
int mxmlSetElement (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it is not an element node.
mxmlSetErrorCallback
Set the error message callback.
void mxmlSetErrorCallback (
mxml_error_cb_tcb
);
cb
Error callback function
mxmlSetInteger
Set the value of an integer node.
int mxmlSetInteger (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it (or its first child) is not an integer node.
mxmlSetOpaque
Set the value of an opaque node.
int mxmlSetOpaque (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it (or its first child) is not an opaque node.
mxmlSetReal
Set the value of a real number node.
int mxmlSetReal (
mxml_node_t*node,sans-serif; font-size:14px">
The node is not changed if it (or its first child) is not a real number node.
mxmlSetText
Set the value of a text node.
int mxmlSetText (
mxml_node_t*node,sans-serif; font-size:14px">
mxmlSetTextf
Set the value of a text node to a formatted string.
int mxmlSetTextf (
mxml_node_t*node,0 = no whitespace
Mini-XML 2.7mxmlSetUserData
Set the user data pointer for a node.
int mxmlSetUserData (
mxml_node_t*node,
void *data
);
node
Node to set
data
User data pointer
Mini-XML 2.3mxmlSetWrapMargin
Set the wrap margin when saving XML data.
void mxmlSetWrapMargin (
int column
);
column
Column for wrapping,0 to disable wrapping
Wrapping is disabled when "column" is 0.
mxmlWalkNext
mxmlWalkNext
Walk to the next logical node in the tree.
mxml_node_t*mxmlWalkNext (
mxml_node_t*node,sans-serif; font-size:14px">
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.
mxmlWalkPrev
Walk to the prevIoUs logical node in the tree.
mxml_node_t*mxmlWalkPrev (
mxml_node_t*node,sans-serif; font-size:14px"> 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.
Data Types
mxml_custom_destroy_cb_t
Custom data destructor
typedef void (*mxml_custom_destroy_cb_t)(void *);
mxml_custom_load_cb_t
Custom data load callback function
typedef int (*mxml_custom_load_cb_t)(mxml_node_t*,const char *);
mxml_custom_save_cb_t
Custom data save callback function
typedef char *(*mxml_custom_save_cb_t)(mxml_node_t*);
mxml_entity_cb_t
Entity callback function
typedef int (*mxml_entity_cb_t)(const char *);
mxml_error_cb_t
Error callback function
typedef void (*mxml_error_cb_t)(const char *);
mxml_index_t
An XML node index.
typedef structmxml_index_smxml_index_t;
mxml_load_cb_t
Load callback function
typedefmxml_type_t(*mxml_load_cb_t)(mxml_node_t*);
mxml_node_t
An XML node.
typedef structmxml_node_smxml_node_t;
mxml_save_cb_t
Save callback function
typedef const char *(*mxml_save_cb_t)(mxml_node_t*,int);
mxml_sax_cb_t
SAX callback function
typedef void (*mxml_sax_cb_t)(mxml_node_t*,mxml_sax_event_t,void *);
mxml_sax_event_t
SAX event type.
typedef enummxml_sax_event_emxml_sax_event_t;
mxml_type_t
The XML node type.
typedef enummxml_type_emxml_type_t;
Constants
mxml_sax_event_e
SAX event type.
Constants
- 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
The XML node type.