Function: soap-resolve-references-for-xs-complex-type

soap-resolve-references-for-xs-complex-type is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-resolve-references-for-xs-complex-type TYPE WSDL)

Documentation

Replace names in TYPE with the referenced objects in the WSDL.

This is a specialization of soap-resolve-references for soap-xs-complex-type objects.

See also soap-wsdl-resolve-references.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-resolve-references-for-xs-complex-type (type wsdl)
  "Replace names in TYPE with the referenced objects in the WSDL.
This is a specialization of `soap-resolve-references' for
`soap-xs-complex-type' objects.

See also `soap-wsdl-resolve-references'."

  (let ((namespace (soap-element-namespace-tag type)))
    (when namespace
      (let ((nstag (car (rassoc namespace (soap-wsdl-alias-table wsdl)))))
        (when nstag
          (setf (soap-element-namespace-tag type) nstag)))))

  (let ((base (soap-xs-complex-type-base type)))
    (cond ((soap-name-p base)
           (setf (soap-xs-complex-type-base type)
                 (soap-wsdl-get base wsdl 'soap-xs-type-p)))
          ((soap-xs-type-p base)
           (soap-resolve-references base wsdl))))
  (let (all-elements)
    (dolist (element (soap-xs-complex-type-elements type))
      (if (soap-xs-element-is-group element)
          ;; This is an xsd:group element that references an xsd:group node,
          ;; which we treat as a complex type.  We replace the reference
          ;; element by inlining the elements of the referenced xsd:group
          ;; (complex type) node.
          (let ((type (soap-wsdl-get
                       (soap-xs-element-reference element)
                       wsdl (lambda (type)
                              (and
                               (soap-xs-complex-type-p type)
                               (soap-xs-complex-type-is-group type))))))
            (dolist (element (soap-xs-complex-type-elements type))
              (soap-resolve-references element wsdl)
              (push element all-elements)))
        ;; This is a non-xsd:group node so just add it directly.
        (soap-resolve-references element wsdl)
        (push element all-elements)))
    (setf (soap-xs-complex-type-elements type) (nreverse all-elements)))
  (dolist (attribute (soap-xs-type-attributes type))
    (soap-resolve-references attribute wsdl))
  (dolist (attribute-group (soap-xs-type-attribute-groups type))
    (soap-resolve-references attribute-group wsdl)))