[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c92cccb 2/3: soap-client: Encode simple type attrib
From: |
Thomas Fitzsimmons |
Subject: |
[Emacs-diffs] master c92cccb 2/3: soap-client: Encode simple type attributes |
Date: |
Wed, 24 Jul 2019 05:07:15 -0400 (EDT) |
branch: master
commit c92cccb4ebb032ad15148e3ac7af014c1bbc1653
Author: Thomas Fitzsimmons <address@hidden>
Commit: Thomas Fitzsimmons <address@hidden>
soap-client: Encode simple type attributes
* lisp/net/soap-client.el (soap-encode-xs-simple-type-attributes):
Encode simple type attributes.
---
lisp/net/soap-client.el | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 40c6e62..7d04cef 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -1352,14 +1352,25 @@ See also `soap-wsdl-resolve-references'."
(defun soap-encode-xs-simple-type-attributes (value type)
"Encode the XML attributes for VALUE according to TYPE.
-The xsi:type and an optional xsi:nil attributes are added. The
-attributes are inserted in the current buffer at the current
-position.
+The attributes are inserted in the current buffer at the current
+position. If TYPE has no attributes, the xsi:type attribute and
+an optional xsi:nil attribute are added.
This is a specialization of `soap-encode-attributes' for
`soap-xs-simple-type' objects."
- (insert " xsi:type=\"" (soap-element-fq-name type) "\"")
- (unless value (insert " xsi:nil=\"true\"")))
+ (let ((attributes (soap-get-xs-attributes type)))
+ (dolist (a attributes)
+ (let ((element-name (soap-element-name a)))
+ (if (soap-xs-attribute-default a)
+ (insert " " element-name
+ "=\"" (soap-xs-attribute-default a) "\"")
+ (dolist (value-pair value)
+ (when (equal element-name (symbol-name (car-safe value-pair)))
+ (insert " " element-name
+ "=\"" (cdr value-pair) "\""))))))
+ (unless attributes
+ (insert " xsi:type=\"" (soap-element-fq-name type) "\"")
+ (unless value (insert " xsi:nil=\"true\"")))))
(defun soap-encode-xs-simple-type (value type)
"Encode the VALUE according to TYPE.