Add support for spaces around the "=" in attributes (STR #67)

Fix support for processing instructions and directives that are not
at the top level of a file (STR #67)
pull/193/head
Michael R Sweet 17 years ago
parent 30d45102d7
commit 8174485371
  1. 10
      CHANGES
  2. 39
      mxml-file.c

@ -1,6 +1,14 @@
CHANGES - 2007-11-22 CHANGES - 2008-01-12
-------------------- --------------------
CHANGES IN Mini-XML 2.4.1
- Processing instructions and directives did not work
when not at the top level of a document (STR #67)
- Spaces around the "=" in attributes were not supported
(STR #67)
CHANGES IN Mini-XML 2.4 CHANGES IN Mini-XML 2.4
- Fixed shared library build problems on HP-UX and Mac OS X. - Fixed shared library build problems on HP-UX and Mac OS X.

@ -3,7 +3,7 @@
* *
* File loading code for Mini-XML, a small XML-like file parsing library. * File loading code for Mini-XML, a small XML-like file parsing library.
* *
* Copyright 2003-2007 by Michael Sweet. * Copyright 2003-2008 by Michael Sweet.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -1841,13 +1841,16 @@ mxml_load_data(
if (node) if (node)
{ {
if (!first) if (!first)
first = node; first = node;
parent = node; if (!parent)
{
parent = node;
if (cb) if (cb)
type = (*cb)(parent); type = (*cb)(parent);
} }
}
} }
else if (buffer[0] == '!') else if (buffer[0] == '!')
{ {
@ -1910,8 +1913,19 @@ mxml_load_data(
node = NULL; node = NULL;
} }
if (node && !first) if (node)
first = node; {
if (!first)
first = node;
if (!parent)
{
parent = node;
if (cb)
type = (*cb)(parent);
}
}
} }
else if (buffer[0] == '/') else if (buffer[0] == '/')
{ {
@ -2111,8 +2125,6 @@ mxml_parse_element(
valsize; /* Size of value string */ valsize; /* Size of value string */
/* /*
* Initialize the name and value buffers... * Initialize the name and value buffers...
*/ */
@ -2234,13 +2246,18 @@ mxml_parse_element(
if (mxmlElementGetAttr(node, name)) if (mxmlElementGetAttr(node, name))
goto error; goto error;
while (ch != EOF && mxml_isspace(ch))
ch = (*getc_cb)(p, encoding);
if (ch == '=') if (ch == '=')
{ {
/* /*
* Read the attribute value... * Read the attribute value...
*/ */
if ((ch = (*getc_cb)(p, encoding)) == EOF) while ((ch = (*getc_cb)(p, encoding)) != EOF && mxml_isspace(ch));
if (ch == EOF)
{ {
mxml_error("Missing value for attribute '%s' in element %s!", mxml_error("Missing value for attribute '%s' in element %s!",
name, node->value.element.name); name, node->value.element.name);

Loading…
Cancel
Save