Function: soap-xs-parse-complex-type

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

Signature

(soap-xs-parse-complex-type NODE)

Documentation

Construct a soap-xs-complex-type by parsing the XML NODE.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
(defun soap-xs-parse-complex-type (node)
  "Construct a `soap-xs-complex-type' by parsing the XML NODE."
  (let ((name (xml-get-attribute-or-nil node 'name))
        (id (xml-get-attribute-or-nil node 'id))
        (node-name (soap-l2wk (xml-node-name node)))
        type
        attributes
        attribute-groups)
    (cl-assert (memq node-name '(xsd:complexType xsd:complexContent xsd:group))
               nil "unexpected node: %s" node-name)

    (dolist (def (xml-node-children node))
      (when (consp def)                 ; skip text nodes
        (cl-case (soap-l2wk (xml-node-name def))
          (xsd:attribute (push (soap-xs-parse-attribute def) attributes))
          (xsd:attributeGroup
           (push (soap-xs-parse-attribute-group def)
                 attribute-groups))
          (xsd:simpleContent (setq type (soap-xs-parse-simple-type def)))
          ((xsd:sequence xsd:all xsd:choice)
           (setq type (soap-xs-parse-sequence def)))
          (xsd:complexContent
           (dolist (def (xml-node-children def))
             (when (consp def)
               (cl-case (soap-l2wk (xml-node-name def))
                 (xsd:attribute
                  (push (soap-xs-parse-attribute def) attributes))
                 (xsd:attributeGroup
                  (push (soap-xs-parse-attribute-group def)
                        attribute-groups))
                 ((xsd:extension xsd:restriction)
                  (setq type
                        (soap-xs-parse-extension-or-restriction def)))
                 ((xsd:sequence xsd:all xsd:choice)
                  (soap-xs-parse-sequence def)))))))))
    (unless type
      ;; the type has not been built, this is a shortcut for a simpleContent
      ;; node
      (setq type (make-soap-xs-complex-type)))

    (setf (soap-xs-type-name type) name)
    (setf (soap-xs-type-namespace-tag type) soap-target-xmlns)
    (setf (soap-xs-type-id type) id)
    (setf (soap-xs-type-attributes type)
          (append attributes (soap-xs-type-attributes type)))
    (setf (soap-xs-type-attribute-groups type)
          (append attribute-groups (soap-xs-type-attribute-groups type)))
    (when (soap-xs-complex-type-p type)
      (setf (soap-xs-complex-type-is-group type)
            (eq node-name 'xsd:group)))
    type))