Function: soap-should-encode-value-for-xs-element
soap-should-encode-value-for-xs-element is a byte-compiled function
defined in soap-client.el.gz.
Signature
(soap-should-encode-value-for-xs-element VALUE ELEMENT)
Documentation
Return t if VALUE should be encoded for ELEMENT, nil otherwise.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-should-encode-value-for-xs-element (value element)
"Return t if VALUE should be encoded for ELEMENT, nil otherwise."
(cond
;; if value is not nil, attempt to encode it
(value t)
;; value is nil, but the element's type is a boolean, so nil in this case
;; means "false". We need to encode it.
((let ((type (soap-xs-element-type element)))
(and (soap-xs-basic-type-p type)
(eq (soap-xs-basic-type-kind type) 'boolean))))
;; This is not an optional element. Force encoding it (although this
;; might fail at the validation step, but this is what we intend.
;; value is nil, but the element's type has some attributes which supply a
;; default value. We need to encode it.
((let ((type (soap-xs-element-type element)))
(catch 'found
(dolist (a (soap-xs-type-attributes type))
(when (soap-xs-attribute-default a)
(throw 'found t))))))
;; otherwise, we don't need to encode it
(t nil)))