diff --git a/testparser.c b/testparser.c index dd59e4f4..46b65eb1 100644 --- a/testparser.c +++ b/testparser.c @@ -13,6 +13,21 @@ #include +static int +testNewDocNode(void) { + xmlNodePtr node; + int err = 0; + + node = xmlNewDocNode(NULL, NULL, BAD_CAST "c", BAD_CAST ""); + if (node->children != NULL) { + fprintf(stderr, "empty node has children\n"); + err = 1; + } + xmlFreeNode(node); + + return err; +} + static int testStandaloneWithEncoding(void) { xmlDocPtr doc; @@ -631,6 +646,7 @@ int main(void) { int err = 0; + err |= testNewDocNode(); err |= testStandaloneWithEncoding(); err |= testUnsupportedEncoding(); err |= testNodeGetContent(); diff --git a/tree.c b/tree.c index d3b9aa68..c2200864 100644 --- a/tree.c +++ b/tree.c @@ -1214,7 +1214,7 @@ xmlNodeParseContentInternal(const xmlDoc *doc, xmlNodePtr parent, else remaining = len; - if (value == NULL) + if ((value == NULL) || (value[0] == 0)) goto done; cur = value;