mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-24 11:25:30 +00:00
Support comments.
This commit is contained in:
parent
c1093723a9
commit
0855089dcd
5
CHANGES
5
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.
|
||||
|
@ -14,8 +14,9 @@
|
||||
|
||||
<H1 CLASS="title" ALIGN="CENTER">Mini-XML Home Page</H1>
|
||||
|
||||
<P CLASS="title" ALIGN="CENTER">Current Release: v0.92 ( <A
|
||||
HREF="mxml-0.92.tar.gz">download source .tar.gz 40k</A> )</P>
|
||||
<P CLASS="title" ALIGN="CENTER">Current Release: v0.93 [ <A
|
||||
HREF="mxml-0.93.tar.gz">Download Source (.tar.gz 40k)</A> |
|
||||
<A HREF="CHANGES">View Change Log</A> ]</P>
|
||||
|
||||
<H2>Introduction</H2>
|
||||
|
||||
|
36
mxml-file.c
36
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 $".
|
||||
*/
|
||||
|
37
testmxml.c
37
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)
|
||||
if (!strcmp(argv[1], "test.xml"))
|
||||
{
|
||||
fputs("Unable to find first <choice> element in XML tree!\n", stderr);
|
||||
mxmlDelete(tree);
|
||||
return (1);
|
||||
}
|
||||
/*
|
||||
* Verify that mxmlFindElement() and indirectly mxmlWalkNext() work
|
||||
* properly...
|
||||
*/
|
||||
|
||||
if ((node = mxmlFindElement(node, tree, "choice")) == NULL)
|
||||
{
|
||||
fputs("Unable to find second <choice> element in XML tree!\n", stderr);
|
||||
mxmlDelete(tree);
|
||||
return (1);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -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 $".
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user