summaryrefslogtreecommitdiff
path: root/lisp/net/soap-client.el
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@fitzsim.org>2019-07-24 04:54:31 -0400
committerThomas Fitzsimmons <fitzsim@fitzsim.org>2019-07-24 05:05:06 -0400
commitc92cccb4ebb032ad15148e3ac7af014c1bbc1653 (patch)
tree60622fb2c6d5c0aafcf286f701391b305f52666f /lisp/net/soap-client.el
parenta255caf19b9a3e45472d2a2d14fa8087eea838f1 (diff)
downloademacs-c92cccb4ebb032ad15148e3ac7af014c1bbc1653.tar.gz
soap-client: Encode simple type attributes
* lisp/net/soap-client.el (soap-encode-xs-simple-type-attributes): Encode simple type attributes.
Diffstat (limited to 'lisp/net/soap-client.el')
-rw-r--r--lisp/net/soap-client.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 40c6e62500a..7d04cef6a89 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.