MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / add_prefix

Method add_prefix

suds/client.py:131–148  ·  view source on GitHub ↗

Add I{static} mapping of an XML namespace prefix to a namespace. This is useful for cases when a wsdl and referenced schemas make heavy use of namespaces and those namespaces are subject to changed. @param prefix: An XML namespace prefix. @type prefix: str

(self, prefix, uri)

Source from the content-addressed store, hash-verified

129 p.update(kwargs)
130
131 def add_prefix(self, prefix, uri):
132 """
133 Add I{static} mapping of an XML namespace prefix to a namespace.
134 This is useful for cases when a wsdl and referenced schemas make heavy
135 use of namespaces and those namespaces are subject to changed.
136 @param prefix: An XML namespace prefix.
137 @type prefix: str
138 @param uri: An XML namespace URI.
139 @type uri: str
140 @raise Exception: when prefix is already mapped.
141 """
142 root = self.wsdl.root
143 mapped = root.resolvePrefix(prefix, None)
144 if mapped is None:
145 root.addPrefix(prefix, uri)
146 return
147 if mapped[1] != uri:
148 raise Exception('"%s" already mapped as "%s"' % (prefix, mapped))
149
150 def last_sent(self):
151 """

Callers

nothing calls this directly

Calls 2

addPrefixMethod · 0.80
resolvePrefixMethod · 0.45

Tested by

no test coverage detected