MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / parse_xml

Function parse_xml

docs/website/scripts/generate_cn1libs.py:147–166  ·  view source on GitHub ↗
(xml_text: str)

Source from the content-addressed store, hash-verified

145
146
147def parse_xml(xml_text: str) -> List[Dict[str, str]]:
148 root = ET.fromstring(xml_text)
149 nodes = _candidate_nodes(root)
150
151 libs: List[Dict[str, str]] = []
152 seen = set()
153
154 for node in nodes:
155 item = _extract_lib(node)
156 if not item:
157 continue
158
159 key = (item["name"].lower(), item["url"].lower())
160 if key in seen:
161 continue
162 seen.add(key)
163 libs.append(item)
164
165 libs.sort(key=lambda x: x["name"].lower())
166 return libs
167
168
169def fetch_xml(url: str) -> str:

Callers 1

mainFunction · 0.85

Calls 6

_candidate_nodesFunction · 0.85
_extract_libFunction · 0.85
lowerMethod · 0.65
addMethod · 0.65
appendMethod · 0.65
sortMethod · 0.65

Tested by

no test coverage detected