Skip to content

Commit

Permalink
fix: Resolve every enum there is in the xml blobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Oct 30, 2024
1 parent 255c731 commit 0226f16
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions HCxml2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

def parse_xml_list(codes, entries, enums):
for el in entries:
if "uid" not in el.attrib:
continue

# not sure how to parse refCID and refDID
uid = int(el.attrib["uid"], 16)

Expand All @@ -41,6 +44,10 @@ def parse_xml_list(codes, entries, enums):

# codes[uid] = data

# parse recursively to also resolve enums in elements in e.g. <optionList> elements
if len(el) > 0:
parse_xml_list(codes, el, enums)


def parse_machine_description(entries):
description = {}
Expand Down Expand Up @@ -96,8 +103,8 @@ def xml2json(features_xml, description_xml):
"values": values,
}

for i in range(4, 8):
parse_xml_list(features, description[i], enums)
for description_item in description:
parse_xml_list(features, description_item, enums)

# remove the duplicate uid field
for uid in features:
Expand Down

0 comments on commit 0226f16

Please sign in to comment.