From 61ba926ecc2cbdf3e8ae3ec3007037d5340e91d4 Mon Sep 17 00:00:00 2001
From: Michael R Sweet Version 2, June 1991
- Preamble The licenses for most software are designed to take away your freedom
diff --git a/www/docfiles/Abbreviations.html b/www/docfiles/Abbreviations.html
index a57dbb8..a4cd43e 100644
--- a/www/docfiles/Abbreviations.html
+++ b/www/docfiles/Abbreviations.html
@@ -1,7 +1,7 @@
Mini-XML supports custom data types via global load and save
+ callbacks. Only a single set of callbacks can be active at any time,
+ however your callbacks can store additional information in order to
+ support multiple custom data types as needed. The MXML_CUSTOM
+ node type identifies custom data nodes. The load callback receives a pointer to the current data node and a
+ string of opaque character data from the XML source with character
+ entities converted to the corresponding UTF-8 characters. For example,
+ if we wanted to support a custom date/time type whose value is encoded
+ as "yyyy-mm-ddThh:mm:ssZ" (ISO format), the load callback would look
+ like the following: The function itself can return 0 on success or -1 if it is unable to
+ decode the custom data or the data contains an error. Custom data nodes
+ contain a void pointer to the allocated custom data for the
+ node and a pointer to a destructor function which will free the custom
+ data when the node is deleted. The save callback receives the node pointer and returns an allocated
+ string containing the custom data value. The following save callback
+ could be used for our ISO date/time type: You register the callback functions using the
+mxmlSetCustomHandlers() function: The mxmlNewTextf()
and mxmlSetTextf()
functions create and change text nodes, respectively, using printf
diff --git a/www/docfiles/Functions.html b/www/docfiles/Functions.html
index 7d9304a..7be10a5 100644
--- a/www/docfiles/Functions.html
+++ b/www/docfiles/Functions.html
@@ -1,7 +1,7 @@
Mini-XML provides functions for managing indices of nodes. The
current implementation provides the same functionality as the
mxmlFindElement(). The advantage of using an index is that
diff --git a/www/docfiles/InstallingMiniXML.html b/www/docfiles/InstallingMiniXML.html
index 9ecdcfa..c40f0c6 100644
--- a/www/docfiles/InstallingMiniXML.html
+++ b/www/docfiles/InstallingMiniXML.html
@@ -1,7 +1,7 @@
This programmers manual describes Mini-XML version 2.0, a small XML
+ This programmers manual describes Mini-XML version 2.1, a small XML
parsing library that you can use to read and write XML and XML-like
data files in your application without requiring large non-standard
libraries. Mini-XML only requires an ANSI C compatible compiler (GCC
diff --git a/www/docfiles/LegalStuff.html b/www/docfiles/LegalStuff.html
index 6d9152d..a4275bf 100644
--- a/www/docfiles/LegalStuff.html
+++ b/www/docfiles/LegalStuff.html
@@ -1,7 +1,7 @@
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 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. First node or NULL if the file could not be read. 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 element node has no parent. NULL
+ can be passed when the data in the node is not dynamically allocated or
+ is separately managed. New node 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. 0 on success, -1 on error. Set the data and destructor of a custom data node. The node is not
+ changed if it is not a custom node. 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. Nothing. An XML custom value. Local functions... An XML custom value. File descriptor buffer (@private) File descriptor buffer (@private) This programmers manual describes Mini-XML version 2.0, a small XML
+ This programmers manual describes Mini-XML version 2.1, a small XML
parsing library that you can use to read and write XML and XML-like
data files in your application without requiring large non-standard
libraries. Mini-XML only requires an ANSI C compatible compiler (GCC
@@ -265,12 +286,12 @@ libxml2 library with something substantially smaller and
Mini-XML supports custom data types via global load and save
+ callbacks. Only a single set of callbacks can be active at any time,
+ however your callbacks can store additional information in order to
+ support multiple custom data types as needed. The MXML_CUSTOM
+ node type identifies custom data nodes. The load callback receives a pointer to the current data node and a
+ string of opaque character data from the XML source with character
+ entities converted to the corresponding UTF-8 characters. For example,
+ if we wanted to support a custom date/time type whose value is encoded
+ as "yyyy-mm-ddThh:mm:ssZ" (ISO format), the load callback would look
+ like the following: The function itself can return 0 on success or -1 if it is unable to
+ decode the custom data or the data contains an error. Custom data nodes
+ contain a void pointer to the allocated custom data for the
+ node and a pointer to a destructor function which will free the custom
+ data when the node is deleted. The save callback receives the node pointer and returns an allocated
+ string containing the custom data value. The following save callback
+ could be used for our ISO date/time type: You register the callback functions using the
+mxmlSetCustomHandlers() function: All of the examples so far have concentrated on creating and loading
new XML data nodes. Many applications, however, need to manipulate or
change the nodes during their operation, so Mini-XML provides functions
@@ -812,7 +965,7 @@ mxmlSetInteger(), mxmlSetOpaque()
mxmlSetText(node, 1, "new");
- The mxmlNewTextf() and
mxmlSetTextf() functions create and change text nodes,
respectively, using printf-style format strings and arguments.
@@ -823,7 +976,7 @@ mxmlSetInteger(), mxmlSetOpaque()
node = mxmlNewTextf(node, 1, "%s/%s",
path, filename);
- Mini-XML provides functions for managing indices of nodes. The
current implementation provides the same functionality as the
mxmlFindElement(). The advantage of using an index is that
@@ -1258,11 +1411,11 @@ mxmldoc to generate correct documentation for the code. Single line
Version 2, June 1991
- Preamble The licenses for most software are designed to take away your freedom
@@ -1632,7 +1785,18 @@ mxmldoc to generate correct documentation for the code. Single line
END OF TERMS AND CONDITIONS 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 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. First node or NULL if the file could not be read. First node or NULL if the string has errors. 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 element node has no parent. NULL
+ can be passed when the data in the node is not dynamically allocated or
+ is separately managed. New nodeA - GNU Library General Public
License
Copyright (C) 1991 Free Software Foundation, Inc.
-
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
Everyone is permitted to copy and distribute verbatim copies of
+
Copyright (C) 1991 Free Software Foundation, Inc.
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
-
[This is the first released version of the library GPL. It is
+
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Contents
diff --git a/www/docfiles/BReleaseNotes.html b/www/docfiles/BReleaseNotes.html
index 040d9a8..91cb27e 100644
--- a/www/docfiles/BReleaseNotes.html
+++ b/www/docfiles/BReleaseNotes.html
@@ -1,14 +1,14 @@
-
+Changes in Mini-XML 2.1
+
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/ChangingNodeValues.html b/www/docfiles/ChangingNodeValues.html
index d06a395..51bc0dd 100644
--- a/www/docfiles/ChangingNodeValues.html
+++ b/www/docfiles/ChangingNodeValues.html
@@ -1,13 +1,13 @@
-
+Custom Data Types
+
+ typedef struct
+ {
+ unsigned year, /* Year */
+ month, /* Month */
+ day, /* Day */
+ hour, /* Hour */
+ minute, /* Minute */
+ second; /* Second */
+ time_t unix; /* UNIX time value */
+ } iso_date_time_t;
+
+ int /* I - 0 on success, -1 on error */
+ load_custom(mxml_node_t *node, /* I - Node */
+ const char *data) /* I - Value */
+ {
+ iso_date_time_t *dt; /* Date/time value */
+ struct tm tmdata; /* UNIX time data */
+
+
+ /*
+ * Allocate data structure...
+ */
+
+ dt = calloc(1, sizeof(iso_date_time_t));
+
+ /*
+ * Try reading 6 unsigned integers from the data string...
+ */
+
+ if (sscanf(data, "%u-%u-%uT%u:%u:%uZ",
+ &(dt->year), &(dt->month), &(dt->day),
+ &(dt->hour), &(dt->minute), &(dt->second)) != 6)
+ {
+ /*
+ * Unable to read numbers, free the data structure and return an
+ * error...
+ */
+
+ free(dt);
+
+ return (-1);
+ }
+
+ /*
+ * Range check values...
+ */
+
+ if (dt->month <1 || dt->month > 12 ||
+ dt->day <1 || dt->day > 31 ||
+ dt->hour <0 || dt->hour > 23 ||
+ dt->minute <0 || dt->minute > 59 ||
+ dt->second <0 || dt->second > 59)
+ {
+ /*
+ * Date information is out of range...
+ */
+
+ free(dt);
+
+ return (-1);
+ }
+
+ /*
+ * Convert ISO time to UNIX time in seconds...
+ */
+
+ tmdata.tm_year = dt->year - 1900;
+ tmdata.tm_mon = dt->month - 1;
+ tmdata.tm_day = dt->day;
+ tmdata.tm_hour = dt->hour;
+ tmdata.tm_min = dt->minute;
+ tmdata.tm_sec = dt->second;
+
+ dt->unix = gmtime(&tmdata);
+
+ /*
+ * Assign custom node data and destroy function pointers...
+ */
+
+ node->value.custom.data = dt;
+ node->value.custom.destroy = free;
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+ }
+
+
+ char * /* I - Allocated string */
+ save_custom(mxml_node_t *node) /* I - Node */
+ {
+ char data[255]; /* Data string */
+ iso_date_time_t *dt; /* ISO date/time pointer */
+
+
+ dt = (iso_date_time_t *)node->custom.data;
+
+ snprintf(data, sizeof(data), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ dt->year, dt->month, dt->day, dt->hour,
+ dt->minute, dt->second);
+
+ return (strdup(data));
+ }
+
+
+ mxmlSetCustomHandlers(load_custom, save_custom);
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/Enumerations.html b/www/docfiles/Enumerations.html
index 3b7f77d..06603b2 100644
--- a/www/docfiles/Enumerations.html
+++ b/www/docfiles/Enumerations.html
@@ -1,7 +1,7 @@
-
-Formatted Text
+Formatted Text
-Indexing
+Indexing
Introduction
-Example Description lpstat
-
lpstat(1)
The names of commands;
+
lpstat(1)
The names of commands;
the first mention of a command or function in a chapter is followed by
a manual page section number. /var
-
/usr/share/cups/data/testprint.ps
+
/usr/share/cups/data/testprint.ps
File and directory names. Request ID is Printer-123
diff --git a/www/docfiles/OrganizationofThisDocument.html b/www/docfiles/OrganizationofThisDocument.html
index 71f0de9..c29d919 100644
--- a/www/docfiles/OrganizationofThisDocument.html
+++ b/www/docfiles/OrganizationofThisDocument.html
@@ -1,7 +1,7 @@
-
Contents
diff --git a/www/docfiles/SaveCallbacks.html b/www/docfiles/SaveCallbacks.html
index 8385627..3678a33 100644
--- a/www/docfiles/SaveCallbacks.html
+++ b/www/docfiles/SaveCallbacks.html
@@ -1,14 +1,14 @@
-
-Mini-XML Programmers Manual, Version 2.0
+
+Mini-XML Programmers Manual, Version 2.1
Michael Sweet
Copyright 2003-2004
Table of Contents
+mxmlLoadFd()
+
+Description
+Syntax
+
+mxml_node_t *
+mxmlLoadFd(
+ mxml_node_t * top,
+ int fd,
+ mxml_type_t (*cb)(mxml_node_t *node));
+
+Arguments
+
+
+
+
+
+
+Name Description
+top Top node
+fd File descriptor to read from
+(*cb)(mxml_node_t *node) Callback function or
+ MXML_NO_CALLBACK Returns
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlLoadFile.html b/www/docfiles/mxmlLoadFile.html
index 753a24d..8779f85 100644
--- a/www/docfiles/mxmlLoadFile.html
+++ b/www/docfiles/mxmlLoadFile.html
@@ -1,13 +1,13 @@
-
+mxmlNewCustom()
+
+Description
+Syntax
+
+mxml_node_t *
+mxmlNewCustom(
+ mxml_node_t * parent,
+ void * data,
+ void (*destroy)(void *));
+
+Arguments
+
+
+
+
+
+
+Name Description
+parent Parent node or MXML_NO_PARENT
+data Pointer to data
+(*destroy)(void *) Function to destroy data
+Returns
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlNewElement.html b/www/docfiles/mxmlNewElement.html
index 8bdd6a6..1aed180 100644
--- a/www/docfiles/mxmlNewElement.html
+++ b/www/docfiles/mxmlNewElement.html
@@ -1,13 +1,13 @@
-
+mxmlSaveFd()
+
+Description
+Syntax
+
+int
+mxmlSaveFd(
+ mxml_node_t * node,
+ int fd,
+ const char * (*cb)(mxml_node_t *node, int ws));
+
+Arguments
+
+
+
+
+
+
+Name Description
+node Node to write
+fd File descriptor to write to
+(*cb)(mxml_node_t *node, int ws) Whitespace
+ callback or MXML_NO_CALLBACK Returns
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlSaveFile.html b/www/docfiles/mxmlSaveFile.html
index 9b45378..94e1699 100644
--- a/www/docfiles/mxmlSaveFile.html
+++ b/www/docfiles/mxmlSaveFile.html
@@ -1,13 +1,13 @@
-
+mxmlSetCustom()
+
+Description
+Syntax
+
+int
+mxmlSetCustom(
+ mxml_node_t * node,
+ void * data,
+ void (*destroy)(void *));
+
+Arguments
+
+
+
+
+
+
+Name Description
+node Node to set
+data New data pointer
+(*destroy)(void *) New destructor function Returns
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlSetCustomHandlers.html b/www/docfiles/mxmlSetCustomHandlers.html
new file mode 100644
index 0000000..21885d8
--- /dev/null
+++ b/www/docfiles/mxmlSetCustomHandlers.html
@@ -0,0 +1,62 @@
+
+
+
+
+mxmlSetCustomHandlers()
+
+Description
+Syntax
+
+void
+mxmlSetCustomHandlers(
+ mxml_custom_load_cb_t load,
+ mxml_custom_save_cb_t save);
+
+Arguments
+
+
+
+
+
+
+Name Description
+load Load function
+save Save function Returns
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlSetElement.html b/www/docfiles/mxmlSetElement.html
index 96e69a9..b436f86 100644
--- a/www/docfiles/mxmlSetElement.html
+++ b/www/docfiles/mxmlSetElement.html
@@ -1,13 +1,13 @@
-
+mxml_custom_load_cb
+
+Definition
+
+static mxml_custom_load_cb_t mxml_custom_load_cb = NULL;
+
+
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlcustoms.html b/www/docfiles/mxmlcustoms.html
new file mode 100644
index 0000000..151c0d0
--- /dev/null
+++ b/www/docfiles/mxmlcustoms.html
@@ -0,0 +1,56 @@
+
+
+
+
+mxml_custom_s
+
+Description
+Definition
+
+struct mxml_custom_s
+{
+ void * data;
+};
+
+Members
+
+
+
+
+
+
+
+
+Name Description
+data Pointer to (allocated) custom data
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlcustomsavecb.html b/www/docfiles/mxmlcustomsavecb.html
new file mode 100644
index 0000000..9759205
--- /dev/null
+++ b/www/docfiles/mxmlcustomsavecb.html
@@ -0,0 +1,45 @@
+
+
+
+
+mxml_custom_save_cb
+
+Description
+Definition
+
+static mxml_custom_save_cb_t mxml_custom_save_cb = NULL;
+
+
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlcustomt.html b/www/docfiles/mxmlcustomt.html
new file mode 100644
index 0000000..0e7328d
--- /dev/null
+++ b/www/docfiles/mxmlcustomt.html
@@ -0,0 +1,45 @@
+
+
+
+
+mxml_custom_t
+
+Description
+Definition
+
+typedef struct mxml_custom_s mxml_custom_t;
+
+
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlelementt.html b/www/docfiles/mxmlelementt.html
index 0a3f291..988b034 100644
--- a/www/docfiles/mxmlelementt.html
+++ b/www/docfiles/mxmlelementt.html
@@ -1,14 +1,14 @@
-
+mxml_fdbuf_s
+
+Description
+Definition
+
+struct mxml_fdbuf_s
+{
+ end buffer[8192];
+ unsigned char * current;
+ int fd;
+};
+
+Members
+
+
+
+
+
+
+
+
+Name Description
+buffer[8192] Character buffer
+current Current position in buffer
+fd File descriptor
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlfdbuft.html b/www/docfiles/mxmlfdbuft.html
new file mode 100644
index 0000000..132c70b
--- /dev/null
+++ b/www/docfiles/mxmlfdbuft.html
@@ -0,0 +1,45 @@
+
+
+
+
+mxml_fdbuf_t
+
+Description
+Definition
+
+typedef struct mxml_fdbuf_s mxml_fdbuf_t;
+
+
+
+
+Contents
+Previous
+Next
+
+
diff --git a/www/docfiles/mxmlindexs.html b/www/docfiles/mxmlindexs.html
index f298505..fe7f5bc 100644
--- a/www/docfiles/mxmlindexs.html
+++ b/www/docfiles/mxmlindexs.html
@@ -1,13 +1,13 @@
-
-Mini-XML Programmers Manual, Version 2.0
+
+Mini-XML Programmers Manual, Version 2.1
Michael Sweet
Copyright 2003-2004
4 - Using the mxmldoc Utility
A - GNU Library General Public License
+
B - Release Notes
-
C - Library Reference
-
Introduction
-Example Description lpstat
-
lpstat(1)
The names of commands;
+
lpstat(1)
The names of commands;
the first mention of a command or function in a chapter is followed by
a manual page section number. /var
-
/usr/share/cups/data/testprint.ps
+
/usr/share/cups/data/testprint.ps
File and directory names. Request ID is Printer-123
@@ -292,22 +313,22 @@ File and directory names.
Other References
@@ -316,11 +337,11 @@ File and directory names.
1 - Building, Installing, and
@@ -795,7 +816,139 @@ MXML_WS_BEFORE_CLOSE, or MXML_WS_AFTER_CLOSE. The callback
mxmlSaveFile(tree, fp, whitespace_cb);
fclose(fp);
-
Changing Node Values
+Custom Data Types
+
+ typedef struct
+ {
+ unsigned year, /* Year */
+ month, /* Month */
+ day, /* Day */
+ hour, /* Hour */
+ minute, /* Minute */
+ second; /* Second */
+ time_t unix; /* UNIX time value */
+ } iso_date_time_t;
+
+ int /* I - 0 on success, -1 on error */
+ load_custom(mxml_node_t *node, /* I - Node */
+ const char *data) /* I - Value */
+ {
+ iso_date_time_t *dt; /* Date/time value */
+ struct tm tmdata; /* UNIX time data */
+
+
+ /*
+ * Allocate data structure...
+ */
+
+ dt = calloc(1, sizeof(iso_date_time_t));
+
+ /*
+ * Try reading 6 unsigned integers from the data string...
+ */
+
+ if (sscanf(data, "%u-%u-%uT%u:%u:%uZ",
+ &(dt->year), &(dt->month), &(dt->day),
+ &(dt->hour), &(dt->minute), &(dt->second)) != 6)
+ {
+ /*
+ * Unable to read numbers, free the data structure and return an
+ * error...
+ */
+
+ free(dt);
+
+ return (-1);
+ }
+
+ /*
+ * Range check values...
+ */
+
+ if (dt->month <1 || dt->month > 12 ||
+ dt->day <1 || dt->day > 31 ||
+ dt->hour <0 || dt->hour > 23 ||
+ dt->minute <0 || dt->minute > 59 ||
+ dt->second <0 || dt->second > 59)
+ {
+ /*
+ * Date information is out of range...
+ */
+
+ free(dt);
+
+ return (-1);
+ }
+
+ /*
+ * Convert ISO time to UNIX time in seconds...
+ */
+
+ tmdata.tm_year = dt->year - 1900;
+ tmdata.tm_mon = dt->month - 1;
+ tmdata.tm_day = dt->day;
+ tmdata.tm_hour = dt->hour;
+ tmdata.tm_min = dt->minute;
+ tmdata.tm_sec = dt->second;
+
+ dt->unix = gmtime(&tmdata);
+
+ /*
+ * Assign custom node data and destroy function pointers...
+ */
+
+ node->value.custom.data = dt;
+ node->value.custom.destroy = free;
+
+ /*
+ * Return with no errors...
+ */
+
+ return (0);
+ }
+
+
+ char * /* I - Allocated string */
+ save_custom(mxml_node_t *node) /* I - Node */
+ {
+ char data[255]; /* Data string */
+ iso_date_time_t *dt; /* ISO date/time pointer */
+
+
+ dt = (iso_date_time_t *)node->custom.data;
+
+ snprintf(data, sizeof(data), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ dt->year, dt->month, dt->day, dt->hour,
+ dt->minute, dt->second);
+
+ return (strdup(data));
+ }
+
+
+ mxmlSetCustomHandlers(load_custom, save_custom);
+
+Changing Node Values
Formatted Text
+Formatted Text
Indexing
+Indexing
A - GNU Library General Public
License
Copyright (C) 1991 Free Software Foundation, Inc.
-
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
Everyone is permitted to copy and distribute verbatim copies of
+
Copyright (C) 1991 Free Software Foundation, Inc.
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
Everyone is permitted to copy and distribute verbatim copies of
this license document, but changing it is not allowed.
-
[This is the first released version of the library GPL. It is
+
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
B - Release Notes
-Changes in Mini-XML 2.0
+Changes in Mini-XML 2.1
+
+
+Changes in Mini-XML 2.0
Changes in Mini-XML 1.3
+Changes in Mini-XML 1.3
-Changes in Mini-XML 1.2
+Changes in Mini-XML 1.2
-Changes in Mini-XML 1.1.2
+Changes in Mini-XML 1.1.2
-Changes in Mini-XML 1.1.1
+Changes in Mini-XML 1.1.1
-Changes in Mini-XML 1.1
+Changes in Mini-XML 1.1
-Changes in Mini-XML 1.0
+Changes in Mini-XML 1.0
-Changes in Mini-XML 0.93
+Changes in Mini-XML 0.93
-Changes in Mini-XML 0.92
+Changes in Mini-XML 0.92
-Changes in Mini-XML 0.91
+Changes in Mini-XML 0.91
-Changes in Mini-XML 0.9
+Changes in Mini-XML 0.9
@@ -1797,6 +1961,7 @@ mxmldoc to generate correct documentation for the code. Single line
+Name Description MXML_CUSTOM Custom data MXML_ELEMENT XML element with attributes MXML_INTEGER Integer value
@@ -1823,8 +1988,10 @@ mxmldoc to generate correct documentation for the code. Single line
MXML_OPAQUE Opaque string Returns
mxmlLoadFd()
+
+Description
+Syntax
+
+mxml_node_t *
+mxmlLoadFd(
+ mxml_node_t * top,
+ int fd,
+ mxml_type_t (*cb)(mxml_node_t *node));
+
+Arguments
+
+
+
+
+
+
+Name Description
+top Top node
+fd File descriptor to read from
+(*cb)(mxml_node_t *node) Callback function or
+ MXML_NO_CALLBACK Returns
+mxmlLoadFile()
@@ -2292,6 +2498,37 @@ mxmlLoadString(
Returns
mxmlNewCustom()
+
+Description
+Syntax
+
+mxml_node_t *
+mxmlNewCustom(
+ mxml_node_t * parent,
+ void * data,
+ void (*destroy)(void *));
+
+Arguments
+
+
+
+
+
+
+Name Description
+parent Parent node or MXML_NO_PARENT
+data Pointer to data
+(*destroy)(void *) Function to destroy data
+Returns
+mxmlNewElement()
@@ -2496,7 +2733,11 @@ mxmlRemove(
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.
char * @@ -2517,14 +2758,45 @@ mxmlSaveAllocString(Returns
Allocated string or NULL
+ +mxmlSaveFd()
+
+Description
+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.
+Syntax
++int +mxmlSaveFd( + mxml_node_t * node, + int fd, + const char * (*cb)(mxml_node_t *node, int ws)); ++Arguments
+ +
Name | Description |
---|---|
node | Node to write |
fd | File descriptor to write to |
(*cb)(mxml_node_t *node, int ws) | Whitespace + callback or MXML_NO_CALLBACK |
0 on success, -1 on error.
+Save an XML tree to a file. The callback argument specifies a - function that returns a whitespace character or nul (0) 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 + 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.
@@ -2554,7 +2826,11 @@ mxmlSaveFile(Description
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 into the specified buffer.
+ (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, + whitespace will only be added before MXML_TEXT nodes with leading + whitespace and before attribute names inside opening element tags.Syntax
int @@ -2579,6 +2855,60 @@ mxmlSaveString(Returns
Size of string
+ +mxmlSetCustom()
+
+Description
+Set the data and destructor of a custom data node. The node is not + changed if it is not a custom node.
+Syntax
++int +mxmlSetCustom( + mxml_node_t * node, + void * data, + void (*destroy)(void *)); ++Arguments
+ +
Name | Description |
---|---|
node | Node to set |
data | New data pointer |
(*destroy)(void *) | New destructor function |
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.
+An XML custom value.
++struct mxml_custom_s +{ + void * data; +}; ++
Name | Description |
---|---|
data | Pointer to (allocated) custom data |
File descriptor buffer (@private)
++struct mxml_fdbuf_s +{ + end buffer[8192]; + unsigned char * current; + int fd; +}; ++
Name | Description |
---|---|
buffer[8192] | Character buffer |
current | Current position in buffer |
fd | File descriptor |
An XML custom value.
++typedef struct mxml_custom_s mxml_custom_t; ++
File descriptor buffer (@private)
++typedef struct mxml_fdbuf_s mxml_fdbuf_t; ++
union mxml_value_u { + mxml_custom_t custom; mxml_element_t element; int integer; char * opaque; @@ -3072,6 +3473,7 @@ union mxml_value_u+ ++ Name Description custom Custom data element Element integer Integer number @@ -3082,9 +3484,29 @@ union mxml_value_u opaque Opaque string Variables
+static mxml_custom_load_cb_t mxml_custom_load_cb = NULL; ++ + +
Local functions...
++static mxml_custom_save_cb_t mxml_custom_save_cb = NULL; ++
d+h@vf61@fzyd`)@X=4Fa*Qk<_mWo7IkqAD4 |kYhN!^m1*T%k6_@#?Z_?8@h{VV22M5Srf
zn%o9?H0QWv-_P&?>jphGZ(vOj)d?@o8|rgQ>=!mUym+-+Zj{@?xuV*zM1!Sw-rl#i
zy!Cy$`|S9=zt+ZO*pHqOKYw>&uW9G@beI)+jx~L8veEQKZr+C0s@uhVi~7Y>Do2(z
z?aI1pywplv>^DfxxMKU=tUcAoL+|*BV|J))DdWZeu#i3aQ{uQz^RU&Bx4U2JAMN7Jj%`rSvPL?v0ni{gO-V
zY4c5VCOp!<-Roq~qn0m=JWU0{!u%ZW;eWh
z+o+SyTdtJxs`#hkAeT8sgXadVzsQY0Ffyhkh%33WCa&^b?w;17x7
3~!OSw7WAJgrQ`zr#KWg
z@O^TkI8+~CO5UM}CpA@zXjA^h=H$>&EFKZo81~?X;5KeoG-0-mNG-TwTq65Udj6NK
zp^CDyqrzC@uVe4{hs27B(*u2pctq&3D^Y2FgI4@>?-;V`%#OXFH=y?)zs>t-CH)Q|nDRVecHH4%Vr0
z-rKsD#sfjZ4?HZm6V!sr&W+2yYWk(d7pC@$HT9U@<;Ln$F%ZPNEY`C7!8LHe`P;54
zl)`knp6{LyCh@x+F9;*p>WM!lR#rgWc21H#FtAJ
rpgS8QhEtusU`u(xTre-pjTe5V28ti$?)zy5j18v#6
z)aQGuN9^<6_0_3-Fc