Function: soap-parse-schema

soap-parse-schema is a byte-compiled function defined in soap-client.el.gz.

Signature

(soap-parse-schema NODE WSDL)

Documentation

Parse a schema NODE, placing the results in WSDL.

Return a SOAP-NAMESPACE containing the elements.

Source Code

;; Defined in /usr/src/emacs/lisp/net/soap-client.el.gz
;;;;; soap-parse-schema

(defun soap-parse-schema (node wsdl)
  "Parse a schema NODE, placing the results in WSDL.
Return a SOAP-NAMESPACE containing the elements."
  (soap-with-local-xmlns node
    (cl-assert (eq (soap-l2wk (xml-node-name node)) 'xsd:schema)
               nil
               "expecting an xsd:schema node, got %s"
               (soap-l2wk (xml-node-name node)))

    (let ((ns (make-soap-namespace :name (soap-get-target-namespace node))))

      (dolist (def (xml-node-children node))
        (unless (stringp def)           ; skip text nodes
          (cl-case (soap-l2wk (xml-node-name def))
            (xsd:import
             ;; Imports will be processed later
             ;; NOTE: we should expand the location now!
             (let ((location (or
                              (xml-get-attribute-or-nil def 'schemaLocation)
                              (xml-get-attribute-or-nil def 'location))))
               (when location
                 (push location (soap-wsdl-xmlschema-imports wsdl)))))
            (xsd:element
             (soap-namespace-put (soap-xs-parse-element def) ns))
            (xsd:attribute
             (soap-namespace-put (soap-xs-parse-attribute def) ns))
            (xsd:attributeGroup
             (soap-namespace-put (soap-xs-parse-attribute-group def) ns))
            (xsd:simpleType
             (soap-namespace-put (soap-xs-parse-simple-type def) ns))
            ((xsd:complexType xsd:group)
             (soap-namespace-put (soap-xs-parse-complex-type def) ns)))))
      ns)))