mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Added comments to _fix_ns to clarify the cleaning procedure.
This commit is contained in:
parent
37ff17b0cb
commit
ca6ce26b0d
1 changed files with 7 additions and 0 deletions
|
@ -765,17 +765,24 @@ class ElementBase(object):
|
|||
False, which returns a flat string path.
|
||||
"""
|
||||
fixed = []
|
||||
# Split the XPath into a series of blocks, where a block
|
||||
# is started by an element with a namespace.
|
||||
ns_blocks = xpath.split('{')
|
||||
for ns_block in ns_blocks:
|
||||
if '}' in ns_block:
|
||||
# Apply the found namespace to following elements
|
||||
# that do not have namespaces.
|
||||
namespace = ns_block.split('}')[0]
|
||||
elements = ns_block.split('}')[1].split('/')
|
||||
else:
|
||||
# Apply the stanza's namespace to the following
|
||||
# elements since no namespace was provided.
|
||||
namespace = self.namespace
|
||||
elements = ns_block.split('/')
|
||||
|
||||
for element in elements:
|
||||
if element:
|
||||
# Skip empty entry artifacts from splitting.
|
||||
fixed.append('{%s}%s' % (namespace,
|
||||
element))
|
||||
if split:
|
||||
|
|
Loading…
Reference in a new issue