diff options
| author | Eli Zaretskii | 2003-12-29 12:13:27 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2003-12-29 12:13:27 +0000 |
| commit | 9bcd6a7e9486d68f612fe179073868bfa2ed6563 (patch) | |
| tree | 02a647c1c169aa6cfba60717c9fc8945613d467e /lisp | |
| parent | dffafab0865acfdfaed232b9c91166b501d079f6 (diff) | |
| download | emacs-9bcd6a7e9486d68f612fe179073868bfa2ed6563.tar.gz emacs-9bcd6a7e9486d68f612fe179073868bfa2ed6563.zip | |
(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')
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/xml.el | 17 |
2 files changed, 20 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 336a1b8e7b8..df852fc5b13 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2003-12-29 Mark A. Hershberger <mah@everybody.org> | ||
| 2 | |||
| 3 | * xml.el (xml-get-attribute-or-nil): New function, like | ||
| 4 | xml-get-attribute, but returns nil if the attribute was not found. | ||
| 5 | (xml-get-attribute): Converted to defsubst, uses | ||
| 6 | xml-get-attribute-or-nil. | ||
| 7 | |||
| 1 | 2003-12-29 Eli Zaretskii <eliz@elta.co.il> | 8 | 2003-12-29 Eli Zaretskii <eliz@elta.co.il> |
| 2 | 9 | ||
| 3 | * emacs-lisp/easymenu.el (easy-menu-define): Doc fix. | 10 | * emacs-lisp/easymenu.el (easy-menu-define): Doc fix. |
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." | |||
| 104 | (push child match)))) | 104 | (push child match)))) |
| 105 | (nreverse match))) | 105 | (nreverse match))) |
| 106 | 106 | ||
| 107 | (defun xml-get-attribute (node attribute) | 107 | (defun xml-get-attribute-or-nil (node attribute) |
| 108 | "Get from NODE the value of ATTRIBUTE. | 108 | "Get from NODE the value of ATTRIBUTE. |
| 109 | An empty string is returned if the attribute was not found." | 109 | nil is returned if the attribute was not found. |
| 110 | |||
| 111 | See also `xml-get-attribute'." | ||
| 110 | (if (xml-node-attributes node) | 112 | (if (xml-node-attributes node) |
| 111 | (let ((value (assoc attribute (xml-node-attributes node)))) | 113 | (let ((value (assoc attribute (xml-node-attributes node)))) |
| 112 | (if value | 114 | (if value |
| 113 | (cdr value) | 115 | (cdr value) |
| 114 | "")) | 116 | nil)) |
| 115 | "")) | 117 | nil)) |
| 118 | |||
| 119 | (defsubst xml-get-attribute (node attribute) | ||
| 120 | "Get from NODE the value of ATTRIBUTE. | ||
| 121 | An empty string is returned if the attribute was not found. | ||
| 122 | |||
| 123 | See also `xml-get-attribute-or-nil'." | ||
| 124 | (or (xml-get-attribute-or-nil node attribute) "")) | ||
| 116 | 125 | ||
| 117 | ;;******************************************************************* | 126 | ;;******************************************************************* |
| 118 | ;;** | 127 | ;;** |