MCPcopy Index your code
hub / github.com/python/cpython / _qname

Method _qname

Lib/xml/sax/saxutils.py:126–141  ·  view source on GitHub ↗

Builds a qualified name from a (ns_url, localname) pair

(self, name)

Source from the content-addressed store, hash-verified

124 self._pending_start_element = False
125
126 def _qname(self, name):
127 """Builds a qualified name from a (ns_url, localname) pair"""
128 if name[0]:
129 # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is
130 # bound by definition to http://www.w3.org/XML/1998/namespace. It
131 # does not need to be declared and will not usually be found in
132 # self._current_context.
133 if 'http://www.w3.org/XML/1998/namespace' == name[0]:
134 return 'xml:' + name[1]
135 # The name is in a non-empty namespace
136 prefix = self._current_context[name[0]]
137 if prefix:
138 # If it is not the default namespace, prepend the prefix
139 return prefix + ":" + name[1]
140 # Return the unqualified name
141 return name[1]
142
143 def _finish_pending_start_element(self,endElement=False):
144 if self._pending_start_element:

Callers 2

startElementNSMethod · 0.95
endElementNSMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected