Bump version to 2.4.

Added mxmlElementDeleteAttr() function (STR #59).
This commit is contained in:
Michael R Sweet 2007-09-15 20:03:15 +00:00
parent 1b7e834dbc
commit d6d842e60a
12 changed files with 153 additions and 57 deletions

View File

@ -1,8 +1,11 @@
CHANGES - 2007-09-09
CHANGES - 2007-09-15
--------------------
CHANGES IN Mini-XML 2.3.1
CHANGES IN Mini-XML 2.4
- Added mxmlElementDeleteAttr() function (STR #59)
- mxmlLoad*() incorrectly treated declarations as parent
elements (STR #56)
- mxmlLoad*() incorrectly allowed attributes without values
(STR #47)
- Fixed Visual C++ build problems (STR #49)

View File

@ -142,13 +142,13 @@ install-libmxml.a:
$(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir)
$(RANLIB) $(BUILDROOT)$(libdir)/libmxml.a
install-libmxml.so.1.3:
install-libmxml.so.1.4:
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml.so.1.3 $(BUILDROOT)$(libdir)
$(INSTALL_LIB) libmxml.so.1.4 $(BUILDROOT)$(libdir)
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
$(LN) libmxml.so.1.3 $(BUILDROOT)$(libdir)/libmxml.so
$(LN) libmxml.so.1.4 $(BUILDROOT)$(libdir)/libmxml.so
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.1
$(LN) libmxml.so.1.3 $(BUILDROOT)$(libdir)/libmxml.so.1
$(LN) libmxml.so.1.4 $(BUILDROOT)$(libdir)/libmxml.so.1
install-libmxml.sl.1:
$(INSTALL_DIR) $(BUILDROOT)$(libdir)
@ -178,10 +178,10 @@ uninstall: uninstall-$(LIBMXML) uninstall-libmxml.a
uninstall-libmxml.a:
$(RM) $(BUILDROOT)$(libdir)/libmxml.a
uninstall-libmxml.so.1.3:
uninstall-libmxml.so.1.4:
$(RM) $(BUILDROOT)$(libdir)/libmxml.so
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.1
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.1.3
$(RM) $(BUILDROOT)$(libdir)/libmxml.so.1.4
uninstall-libmxml.sl.1:
$(RM) $(BUILDROOT)$(libdir)/libmxml.sl
@ -239,14 +239,14 @@ $(LIBOBJS): mxml.h
#
# libmxml.so.1.3
# libmxml.so.1.4
#
libmxml.so.1.3: $(LIBOBJS)
$(DSO) $(DSOFLAGS) -o libmxml.so.1.3 $(LIBOBJS)
libmxml.so.1.4: $(LIBOBJS)
$(DSO) $(DSOFLAGS) -o libmxml.so.1.4 $(LIBOBJS)
$(RM) libmxml.so libmxml.so.1
$(LN) libmxml.so.1.3 libmxml.so
$(LN) libmxml.so.1.3 libmxml.so.1
$(LN) libmxml.so.1.4 libmxml.so
$(LN) libmxml.so.1.4 libmxml.so.1
#
@ -266,7 +266,7 @@ libmxml.sl.1: $(LIBOBJS)
libmxml.1.dylib: $(LIBOBJS)
$(DSO) $(DSOFLAGS) -o libmxml.1.dylib \
-install_name $(libdir)/libmxml.dylib \
-current_version 1.3.0 \
-current_version 1.4.0 \
-compatibility_version 1.0.0 \
$(LIBOBJS)
$(RM) libmxml.dylib libmxml.1.dylib

12
configure vendored
View File

@ -1673,7 +1673,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
VERSION=2.3.1
VERSION=2.4
cat >>confdefs.h <<_ACEOF
#define MXML_VERSION "Mini-XML v$VERSION"
@ -3730,7 +3730,7 @@ echo $ECHO_N "checking for shared library support... $ECHO_C" >&6; }
SunOS* | UNIX_S*)
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)"
LDFLAGS="$LDFLAGS -R\$(libdir)"
@ -3739,7 +3739,7 @@ echo "${ECHO_T}yes" >&6; }
HP-UX*)
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBMXML="libmxml.sl.2"
LIBMXML="libmxml.sl.1"
DSO="ld"
DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)"
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
@ -3748,7 +3748,7 @@ echo "${ECHO_T}yes" >&6; }
IRIX)
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)"
;;
@ -3756,7 +3756,7 @@ echo "${ECHO_T}yes" >&6; }
OSF1* | Linux | GNU)
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)"
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
@ -3765,7 +3765,7 @@ echo "${ECHO_T}yes" >&6; }
*BSD*)
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)"
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"

View File

@ -23,7 +23,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number...
VERSION=2.3.1
VERSION=2.4
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION")
@ -119,7 +119,7 @@ if test x$enable_shared = xyes; then
case "$uname" in
SunOS* | UNIX_S*)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)"
LDFLAGS="$LDFLAGS -R\$(libdir)"
@ -127,7 +127,7 @@ if test x$enable_shared = xyes; then
HP-UX*)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.sl.2"
LIBMXML="libmxml.sl.1"
DSO="ld"
DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)"
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
@ -135,14 +135,14 @@ if test x$enable_shared = xyes; then
IRIX)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)"
;;
OSF1* | Linux | GNU)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)"
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
@ -150,7 +150,7 @@ if test x$enable_shared = xyes; then
*BSD*)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.3"
LIBMXML="libmxml.so.1.4"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)"
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"

View File

@ -1,6 +1,6 @@
<html>
<head>
<title>Mini-XML Programmers Manual, Version 2.3</title>
<title>Mini-XML Programmers Manual, Version 2.4</title>
<meta name='copyright' content='Copyright 2003-2007'>
<meta name='author' content='Michael R. Sweet'>
<meta name='keywords' content='XML, C, C++, library'>
@ -10,7 +10,7 @@
<h1 align='right'><a name='INTRO'><img src="0.gif" align="right"
hspace="10" width="100" height="100" alt="0"></a>Introduction</h1>
<p>This programmers manual describes Mini-XML version 2.3.1, a small
<p>This programmers manual describes Mini-XML version 2.4, a small
XML parsing library that you can use to read and write XML data
files in your C and C++ applications.</p>

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>Documentation</title>
<meta name='creator' content='Mini-XML v2.3.1'>
<meta name='creator' content='Mini-XML v2.4'>
<style type='text/css'><!--
h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }
@ -76,6 +76,7 @@
<ul>
<li><a href='#mxmlAdd'><tt>mxmlAdd()</tt></a> </li>
<li><a href='#mxmlDelete'><tt>mxmlDelete()</tt></a> </li>
<li><a href='#mxmlElementDeleteAttr'><tt>mxmlElementDeleteAttr()</tt></a> <span class='info'>&nbsp;Mini-XML 2.4&nbsp;</span></li>
<li><a href='#mxmlElementGetAttr'><tt>mxmlElementGetAttr()</tt></a> </li>
<li><a href='#mxmlElementSetAttr'><tt>mxmlElementSetAttr()</tt></a> </li>
<li><a href='#mxmlElementSetAttrf'><tt>mxmlElementSetAttrf()</tt></a> <span class='info'>&nbsp;Mini-XML 2.3&nbsp;</span></li>
@ -176,6 +177,28 @@ mxmlDelete(
<h4>Returns</h4>
<p>Nothing.</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'>&nbsp;Mini-XML 2.4&nbsp;</span><a name='mxmlElementDeleteAttr'>mxmlElementDeleteAttr()</a></h3>
<h4>Description</h4>
<p>Delete an attribute.
<h4>Syntax</h4>
<p><tt>
void<br>
mxmlElementDeleteAttr(
<a href='#mxml_node_t'>mxml_node_t</a> * node,
const char * name);
</tt></p>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0' summary='Arguments'>
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>node</tt></td><td>Element</td></tr>
<tr><td><tt>name</tt></td><td>Attribute name</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>Nothing.</p>
<!-- NEW PAGE -->
<h3 class='title'><a name='mxmlElementGetAttr'>mxmlElementGetAttr()</a></h3>
<h4>Description</h4>
<p>Get an attribute.

View File

@ -5,10 +5,15 @@
hspace="10" width="100" height="100" alt="B"></a>Release Notes</h1>
<h2 _hd_omit_toc>Changes in Mini-XML 2.3.1</h2>
<h2 _hd_omit_toc>Changes in Mini-XML 2.4</h2>
<ul>
<li>Added mxmlElementDeleteAttr() function (STR #59)</li>
<li>mxmlLoad*() incorrectly treated declarations as parent
elements (STR #56)</li>
<li>mxmlLoad*() incorrectly allowed attributes without
values (STR #47)</li>

View File

@ -17,10 +17,11 @@
*
* Contents:
*
* mxmlElementGetAttr() - Get an attribute.
* mxmlElementSetAttr() - Set an attribute.
* mxmlElementSetAttrf() - Set an attribute with a formatted value.
* mxml_set_attr() - Set or add an attribute name/value pair.
* mxmlElementDeleteAttr() - Delete an attribute.
* mxmlElementGetAttr() - Get an attribute.
* mxmlElementSetAttr() - Set an attribute.
* mxmlElementSetAttrf() - Set an attribute with a formatted value.
* mxml_set_attr() - Set or add an attribute name/value pair.
*/
/*
@ -39,6 +40,64 @@ static int mxml_set_attr(mxml_node_t *node, const char *name,
char *value);
/*
* 'mxmlElementDeleteAttr()' - Delete an attribute.
*
* @since Mini-XML 2.4@
*/
void
mxmlElementDeleteAttr(mxml_node_t *node,/* I - Element */
const char *name)/* I - Attribute name */
{
int i; /* Looping var */
mxml_attr_t *attr; /* Cirrent attribute */
#ifdef DEBUG
fprintf(stderr, "mxmlElementDeleteAttr(node=%p, name=\"%s\")\n",
node, name ? name : "(null)");
#endif /* DEBUG */
/*
* Range check input...
*/
if (!node || node->type != MXML_ELEMENT || !name)
return;
/*
* Look for the attribute...
*/
for (i = node->value.element.num_attrs, attr = node->value.element.attrs;
i > 0;
i --, attr ++)
{
#ifdef DEBUG
printf(" %s=\"%s\"\n", attr->name, attr->value);
#endif /* DEBUG */
if (!strcmp(attr->name, name))
{
/*
* Delete this attribute...
*/
free(attr->name);
free(attr->value);
i --;
if (i > 0)
memmove(attr, attr + 1, i * sizeof(mxml_attr_t));
node->value.element.num_attrs --;
return;
}
}
}
/*
* 'mxmlElementGetAttr()' - Get an attribute.
*
@ -50,7 +109,7 @@ const char * /* O - Attribute value or NULL */
mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */
const char *name) /* I - Name of attribute */
{
int i; /* Looping var */
int i; /* Looping var */
mxml_attr_t *attr; /* Cirrent attribute */

View File

@ -1727,7 +1727,7 @@ mxml_load_data(
node = NULL;
}
if (!first)
if (node && !first)
first = node;
}
else if (!strcmp(buffer, "![CDATA["))
@ -1784,7 +1784,7 @@ mxml_load_data(
node = NULL;
}
if (!first)
if (node && !first)
first = node;
}
else if (buffer[0] == '?')
@ -1841,11 +1841,11 @@ mxml_load_data(
}
if (node)
{
parent = node;
{
if (!first)
first = node;
if (!first)
first = parent;
parent = node;
if (cb)
type = (*cb)(parent);
@ -1912,20 +1912,8 @@ mxml_load_data(
node = NULL;
}
if (node)
{
/*
* Descend into this node, setting the value type as needed...
*/
if (!first)
first = node;
parent = node;
if (cb)
type = (*cb)(parent);
}
if (node && !first)
first = node;
}
else if (buffer[0] == '/')
{
@ -2086,7 +2074,10 @@ mxml_load_data(
}
}
return (parent);
if (parent)
return (parent);
else
return (first);
/*
* Common error return...

2
mxml.h
View File

@ -186,6 +186,8 @@ extern "C" {
extern void mxmlAdd(mxml_node_t *parent, int where,
mxml_node_t *child, mxml_node_t *node);
extern void mxmlDelete(mxml_node_t *node);
extern void mxmlElementDeleteAttr(mxml_node_t *node,
const char *name);
extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name);
extern void mxmlElementSetAttr(mxml_node_t *node, const char *name,
const char *value);

View File

@ -18,7 +18,7 @@
Summary: Miniature XML development library
Name: mxml
Version: 2.3
Version: 2.4
Release: 1
License: LGPL
Group: Development/Libraries

View File

@ -38,6 +38,19 @@ node from its parent using the mxmlRemove() function.</description>
<description>Node to delete</description>
</argument>
</function>
<function name="mxmlElementDeleteAttr">
<description>Delete an attribute.
@since Mini-XML 2.4@</description>
<argument name="node" direction="I">
<type>mxml_node_t *</type>
<description>Element</description>
</argument>
<argument name="name" direction="I">
<type>const char *</type>
<description>Attribute name</description>
</argument>
</function>
<function name="mxmlElementGetAttr">
<returnvalue>
<type>const char *</type>