Function: soap-encode-xs-complex-type-attributes

soap-encode-xs-complex-type-attributes is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-encode-xs-complex-type-attributes VALUE TYPE)

Documentation

Encode the XML attributes for encoding VALUE according to TYPE.

The xsi:type and optional xsi:nil attributes are added, plus additional attributes needed for arrays types, if applicable. The attributes are inserted in the current buffer at the current position.

This is a specialization of soap-encode-attributes for soap-xs-complex-type objects.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-encode-xs-complex-type-attributes (value type)
  "Encode the XML attributes for encoding VALUE according to TYPE.
The xsi:type and optional xsi:nil attributes are added, plus
additional attributes needed for arrays types, if applicable.  The
attributes are inserted in the current buffer at the current
position.

This is a specialization of `soap-encode-attributes' for
`soap-xs-complex-type' objects."
  (if (eq (soap-xs-complex-type-indicator type) 'array)
      (let ((element-type (soap-xs-complex-type-base type)))
        (insert " xsi:type=\"soapenc:Array\"")
        (insert " soapenc:arrayType=\""
                (soap-element-fq-name element-type)
                "[" (format "%s" (length value)) "]" "\""))
    ;; else
    (progn
      (dolist (a (soap-get-xs-attributes type))
        (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 value-pair)))
                (insert " " element-name
                        "=\"" (cdr value-pair) "\""))))))
      ;; If this is not an empty type, and we have no value, mark it as nil
      (when (and (soap-xs-complex-type-indicator type) (null value))
        (insert " xsi:nil=\"true\"")))))