Function: soap-decode-xs-attributes

soap-decode-xs-attributes is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-decode-xs-attributes TYPE NODE)

Documentation

Use TYPE, a soap-xs-complex-type, to decode the attributes of NODE.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-decode-xs-attributes (type node)
  "Use TYPE, a `soap-xs-complex-type', to decode the attributes of NODE."
  (let (result)
    (dolist (attribute (soap-get-xs-attributes type))
      (let* ((name (soap-xs-attribute-name attribute))
             (attribute-type (soap-xs-attribute-type attribute))
             (symbol (intern name))
             (value (xml-get-attribute-or-nil node symbol)))
        ;; We don't support attribute uses: required, optional, prohibited.
        (cond
         ((soap-xs-basic-type-p attribute-type)
          ;; Basic type values are validated by xml.el.
          (when value
            (push (cons symbol
                        ;; Create a fake XML node to satisfy the
                        ;; soap-decode-xs-basic-type API.
                        (soap-decode-xs-basic-type attribute-type
                                                   (list symbol nil value)))
                  result)))
         ((soap-xs-simple-type-p attribute-type)
          (when value
            (push (cons symbol
                        (soap-validate-xs-simple-type value attribute-type))
                  result)))
         (t
          (error (concat "Attribute %s is of type %s which is"
                         " not a basic or simple type")
                 name (soap-name-p attribute))))))
    result))