1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00

(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.
This commit is contained in:
Eli Zaretskii 2003-12-29 12:13:27 +00:00
parent dffafab086
commit 9bcd6a7e94
2 changed files with 20 additions and 4 deletions

View file

@ -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) ""))
;;*******************************************************************
;;**