Function: soap-encode-xs-element
soap-encode-xs-element is a byte-compiled function defined in
soap-client.el.gz.
Signature
(soap-encode-xs-element VALUE ELEMENT)
Documentation
Encode the VALUE according to ELEMENT.
The data is inserted in the current buffer at the current position.
This is a specialization of soap-encode-value for
soap-xs-basic-type objects.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-encode-xs-element (value element)
"Encode the VALUE according to ELEMENT.
The data is inserted in the current buffer at the current
position.
This is a specialization of `soap-encode-value' for
`soap-xs-basic-type' objects."
(let ((fq-name (soap-element-fq-name element))
(type (soap-xs-element-type element)))
;; Only encode the element if it has a name. NOTE: soap-element-fq-name
;; will return *unnamed* for such elements
(if (soap-element-name element)
;; Don't encode this element if value is nil. However, even if value
;; is nil we still want to encode this element if it has any attributes
;; with default values.
(when (soap-should-encode-value-for-xs-element value element)
(progn
(insert "<" fq-name)
(soap-encode-attributes value type)
;; If value is nil and type is boolean encode the value as "false".
;; Otherwise don't encode the value.
(if (or value (and (soap-xs-basic-type-p type)
(eq (soap-xs-basic-type-kind type) 'boolean)))
(progn (insert ">")
;; ARRAY's need special treatment, as each element of
;; the array is encoded with the same tag as the
;; current element...
(if (soap-type-is-array? type)
(let ((new-element (copy-soap-xs-element element)))
(when (soap-element-namespace-tag type)
(add-to-list 'soap-encoded-namespaces
(soap-element-namespace-tag type)))
(setf (soap-xs-element-type^ new-element)
(soap-xs-complex-type-base type))
(cl-loop for i below (length value)
do (soap-encode-xs-element
(aref value i) new-element)))
(soap-encode-value value type))
(insert "</" fq-name ">\n"))
;; else
(insert "/>\n"))))
(when (soap-should-encode-value-for-xs-element value element)
(soap-encode-value value type)))))