mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 11:25:30 +00:00
Fix mxmlWalkNext().
Add changelog file.
This commit is contained in:
parent
5fc2d1b995
commit
7de19b18af
@ -4,3 +4,5 @@ config.status
|
||||
Makefile
|
||||
libmxml.a
|
||||
testmxml
|
||||
*.bck
|
||||
*.bak
|
||||
|
12
CHANGES
Normal file
12
CHANGES
Normal file
@ -0,0 +1,12 @@
|
||||
README - 06/03/2003
|
||||
-------------------
|
||||
|
||||
|
||||
CHANGES IN Mini-XML 0.91
|
||||
|
||||
- mxmlWalkNext() would go into an infinite loop.
|
||||
|
||||
|
||||
CHANGES IN Mini-XML 0.9
|
||||
|
||||
- Initial public release.
|
4
README
4
README
@ -4,7 +4,9 @@ README - 06/03/2003
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
This README file describes the Mini-XML library version 0.9.
|
||||
This README file describes the Mini-XML library version
|
||||
0.91.
|
||||
|
||||
Mini-XML is a small XML parsing library that you can use to
|
||||
read XML and XML-like data files in your application without
|
||||
requiring large non-standard libraries. Mini-XML only
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: mxml-search.c,v 1.1 2003/06/03 19:46:30 mike Exp $"
|
||||
* "$Id: mxml-search.c,v 1.2 2003/06/03 20:40:01 mike Exp $"
|
||||
*
|
||||
* Search/navigation functions for mini-XML, a small XML-like file
|
||||
* parsing library.
|
||||
@ -21,6 +21,7 @@
|
||||
* mxmlFindElement() - Find the named element.
|
||||
* mxmlWalkNext() - Walk to the next logical node in the tree.
|
||||
* mxmlWalkPrev() - Walk to the previous logical node in the tree.
|
||||
* mxml_walk_next() - Walk to the next logical node in the tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -30,6 +31,14 @@
|
||||
#include "mxml.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
mxml_node_t *mxml_walk_next(mxml_node_t *node, mxml_node_t *top,
|
||||
int descend);
|
||||
|
||||
|
||||
/*
|
||||
* 'mxmlFindElement()' - Find the named element.
|
||||
*/
|
||||
@ -79,16 +88,7 @@ mxml_node_t * /* O - Next node or NULL */
|
||||
mxmlWalkNext(mxml_node_t *node, /* I - Current node */
|
||||
mxml_node_t *top) /* I - Top node */
|
||||
{
|
||||
if (!node)
|
||||
return (NULL);
|
||||
else if (node->child)
|
||||
return (node->child);
|
||||
else if (node->next)
|
||||
return (node->next);
|
||||
else if (node->parent != top)
|
||||
return (mxmlWalkNext(node->parent, top));
|
||||
else
|
||||
return (NULL);
|
||||
return (mxml_walk_next(node, top, 1));
|
||||
}
|
||||
|
||||
|
||||
@ -112,5 +112,27 @@ mxmlWalkPrev(mxml_node_t *node, /* I - Current node */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxml-search.c,v 1.1 2003/06/03 19:46:30 mike Exp $".
|
||||
* 'mxml_walk_next()' - Walk to the next logical node in the tree.
|
||||
*/
|
||||
|
||||
mxml_node_t * /* O - Next node or NULL */
|
||||
mxml_walk_next(mxml_node_t *node, /* I - Current node */
|
||||
mxml_node_t *top, /* I - Top node */
|
||||
int descend) /* I - 1 = descend, 0 = don't */
|
||||
{
|
||||
if (!node)
|
||||
return (NULL);
|
||||
else if (node->child && descend)
|
||||
return (node->child);
|
||||
else if (node->next)
|
||||
return (node->next);
|
||||
else if (node->parent != top)
|
||||
return (mxml_walk_next(node->parent, top, 0));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: mxml-search.c,v 1.2 2003/06/03 20:40:01 mike Exp $".
|
||||
*/
|
||||
|
26
testmxml.c
26
testmxml.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* "$Id: testmxml.c,v 1.2 2003/06/03 20:24:28 mike Exp $"
|
||||
* "$Id: testmxml.c,v 1.3 2003/06/03 20:40:01 mike Exp $"
|
||||
*
|
||||
* Test program for mini-XML, a small XML-like file parsing library.
|
||||
*
|
||||
@ -44,7 +44,8 @@ main(int argc, /* I - Number of command-line args */
|
||||
char *argv[]) /* I - Command-line args */
|
||||
{
|
||||
FILE *fp; /* File to read */
|
||||
mxml_node_t *tree; /* XML tree */
|
||||
mxml_node_t *tree, /* XML tree */
|
||||
*node; /* Node which should be in test.xml */
|
||||
|
||||
|
||||
/*
|
||||
@ -81,6 +82,25 @@ main(int argc, /* I - Number of command-line args */
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that mxmlFindElement() and indirectly mxmlWalkNext() work
|
||||
* properly...
|
||||
*/
|
||||
|
||||
if ((node = mxmlFindElement(tree, tree, "choice")) == NULL)
|
||||
{
|
||||
fputs("Unable to find first <choice> element in XML tree!\n", stderr);
|
||||
mxmlDelete(tree);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((node = mxmlFindElement(node, tree, "choice")) == NULL)
|
||||
{
|
||||
fputs("Unable to find second <choice> element in XML tree!\n", stderr);
|
||||
mxmlDelete(tree);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the XML tree...
|
||||
*/
|
||||
@ -127,5 +147,5 @@ type_cb(mxml_node_t *node) /* I - Element node */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: testmxml.c,v 1.2 2003/06/03 20:24:28 mike Exp $".
|
||||
* End of "$Id: testmxml.c,v 1.3 2003/06/03 20:40:01 mike Exp $".
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user