Commit 9bcd6a7e authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

(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.
parent dffafab0
2003-12-29 Mark A. Hershberger <mah@everybody.org>
* xml.el (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.
2003-12-29 Eli Zaretskii <eliz@elta.co.il>
* emacs-lisp/easymenu.el (easy-menu-define): Doc fix.
......
......@@ -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) ""))
;;*******************************************************************
;;**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment