Skip to content

Commit

Permalink
Simplified variable handing in parse_xml_data
Browse files Browse the repository at this point in the history
  • Loading branch information
lowell80 committed Jan 7, 2022
1 parent 397f0aa commit 40efe72
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions splunklib/modularinput/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ def parse_parameters(param_node):
def parse_xml_data(parent_node, child_node_tag):
data = {}
for child in parent_node:
child_name = child.get("name")
if child.tag == child_node_tag:
if child_node_tag == "stanza":
data[child.get("name")] = {
data[child_name] = {
"__app": child.get("app", None)
}
for param in child:
data[child.get("name")][param.get("name")] = parse_parameters(param)
data[child_name][param.get("name")] = parse_parameters(param)
elif "item" == parent_node.tag:
data[child.get("name")] = parse_parameters(child)
data[child_name] = parse_parameters(child)
return data

0 comments on commit 40efe72

Please sign in to comment.