From: Thomas Fitzsimmons Date: Wed, 24 Jul 2019 08:54:31 +0000 (-0400) Subject: soap-client: Encode simple type attributes X-Git-Tag: emacs-27.0.90~1817^2~148 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c92cccb4ebb032ad15148e3ac7af014c1bbc1653;p=emacs.git soap-client: Encode simple type attributes * lisp/net/soap-client.el (soap-encode-xs-simple-type-attributes): Encode simple type attributes. --- 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.