MCPcopy
hub / github.com/HKUDS/MiniRAG / convert_xml_to_json

Function convert_xml_to_json

graph-visuals/graph_with_neo4j.py:17–31  ·  view source on GitHub ↗

Converts XML file to JSON and saves the output.

(xml_path, output_path)

Source from the content-addressed store, hash-verified

15
16
17def convert_xml_to_json(xml_path, output_path):
18 """Converts XML file to JSON and saves the output."""
19 if not os.path.exists(xml_path):
20 print(f"Error: File not found - {xml_path}")
21 return None
22
23 json_data = xml_to_json(xml_path)
24 if json_data:
25 with open(output_path, "w", encoding="utf-8") as f:
26 json.dump(json_data, f, ensure_ascii=False, indent=2)
27 print(f"JSON file created: {output_path}")
28 return json_data
29 else:
30 print("Failed to create JSON data")
31 return None
32
33
34def process_in_batches(tx, query, data, batch_size):

Callers 1

mainFunction · 0.85

Calls 1

xml_to_jsonFunction · 0.90

Tested by

no test coverage detected