當前位置: 首頁>>代碼示例>>Python>>正文


Python SimpleXMLElement.get_namespace_uri方法代碼示例

本文整理匯總了Python中simplexml.SimpleXMLElement.get_namespace_uri方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleXMLElement.get_namespace_uri方法的具體用法?Python SimpleXMLElement.get_namespace_uri怎麽用?Python SimpleXMLElement.get_namespace_uri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在simplexml.SimpleXMLElement的用法示例。


在下文中一共展示了SimpleXMLElement.get_namespace_uri方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: wsdl_parse

# 需要導入模塊: from simplexml import SimpleXMLElement [as 別名]
# 或者: from simplexml.SimpleXMLElement import get_namespace_uri [as 別名]

#.........這裏部分代碼省略.........
                if action:
                    d["action"] = action

        # check axis2 namespace at schema types attributes
        self.namespace = dict(wsdl.types("schema", ns=xsd_uri)[:]).get("targetNamespace", self.namespace)

        imported_schemas = {}

        # process current wsdl schema:
        for schema in wsdl.types("schema", ns=xsd_uri):
            preprocess_schema(
                schema,
                imported_schemas,
                elements,
                xsd_uri,
                self.__soap_server,
                self.http,
                cache,
                force_download,
                self.wsdl_basedir,
            )

        postprocess_element(elements)

        for message in wsdl.message:
            log.debug("Processing message %s" % message["name"])
            for part in message("part", error=False) or []:
                element = {}
                element_name = part["element"]
                if not element_name:
                    # some implementations (axis) uses type instead
                    element_name = part["type"]
                type_ns = get_namespace_prefix(element_name)
                type_uri = wsdl.get_namespace_uri(type_ns)
                if type_uri == xsd_uri:
                    element_name = get_local_name(element_name)
                    fn = REVERSE_TYPE_MAP.get(unicode(element_name), None)
                    element = {part["name"]: fn}
                    # emulate a true Element (complexType)
                    messages.setdefault((message["name"], None), {message["name"]: OrderedDict()}).values()[0].update(
                        element
                    )
                else:
                    element_name = get_local_name(element_name)
                    fn = elements.get(make_key(element_name, "element"))
                    if not fn:
                        # some axis servers uses complexType for part messages
                        fn = elements.get(make_key(element_name, "complexType"))
                        element = {message["name"]: {part["name"]: fn}}
                    else:
                        element = {element_name: fn}
                    messages[(message["name"], part["name"])] = element

        for port_type in wsdl.portType:
            port_type_name = port_type["name"]
            log.debug("Processing port type %s" % port_type_name)

            for binding in port_type_bindings[port_type_name]:
                for operation in port_type.operation:
                    op_name = operation["name"]
                    op = operations[str(binding["name"])][op_name]
                    op["documentation"] = unicode(operation("documentation", error=False) or "")
                    if binding["soap_ver"]:
                        # TODO: separe operation_binding from operation (non SOAP?)
                        if operation("input", error=False):
                            input_msg = get_local_name(operation.input["message"])
開發者ID:yashodhank,項目名稱:digital-signage-server,代碼行數:70,代碼來源:client.py


注:本文中的simplexml.SimpleXMLElement.get_namespace_uri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。