1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

fixed xmlGetProp to return "" when the attribute is NULL, Daniel.

This commit is contained in:
Daniel Veillard 1999-02-08 18:33:22 +00:00
parent 726c7e3c8d
commit 6800ef354b
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Mon Feb 8 19:27:56 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.c: fixed xmlGetProp to return "" when the attribute
exists, even if the node-list is NULL.
Mon Feb 8 16:10:15 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.c: patched an error outputting empty attribute values.

6
tree.c
View File

@ -2010,7 +2010,11 @@ CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name) {
while (prop != NULL) {
if (!xmlStrcmp(prop->name, name))
return(xmlNodeListGetString(node->doc, prop->val, 1));
CHAR *ret;
ret = xmlNodeListGetString(node->doc, prop->val, 1);
if (ret == NULL) return(xmlStrdup(""));
return(ret);
prop = prop->next;
}
return(NULL);