Function: soap-encode-xs-basic-type-attributes
soap-encode-xs-basic-type-attributes is a byte-compiled function
defined in soap-client.el.gz.
Signature
(soap-encode-xs-basic-type-attributes VALUE TYPE)
Documentation
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.
This is a specialization of soap-encode-attributes for
soap-xs-basic-type objects.
Source Code
;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-encode-xs-basic-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.
This is a specialization of `soap-encode-attributes' for
`soap-xs-basic-type' objects."
(let ((xsi-type (soap-element-fq-name type))
(basic-type (soap-xs-basic-type-kind type)))
;; try to classify the type based on the value type and use that type when
;; encoding
(when (eq basic-type 'anyType)
(cond ((stringp value)
(setq xsi-type "xsd:string" basic-type 'string))
((integerp value)
(setq xsi-type "xsd:int" basic-type 'int))
((memq value '(t nil))
(setq xsi-type "xsd:boolean" basic-type 'boolean))
(t
(error "Cannot classify anyType value"))))
(insert " xsi:type=\"" xsi-type "\"")
;; We have some ambiguity here, as a nil value represents "false" when the
;; type is boolean, we will never have a "nil" boolean type...
(unless (or value (eq basic-type 'boolean))
(insert " xsi:nil=\"true\""))))