diff --git a/CHANGES b/CHANGES
index f8dde3e..4ff03ca 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,11 @@ README - 06/03/2003
-------------------
+CHANGES IN Mini-XML 0.93
+
+ - mxmlLoadFile() now correctly handles comments.
+
+
CHANGES IN Mini-XML 0.92
- mxmlSaveFile() didn't return a value on success.
diff --git a/index.html b/index.html
index cee43d6..3401ee2 100644
--- a/index.html
+++ b/index.html
@@ -14,8 +14,9 @@
Mini-XML Home Page
-Current Release: v0.92 ( download source .tar.gz 40k )
+Current Release: v0.93 [ Download Source (.tar.gz 40k) |
+View Change Log ]
Introduction
diff --git a/mxml-file.c b/mxml-file.c
index 4f3c2e3..3a60db9 100644
--- a/mxml-file.c
+++ b/mxml-file.c
@@ -1,5 +1,5 @@
/*
- * "$Id: mxml-file.c,v 1.2 2003/06/04 00:25:59 mike Exp $"
+ * "$Id: mxml-file.c,v 1.3 2003/06/04 01:23:21 mike Exp $"
*
* File loading code for mini-XML, a small XML-like file parsing library.
*
@@ -135,7 +135,37 @@ mxmlLoadFile(mxml_node_t *top, /* I - Top node */
*bufptr = '\0';
bufptr = buffer;
- if (buffer[0] == '/')
+ if (!strcmp(buffer, "!--"))
+ {
+ /*
+ * Skip comment...
+ */
+
+ buffer[3] = '\0';
+
+ while ((ch = getc(fp)) != EOF)
+ {
+ *bufptr++ = ch;
+
+ if ((bufptr - buffer) == 3)
+ {
+ if (!strcmp(buffer, "-->"))
+ break;
+
+ buffer[0] = buffer[1];
+ buffer[1] = buffer[2];
+ bufptr --;
+ }
+ }
+
+ bufptr = buffer;
+
+ if (ch == EOF)
+ break;
+ else
+ continue;
+ }
+ else if (buffer[0] == '/')
{
/*
* Handle close tag...
@@ -638,5 +668,5 @@ mxml_write_string(const char *s, /* I - String to write */
/*
- * End of "$Id: mxml-file.c,v 1.2 2003/06/04 00:25:59 mike Exp $".
+ * End of "$Id: mxml-file.c,v 1.3 2003/06/04 01:23:21 mike Exp $".
*/
diff --git a/testmxml.c b/testmxml.c
index 673fac5..17cf9bc 100644
--- a/testmxml.c
+++ b/testmxml.c
@@ -1,5 +1,5 @@
/*
- * "$Id: testmxml.c,v 1.3 2003/06/03 20:40:01 mike Exp $"
+ * "$Id: testmxml.c,v 1.4 2003/06/04 01:23:21 mike Exp $"
*
* Test program for mini-XML, a small XML-like file parsing library.
*
@@ -82,23 +82,26 @@ 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 element in XML tree!\n", stderr);
- mxmlDelete(tree);
- return (1);
- }
-
- if ((node = mxmlFindElement(node, tree, "choice")) == NULL)
+ if (!strcmp(argv[1], "test.xml"))
{
- fputs("Unable to find second element in XML tree!\n", stderr);
- mxmlDelete(tree);
- return (1);
+ /*
+ * Verify that mxmlFindElement() and indirectly mxmlWalkNext() work
+ * properly...
+ */
+
+ if ((node = mxmlFindElement(tree, tree, "choice")) == NULL)
+ {
+ fputs("Unable to find first element in XML tree!\n", stderr);
+ mxmlDelete(tree);
+ return (1);
+ }
+
+ if ((node = mxmlFindElement(node, tree, "choice")) == NULL)
+ {
+ fputs("Unable to find second element in XML tree!\n", stderr);
+ mxmlDelete(tree);
+ return (1);
+ }
}
/*
@@ -147,5 +150,5 @@ type_cb(mxml_node_t *node) /* I - Element node */
/*
- * End of "$Id: testmxml.c,v 1.3 2003/06/03 20:40:01 mike Exp $".
+ * End of "$Id: testmxml.c,v 1.4 2003/06/04 01:23:21 mike Exp $".
*/