summaryrefslogtreecommitdiff
path: root/lisp/xml.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@is.elta.co.il>2003-12-29 12:13:27 +0000
committerEli Zaretskii <eliz@is.elta.co.il>2003-12-29 12:13:27 +0000
commit9bcd6a7e9486d68f612fe179073868bfa2ed6563 (patch)
tree02a647c1c169aa6cfba60717c9fc8945613d467e /lisp/xml.el
parentdffafab0865acfdfaed232b9c91166b501d079f6 (diff)
(xml-get-attribute-or-nil): New function, like
xml-get-attribute, but returns nil if the attribute was not found. (xml-get-attribute): Converted to defsubst, uses xml-get-attribute-or-nil.
Diffstat (limited to 'lisp/xml.el')
-rw-r--r--lisp/xml.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/xml.el b/lisp/xml.el
index a6159554b3f..b025a546a48 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -104,15 +104,24 @@ CHILD-NAME should be a lower case symbol."
(push child match))))
(nreverse match)))
-(defun xml-get-attribute (node attribute)
+(defun xml-get-attribute-or-nil (node attribute)
"Get from NODE the value of ATTRIBUTE.
-An empty string is returned if the attribute was not found."
+nil is returned if the attribute was not found.
+
+See also `xml-get-attribute'."
(if (xml-node-attributes node)
(let ((value (assoc attribute (xml-node-attributes node))))
(if value
(cdr value)
- ""))
- ""))
+ nil))
+ nil))
+
+(defsubst xml-get-attribute (node attribute)
+ "Get from NODE the value of ATTRIBUTE.
+An empty string is returned if the attribute was not found.
+
+See also `xml-get-attribute-or-nil'."
+ (or (xml-get-attribute-or-nil node attribute) ""))
;;*******************************************************************
;;**