Revision be4818db
b/ncclient/content/parsers.py | ||
---|---|---|
24 | 24 |
'Returns tuple of (session-id, ["capability_uri", ...])' |
25 | 25 |
sid, capabilities = 0, [] |
26 | 26 |
root = ET.fromstring(raw) |
27 |
if root.tag in ('hello', _('hello', BASE_NS)): |
|
27 |
# cisco spews un-namespaced xml |
|
28 |
htag = ('hello', _('hello', BASE_NS)) |
|
29 |
stag = ('session-id', _('session-id', BASE_NS)) |
|
30 |
ctag = ('capabilities', _('capabilities', BASE_NS)) |
|
31 |
if root.tag in htag: |
|
28 | 32 |
for child in root.getchildren(): |
29 |
if child.tag in ('session-id', _('session-id', BASE_NS)):
|
|
33 |
if child.tag in stag:
|
|
30 | 34 |
sid = child.text |
31 |
elif child.tag in ('capabilities', _('capabilities', BASE_NS)):
|
|
35 |
elif child.tag in ctag:
|
|
32 | 36 |
for cap in child.getiterator('capability'): |
33 | 37 |
capabilities.append(cap.text) |
34 | 38 |
for cap in child.getiterator(_('capability', BASE_NS)): |
Also available in: Unified diff