mxmlLoad* did not error out on XML with multiple root nodes (STR #101)

This commit is contained in:
Michael R Sweet 2010-09-19 06:14:36 +00:00
parent 83dc8f4932
commit 6b83ce881e
2 changed files with 56 additions and 0 deletions

View File

@ -7,6 +7,7 @@ CHANGES IN Mini-XML 2.7
exceptions to the LGPL2 (STR #108) exceptions to the LGPL2 (STR #108)
- The shared library did not include a destructor for the thread- - The shared library did not include a destructor for the thread-
specific data key on UNIX-based operating systems (STR #103) specific data key on UNIX-based operating systems (STR #103)
- mxmlLoad* did not error out on XML with multiple root nodes (STR #101)
CHANGES IN Mini-XML 2.6 CHANGES IN Mini-XML 2.6

View File

@ -1650,6 +1650,17 @@ mxml_load_data(
*bufptr = '\0'; *bufptr = '\0';
if (!parent && first)
{
/*
* There can only be one root element!
*/
mxml_error("<%s> cannot be a second root node after <%s>",
buffer, first->value.element.name);
goto error;
}
if ((node = mxmlNewElement(parent, buffer)) == NULL) if ((node = mxmlNewElement(parent, buffer)) == NULL)
{ {
/* /*
@ -1707,6 +1718,17 @@ mxml_load_data(
*bufptr = '\0'; *bufptr = '\0';
if (!parent && first)
{
/*
* There can only be one root element!
*/
mxml_error("<%s> cannot be a second root node after <%s>",
buffer, first->value.element.name);
goto error;
}
if ((node = mxmlNewElement(parent, buffer)) == NULL) if ((node = mxmlNewElement(parent, buffer)) == NULL)
{ {
/* /*
@ -1763,6 +1785,17 @@ mxml_load_data(
*bufptr = '\0'; *bufptr = '\0';
if (!parent && first)
{
/*
* There can only be one root element!
*/
mxml_error("<%s> cannot be a second root node after <%s>",
buffer, first->value.element.name);
goto error;
}
if ((node = mxmlNewElement(parent, buffer)) == NULL) if ((node = mxmlNewElement(parent, buffer)) == NULL)
{ {
/* /*
@ -1838,6 +1871,17 @@ mxml_load_data(
*bufptr = '\0'; *bufptr = '\0';
if (!parent && first)
{
/*
* There can only be one root element!
*/
mxml_error("<%s> cannot be a second root node after <%s>",
buffer, first->value.element.name);
goto error;
}
if ((node = mxmlNewElement(parent, buffer)) == NULL) if ((node = mxmlNewElement(parent, buffer)) == NULL)
{ {
/* /*
@ -1918,6 +1962,17 @@ mxml_load_data(
* Handle open tag... * Handle open tag...
*/ */
if (!parent && first)
{
/*
* There can only be one root element!
*/
mxml_error("<%s> cannot be a second root node after <%s>",
buffer, first->value.element.name);
goto error;
}
if ((node = mxmlNewElement(parent, buffer)) == NULL) if ((node = mxmlNewElement(parent, buffer)) == NULL)
{ {
/* /*