diff --git a/doc/mxml.man b/doc/mxml.man index f04d49d..c4f6fba 100644 --- a/doc/mxml.man +++ b/doc/mxml.man @@ -1,4 +1,4 @@ -.TH mxml 3 "Mini-XML API" "06/07/17" "Mini-XML API" +.TH mxml 3 "Mini-XML API" "06/08/17" "Mini-XML API" .SH NAME mxml \- Mini-XML API .SH INCLUDE FILE @@ -244,7 +244,7 @@ void mxmlAdd ( ); .fi .SS mxmlDelete -Insert node after this child... + .PP .nf void mxmlDelete ( diff --git a/doc/reference.html b/doc/reference.html index 11766aa..4ff8ced 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -122,8 +122,10 @@ span.info { white-space: nowrap; } h3 span.info, h4 span.info { + border-top-left-radius: 10px; + border-top-right-radius: 10px; float: right; - font-size: 100%; + padding: 3px 6px; } ul.code, ul.contents, ul.subcontents { list-style-type: none; @@ -139,15 +141,24 @@ ul.contents > li { ul.contents li ul.code, ul.contents li ul.subcontents { padding-left: 2em; } -div.body dl { - margin-top: 0; +table.list { + border-collapse: collapse; + width: 100%; } -div.body dt { - font-style: italic; - margin-top: 0; +table.list tr:nth-child(even) { + background: rgba(127,127,127,0.1);]n} +table.list th { + border-right: 2px solid gray; + font-family: monospace; + padding: 5px 10px 5px 2px; + text-align: right; + vertical-align: top; } -div.body dd { - margin-bottom: 0.5em; +table.list td { + padding: 5px 2px 5px 10px; + text-align: left; + vertical-align: top; + width: 100%; } h1.title { } @@ -264,23 +275,18 @@ h3.title {
-void mxmlAdd (
- mxml_node_t *parent,
- int where,
- mxml_node_t *child,
- mxml_node_t *node
-);
MXML_ADD_BEFORE
or MXML_ADD_AFTER
MXML_ADD_TO_PARENT
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 |
Add a node to a tree.
Adds the specified node to the parent. If the child argument is not
@@ -290,16 +296,14 @@ puts the new node at the beginning of the child list (MXML_ADD_BEFOREMXML_ADD_AFTER
). The constant
MXML_ADD_TO_PARENT
can be used to specify a NULL
child pointer.
Insert node after this child...
+
-void mxmlDelete (
- mxml_node_t *node
-);
node | +Node to delete |
---|
Delete a node and all of its children.
If the specified node has a parent, this function first removes the
@@ -307,34 +311,28 @@ node from its parent using the mxmlRemove
-void mxmlElementDeleteAttr (
- mxml_node_t *node,
- const char *name
-);
node | +Element |
---|---|
name | +Attribute name |
Delete an attribute.
Get an attribute.
-const char *mxmlElementGetAttr (
- mxml_node_t *node,
- const char *name
-);
node | +Element node |
---|---|
name | +Name of attribute |
Attribute value or NULL
Get an element attribute by index.
-const char *mxmlElementGetAttrByIndex (
- mxml_node_t *node,
- int idx,
- const char **name
-);
node | +Node |
---|---|
idx | +Attribute index, starting at 0 |
name | +Attribute name |
Attribute value
Get the number of element attributes.
-int mxmlElementGetAttrCount (
- mxml_node_t *node
-);
node | +Node |
---|
Number of attributes
Node
-void mxmlElementSetAttr (
- mxml_node_t *node,
- const char *name,
- const char *value
-);
node | +Element node |
---|---|
name | +Name of attribute |
value | +Attribute value |
Set an attribute.
If the named attribute already exists, the value of the attribute @@ -403,23 +391,18 @@ not an element.
Range check input...
-void mxmlElementSetAttrf (
- mxml_node_t *node,
- const char *name,
- const char *format,
- ...
-);
node | +Element node |
---|---|
name | +Name of attribute |
format | +Printf-style attribute value |
... | +Additional arguments as needed |
Set an attribute with a formatted value.
If the named attribute already exists, the value of the attribute @@ -431,27 +414,23 @@ is not an element.
Add a callback to convert entities to Unicode.
-int mxmlEntityAddCallback (
- mxml_entity_cb_t cb
-);
cb | +Callback function to add |
---|
0 on success, -1 on failure
Get the name that corresponds to the character value.
-const char *mxmlEntityGetName (
- int val
-);
val | +Character value |
---|
Entity name or NULL
Get the character corresponding to a named entity.
-int mxmlEntityGetValue (
- const char *name
-);
name | +Entity name |
---|
Character value or -1 on error
Global data
-void mxmlEntityRemoveCallback (
- mxml_entity_cb_t cb
-);
cb | +Callback function to remove |
---|
Remove a callback.
Find the named element.
-mxml_node_t *mxmlFindElement (
- mxml_node_t *node,
- mxml_node_t *top,
- const char *element,
- const char *attr,
- const char *value,
- int descend
-);
NULL
for anyNULL
for noneNULL
for anyMXML_DESCEND
, MXML_NO_DESCEND
, or MXML_DESCEND_FIRST
node | +Current node |
---|---|
top | +Top node |
element | +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
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
Get the value for a CDATA node.
-const char *mxmlGetCDATA (
- mxml_node_t *node
-);
node | +Node to get |
---|
CDATA value or NULL
Get the value for a custom node.
-const void *mxmlGetCustom (
- mxml_node_t *node
-);
node | +Node to get |
---|
Custom value or NULL
Get the name for an element node.
-const char *mxmlGetElement (
- mxml_node_t *node
-);
node | +Node to get |
---|
Element name or NULL
Get the first child of an element node.
-mxml_node_t *mxmlGetFirstChild (
- mxml_node_t *node
-);
node | +Node to get |
---|
First child or NULL
Get the integer value from the specified node or its first child.
-int mxmlGetInteger (
- mxml_node_t *node
-);
node | +Node to get |
---|
Integer value or 0
Get the last child of an element node.
-mxml_node_t *mxmlGetLastChild (
- mxml_node_t *node
-);
node | +Node to get |
---|
Last child or NULL
Return the node type...
-mxml_node_t *mxmlGetNextSibling (
- mxml_node_t *node
-);
node | +Node to get |
---|
Get the next node for the current parent.
NULL
is returned if this is the last child for the current parent.
@@ -672,14 +623,12 @@ has no children.
Get an opaque string value for a node or its first child.
-const char *mxmlGetOpaque (
- mxml_node_t *node
-);
node | +Node to get |
---|
Opaque string or NULL
Get the parent node.
-mxml_node_t *mxmlGetParent (
- mxml_node_t *node
-);
node | +Node to get |
---|
Parent node or NULL
Get the previous node for the current parent.
-mxml_node_t *mxmlGetPrevSibling (
- mxml_node_t *node
-);
node | +Node to get |
---|
Previous node or NULL
Get the real value for a node or its first child.
-double mxmlGetReal (
- mxml_node_t *node
-);
node | +Node to get |
---|
Real value or 0.0
Get the current reference (use) count for a node.
-int mxmlGetRefCount (
- mxml_node_t *node
-);
node | +Node |
---|
Reference count
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
NULL
.
Get the node type.
-mxml_type_t mxmlGetType (
- mxml_node_t *node
-);
node | +Node to get |
---|
Type of node
NULL
.
Get the user data pointer for a node.
-void *mxmlGetUserData (
- mxml_node_t *node
-);
node | +Node to get |
---|
User data pointer
-void mxmlIndexDelete (
- mxml_index_t *ind
-);
ind | +Index to delete |
---|
Delete an index.
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
Find the next matching node.
-mxml_node_t *mxmlIndexFind (
- mxml_index_t *ind,
- const char *element,
- const char *value
-);
ind | +Index to search |
---|---|
element | +Element name to find, if any |
value | +Attribute value, if any |
Node or NULL
if none found
mxmlIndexEnum
.
Get the number of nodes in an index.
-int mxmlIndexGetCount (
- mxml_index_t *ind
-);
ind | +Index of nodes |
---|
Number of nodes in index
Create a new index.
-mxml_index_t *mxmlIndexNew (
- mxml_node_t *node,
- const char *element,
- const char *attr
-);
NULL
for allNULL
for nonenode | +XML node tree |
---|---|
element | +Element to index or NULL for all |
attr | +Attribute to index or NULL for none |
New index
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
Load a file descriptor into an XML node tree.
-mxml_node_t *mxmlLoadFd (
- mxml_node_t *top,
- int fd,
- mxml_load_cb_t cb
-);
top | +Top node |
---|---|
fd | +File descriptor to read from |
cb | +Callback function or constant |
First node or NULL
if the file could not be read.
Load a file into an XML node tree.
-mxml_node_t *mxmlLoadFile (
- mxml_node_t *top,
- FILE *fp,
- mxml_load_cb_t cb
-);
top | +Top node |
---|---|
fp | +File to read from |
cb | +Callback function or constant |
First node or NULL
if the file could not be read.
Load a string into an XML node tree.
-mxml_node_t *mxmlLoadString (
- mxml_node_t *top,
- const char *s,
- mxml_load_cb_t cb
-);
top | +Top node |
---|---|
s | +String to load |
cb | +Callback function or constant |
First node or NULL
if the string has errors.
Create a new CDATA node.
-mxml_node_t *mxmlNewCDATA (
- mxml_node_t *parent,
- const char *data
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
data | +Data string |
New node
Create a new custom data node.
-mxml_node_t *mxmlNewCustom (
- mxml_node_t *parent,
- void *data,
- mxml_custom_destroy_cb_t destroy
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
data | +Pointer to data |
destroy | +Function to destroy data |
New node
Create a new element node.
-mxml_node_t *mxmlNewElement (
- mxml_node_t *parent,
- const char *name
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
name | +Name of element |
New node
Create a new integer node.
-mxml_node_t *mxmlNewInteger (
- mxml_node_t *parent,
- int integer
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
integer | +Integer value |
New node
Create a new opaque string.
-mxml_node_t *mxmlNewOpaque (
- mxml_node_t *parent,
- const char *opaque
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
opaque | +Opaque string |
New node
Create a new formatted opaque string node.
-mxml_node_t *mxmlNewOpaquef (
- mxml_node_t *parent,
- const char *format,
- ...
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
format | +Printf-style format string |
... | +Additional args as needed |
New node
Create a new real number node.
-mxml_node_t *mxmlNewReal (
- mxml_node_t *parent,
- double real
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
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
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
whitespace | +1 = leading whitespace, 0 = no whitespace |
string | +String |
New node
Create a new formatted text fragment node.
-mxml_node_t *mxmlNewTextf (
- mxml_node_t *parent,
- int whitespace,
- const char *format,
- ...
-);
MXML_NO_PARENT
parent | +Parent node or MXML_NO_PARENT |
---|---|
whitespace | +1 = leading whitespace, 0 = no whitespace |
format | +Printf-style format string |
... | +Additional args as needed |
New node
Create a new XML document tree.
-mxml_node_t *mxmlNewXML (
- const char *version
-);
version | +Version number to use |
---|
New ?xml node
Release a node.
-int mxmlRelease (
- mxml_node_t *node
-);
node | +Node |
---|
New reference count
mxmlDelete
.
Create the node and set the text value...
-void mxmlRemove (
- mxml_node_t *node
-);
node | +Node to remove |
---|
Remove a node from its parent.
This function does not free memory used by the node - use mxmlDelete
@@ -1260,40 +1128,32 @@ for that. This function does nothing if the node has no parent.
Retain a node.
-int mxmlRetain (
- mxml_node_t *node
-);
node | +Node |
---|
New reference count
Load a file descriptor into an XML node tree using a SAX callback.
-mxml_node_t *mxmlSAXLoadFd (
- mxml_node_t *top,
- int fd,
- mxml_load_cb_t cb,
- mxml_sax_cb_t sax_cb,
- void *sax_data
-);
MXML_NO_CALLBACK
top | +Top node |
---|---|
fd | +File descriptor to read from |
cb | +Callback function or constant |
sax_cb | +SAX callback or MXML_NO_CALLBACK |
sax_data | +SAX user data |
First node or NULL
if the file could not be read.
Load a file into an XML node tree using a SAX callback.
-mxml_node_t *mxmlSAXLoadFile (
- mxml_node_t *top,
- FILE *fp,
- mxml_load_cb_t cb,
- mxml_sax_cb_t sax_cb,
- void *sax_data
-);
MXML_NO_CALLBACK
top | +Top node |
---|---|
fp | +File to read from |
cb | +Callback function or constant |
sax_cb | +SAX callback or MXML_NO_CALLBACK |
sax_data | +SAX user data |
First node or NULL
if the file could not be read.
Load a string into an XML node tree using a SAX callback.
-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
-);
MXML_NO_CALLBACK
top | +Top node |
---|---|
s | +String to load |
cb | +Callback function or constant |
sax_cb | +SAX callback or MXML_NO_CALLBACK |
sax_data | +SAX user data |
First node or NULL
if the string has errors.
Save an XML tree to an allocated string.
-char *mxmlSaveAllocString (
- mxml_node_t *node,
- mxml_save_cb_t cb
-);
MXML_NO_CALLBACK
node | +Node to write |
---|---|
cb | +Whitespace callback or MXML_NO_CALLBACK |
Allocated string or NULL
Save an XML tree to a file descriptor.
-int mxmlSaveFd (
- mxml_node_t *node,
- int fd,
- mxml_save_cb_t cb
-);
MXML_NO_CALLBACK
node | +Node to write |
---|---|
fd | +File descriptor to write to |
cb | +Whitespace callback or MXML_NO_CALLBACK |
0 on success, -1 on error.
Save an XML tree to a file.
-int mxmlSaveFile (
- mxml_node_t *node,
- FILE *fp,
- mxml_save_cb_t cb
-);
MXML_NO_CALLBACK
node | +Node to write |
---|---|
fp | +File to write to |
cb | +Whitespace callback or MXML_NO_CALLBACK |
0 on success, -1 on error.
Save an XML node tree to a string.
-int mxmlSaveString (
- mxml_node_t *node,
- char *buffer,
- int bufsize,
- mxml_save_cb_t cb
-);
MXML_NO_CALLBACK
node | +Node to write |
---|---|
buffer | +String buffer |
bufsize | +Size of string buffer |
cb | +Whitespace callback or MXML_NO_CALLBACK |
Size of string
Set the element name of a CDATA node.
-int mxmlSetCDATA (
- mxml_node_t *node,
- const char *data
-);
node | +Node to set |
---|---|
data | +New data string |
0 on success, -1 on failure
Set the data and destructor of a custom data node.
-int mxmlSetCustom (
- mxml_node_t *node,
- void *data,
- mxml_custom_destroy_cb_t destroy
-);
node | +Node to set |
---|---|
data | +New data pointer |
destroy | +New destructor function |
0 on success, -1 on failure
Read the XML data...
-void mxmlSetCustomHandlers (
- mxml_custom_load_cb_t load,
- mxml_custom_save_cb_t save
-);
load | +Load function |
---|---|
save | +Save function |
Set the handling functions for custom data.
The load function accepts a node pointer and a data string and must
@@ -1567,17 +1389,14 @@ string on success and NULL
on error.
Set the name of an element node.
-int mxmlSetElement (
- mxml_node_t *node,
- const char *name
-);
node | +Node to set |
---|---|
name | +New name string |
0 on success, -1 on failure
Global data
-void mxmlSetErrorCallback (
- mxml_error_cb_t cb
-);
cb | +Error callback function |
---|
Set the error message callback.
Set the value of an integer node.
-int mxmlSetInteger (
- mxml_node_t *node,
- int integer
-);
node | +Node to set |
---|---|
integer | +Integer value |
0 on success, -1 on failure
Set the value of an opaque node.
-int mxmlSetOpaque (
- mxml_node_t *node,
- const char *opaque
-);
node | +Node to set |
---|---|
opaque | +Opaque string |
0 on success, -1 on failure
Set the value of an opaque string node to a formatted string.
-int mxmlSetOpaquef (
- mxml_node_t *node,
- const char *format,
- ...
-);
node | +Node to set |
---|---|
format | +Printf-style format string |
... | +Additional arguments as needed |
0 on success, -1 on failure
Set the value of a real number node.
-int mxmlSetReal (
- mxml_node_t *node,
- double real
-);
node | +Node to set |
---|---|
real | +Real number value |
0 on success, -1 on failure
Set the value of a text node.
-int mxmlSetText (
- mxml_node_t *node,
- int whitespace,
- const char *string
-);
node | +Node to set |
---|---|
whitespace | +1 = leading whitespace, 0 = no whitespace |
string | +String |
0 on success, -1 on failure
Set the value of a text node to a formatted string.
-int mxmlSetTextf (
- mxml_node_t *node,
- int whitespace,
- const char *format,
- ...
-);
node | +Node to set |
---|---|
whitespace | +1 = leading whitespace, 0 = no whitespace |
format | +Printf-style format string |
... | +Additional arguments as needed |
0 on success, -1 on failure
Set the user data pointer for a node.
-int mxmlSetUserData (
- mxml_node_t *node,
- void *data
-);
node | +Node to set |
---|---|
data | +User data pointer |
0 on success, -1 on failure
Global data
-void mxmlSetWrapMargin (
- int column
-);
column | +Column for wrapping, 0 to disable wrapping |
---|
Set the wrap margin when saving XML data.
Wrapping is disabled when "column" is 0.
@@ -1752,20 +1542,16 @@ void mxmlSetWrapMargin (
Walk to the next logical node in the tree.
-mxml_node_t *mxmlWalkNext (
- mxml_node_t *node,
- mxml_node_t *top,
- int descend
-);
MXML_DESCEND
, MXML_NO_DESCEND
, or MXML_DESCEND_FIRST
node | +Current node |
---|---|
top | +Top node |
descend | +Descend into tree - MXML_DESCEND , MXML_NO_DESCEND , or MXML_DESCEND_FIRST |
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
-);
MXML_DESCEND
, MXML_NO_DESCEND
, or MXML_DESCEND_FIRST
node | +Current node |
---|---|
top | +Top node |
descend | +Descend into tree - MXML_DESCEND , MXML_NO_DESCEND , or MXML_DESCEND_FIRST |
Previous node or NULL
SAX event type.
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 |
The XML node type.
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 |