summaryrefslogtreecommitdiff
path: root/jabber-xml.el
diff options
context:
space:
mode:
Diffstat (limited to 'jabber-xml.el')
-rw-r--r--jabber-xml.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/jabber-xml.el b/jabber-xml.el
index f782133..a81df65 100644
--- a/jabber-xml.el
+++ b/jabber-xml.el
@@ -58,7 +58,7 @@
"converts an SEXP in the format (tagname ((attribute-name . attribute-value)...) children...) and converts it to well-formatted xml."
(cond
((stringp sexp)
- sexp)
+ (jabber-escape-xml sexp))
((listp (car sexp))
(let ((xml ""))
(dolist (tag sexp)
@@ -79,7 +79,7 @@
(setq xml (concat xml
(format " %s='%s'"
(symbol-name (car attr))
- (cdr attr))))))
+ (jabber-escape-xml (cdr attr)))))))
(if (cddr sexp)
(progn
(setq xml (concat xml ">"))
@@ -153,13 +153,17 @@ CHILD-NAME should be a lower case symbol."
;; `xml-get-attribute' returns "" if the attribute is not found, which
;; is not very useful. Therefore, we use `xml-get-attribute-or-nil'
;; if present, or emulate its behavior.
-(if (fboundp 'xml-get-attribute-or-nil)
- (defalias 'jabber-xml-get-attribute 'xml-get-attribute-or-nil)
- (defsubst jabber-xml-get-attribute (node attribute)
- "Get from NODE the value of ATTRIBUTE.
+(eval-and-compile
+ (if (fboundp 'xml-get-attribute-or-nil)
+ (defsubst jabber-xml-get-attribute (node attribute)
+ "Get from NODE the value of ATTRIBUTE.
Return nil if the attribute was not found."
- (let ((result (xml-get-attribute node attribute)))
- (and (> (length result) 0) result))))
+ (xml-get-attribute-or-nil node attribute))
+ (defsubst jabber-xml-get-attribute (node attribute)
+ "Get from NODE the value of ATTRIBUTE.
+Return nil if the attribute was not found."
+ (let ((result (xml-get-attribute node attribute)))
+ (and (> (length result) 0) result)))))
(defun jabber-xml-path (xml-data path)
"Find sub-node of XML-DATA according to PATH.