]> git.eshelyaron.com Git - emacs.git/commitdiff
(xml-get-attribute-or-nil): New function, like
authorEli Zaretskii <eliz@is.elta.co.il>
Mon, 29 Dec 2003 12:13:27 +0000 (12:13 +0000)
committerEli Zaretskii <eliz@is.elta.co.il>
Mon, 29 Dec 2003 12:13:27 +0000 (12:13 +0000)
xml-get-attribute, but returns nil if the attribute was not found.
(xml-get-attribute): Converted to defsubst, uses
xml-get-attribute-or-nil.

lisp/ChangeLog
lisp/xml.el

index 336a1b8e7b801e1b5109ece8b9ef3a957d61fc0a..df852fc5b139a6e05a882b81d711da6b81e4f0f6 100644 (file)
@@ -1,3 +1,10 @@
+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.
index a6159554b3f7641f8a7727f3bdb892cc7e7ca1f5..b025a546a48705fbd0b4f16ba8ee79ca615ec6e4 100644 (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) ""))
 
 ;;*******************************************************************
 ;;**