Changed the behaviour of xmlGetProp on NULL values, Daniel.
diff --git a/ChangeLog b/ChangeLog
index 878fcc7..f5bdd25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Dec 6 13:06:58 EST 1998 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * tree.c: changed the behaviour of xmlGetProp on NULL values.
+
Sat Dec 5 12:25:09 EST 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.c: patched a bug in the generation of empty attributes
diff --git a/tree.c b/tree.c
index aed6497..e1dbd29 100644
--- a/tree.c
+++ b/tree.c
@@ -1936,14 +1936,19 @@
*
* Search and get the value of an attribute associated to a node
* This does the entity substitution.
+ *
* return values: the attribute value or NULL if not found.
*/
const CHAR *xmlGetProp(xmlNodePtr node, const CHAR *name) {
xmlAttrPtr prop = node->properties;
while (prop != NULL) {
- if (!xmlStrcmp(prop->name, name))
- return(xmlNodeListGetString(node->doc, prop->val, 1));
+ if (!xmlStrcmp(prop->name, name)) {
+ if (prop->val != NULL)
+ return(xmlNodeListGetString(node->doc, prop->val, 1));
+ else
+ return(xmlStrndup("", 1));
+ }
prop = prop->next;
}
return(NULL);