Fix documentation and add usage of mxmlOptionsDelete in test program (Issue #337)

This commit is contained in:
Michael R Sweet 2025-01-19 10:51:50 -05:00
parent 8173bef3fb
commit b44e7de7da
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
8 changed files with 32 additions and 28 deletions

View File

@ -7,6 +7,7 @@ Changes in Mini-XML 4.0.4
- Added Linux-specific build files and dropped unused `long long` config tests
(Issue #335)
- Documentation fixes (Issue #337)
- Fixed an issue when reporting errors with a `NULL` options pointer
(Issue #329)
- Fixed some compiler warnings (Issue #333)

2
NOTICE
View File

@ -1,6 +1,6 @@
Mini-XML
Copyright © 2003-2024 by Michael R Sweet
Copyright © 2003-2025 by Michael R Sweet
(Optional) Exceptions to the Apache 2.0 License:

View File

@ -177,7 +177,7 @@ current version of this software, documentation, and Github issue tracking page.
Legal Stuff
-----------
Copyright © 2003-2024 by Michael R Sweet
Copyright © 2003-2025 by Michael R Sweet
The Mini-XML library is licensed under the Apache License Version 2.0 with an
*optional* exception to allow linking against GPL2/LGPL2-only software. See the

View File

@ -1,4 +1,4 @@
.TH mxml 3 "Mini-XML API" "2024-11-17" "Mini-XML API"
.TH mxml 3 "Mini-XML API" "2025-01-19" "Mini-XML API"
.SH NAME
mxml \- Mini-XML API
.SH INCLUDE FILE
@ -1112,20 +1112,19 @@ The default load/save options load values using the constant type
The various \fBmxmlOptionsSet\fR functions are used to change the defaults,
for example:
.PP
\fB`\fRc
mxml_options_t \fIoptions = mxmlOptionsNew();
/\fR Load values as opaque strings */
mxmlOptionsSetTypeValue(options, MXML_TYPE_OPAQUE);
.nf
mxml_options_t *options = mxmlOptionsNew();
/* Load values as opaque strings */
mxmlOptionsSetTypeValue(options, MXML_TYPE_OPAQUE);
Note: The most common programming error when using the Mini-XML library is
to load an XML file using the `MXML_TYPE_TEXT` node type, which returns
inline text as a series of whitespace-delimited words, instead of using the
`MXML_TYPE_OPAQUE` node type which returns the inline text as a single string
(including whitespace).
.fi
Note: The most common programming error when using the Mini-XML library is
to load an XML file using the \fBMXML_TYPE_TEXT\fR node type, which returns
inline text as a series of whitespace-delimited words, instead of using the
\fBMXML_TYPE_OPAQUE\fR node type which returns the inline text as a single string
(including whitespace).
.SS mxmlOptionsSetCustomCallbacks
Set the custom data callbacks.
.PP

Binary file not shown.

View File

@ -3,7 +3,7 @@
<head>
<title>Mini-XML 4.0 Programming Manual</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="generator" content="codedoc v3.7">
<meta name="generator" content="codedoc v3.8">
<meta name="author" content="Michael R Sweet">
<meta name="language" content="en-US">
<meta name="copyright" content="Copyright © 2003-2024, All Rights Reserved.">
@ -466,8 +466,9 @@ span.string {
<p>If you have the <code>pkg-config</code> software installed, you can use it to determine the proper compiler and linker options for your installation:</p>
<pre><code>gcc `pkg-config --cflags mxml4` -o myprogram myprogram.c `pkg-config --libs mxml4`
</code></pre>
<p>&gt; Note: The library name &quot;mxml4&quot; is a configure-time option. If you use the</p>
<blockquote>
<p>Note: The library name &quot;mxml4&quot; is a configure-time option. If you use the <code>--disable-libmxml4-prefix</code> configure option the library is named &quot;mxml&quot;.</p>
<p><code>--disable-libmxml4-prefix</code> configure option the library is named &quot;mxml&quot;.</p>
</blockquote>
<h3 class="title" id="api-basics">API Basics</h3>
<p>Every piece of information in an XML file is stored in memory in &quot;nodes&quot;. Nodes are represented by <code>mxml_node_t</code> pointers. Each node has an associated type, value(s), a parent node, sibling nodes (previous and next), potentially first and last child nodes, and an optional user data pointer.</p>
@ -2469,21 +2470,20 @@ reused for multiple calls to these functions and should be freed using the
The default load/save options load values using the constant type
<code>MXML_TYPE_TEXT</code> and save XML data with a wrap margin of 72 columns.
The various <code>mxmlOptionsSet</code> functions are used to change the defaults,
for example:<br>
<br>
<code>`</code>c
mxml_options_t <em>options = mxmlOptionsNew();
for example:
/</em> Load values as opaque strings */
mxmlOptionsSetTypeValue(options, MXML_TYPE_OPAQUE);
<pre>
mxml_options_t *options = mxmlOptionsNew();
/* Load values as opaque strings */
mxmlOptionsSetTypeValue(options, MXML_TYPE_OPAQUE);
</pre>
Note: The most common programming error when using the Mini-XML library is
to load an XML file using the `MXML_TYPE_TEXT` node type, which returns
to load an XML file using the <code>MXML_TYPE_TEXT</code> node type, which returns
inline text as a series of whitespace-delimited words, instead of using the
`MXML_TYPE_OPAQUE` node type which returns the inline text as a single string
(including whitespace).</pre>
</p>
<code>MXML_TYPE_OPAQUE</code> node type which returns the inline text as a single string
(including whitespace).</p>
<h3 class="function"><a id="mxmlOptionsSetCustomCallbacks">mxmlOptionsSetCustomCallbacks</a></h3>
<p class="description">Set the custom data callbacks.</p>
<p class="code">

View File

@ -3,7 +3,7 @@
//
// https://www.msweet.org/mxml
//
// Copyright © 2003-2024 by Michael R Sweet.
// Copyright © 2003-2025 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
@ -40,7 +40,7 @@ mxmlOptionsDelete(
// The various `mxmlOptionsSet` functions are used to change the defaults,
// for example:
//
// ```c
// ```
// mxml_options_t *options = mxmlOptionsNew();
//
// /* Load values as opaque strings */

View File

@ -8,7 +8,7 @@
//
// https://www.msweet.org/mxml
//
// Copyright © 2003-2024 by Michael R Sweet.
// Copyright © 2003-2025 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
@ -616,6 +616,10 @@ main(int argc, // I - Number of command-line args
}
}
// Free memory used by options - not explicitly required here since we are
// just exiting, but long-running programs should do this...
mxmlOptionsDelete(options);
#ifndef _WIN32
// Debug hooks...
if (getenv("TEST_DELAY") != NULL)