MCPcopy Create free account
hub / github.com/SpaceZephyr/myskill / __init__

Method __init__

docx/scripts/utilities.py:55–74  ·  view source on GitHub ↗

Initialize with path to XML file and parse with line number tracking. Args: xml_path: Path to XML file to edit (str or Path) Raises: ValueError: If the XML file does not exist

(self, xml_path)

Source from the content-addressed store, hash-verified

53 """
54
55 def __init__(self, xml_path):
56 """
57 Initialize with path to XML file and parse with line number tracking.
58
59 Args:
60 xml_path: Path to XML file to edit (str or Path)
61
62 Raises:
63 ValueError: If the XML file does not exist
64 """
65 self.xml_path = Path(xml_path)
66 if not self.xml_path.exists():
67 raise ValueError(f"XML file not found: {xml_path}")
68
69 with open(self.xml_path, "rb") as f:
70 header = f.read(200).decode("utf-8", errors="ignore")
71 self.encoding = "ascii" if 'encoding="ascii"' in header else "utf-8"
72
73 parser = _create_line_tracking_parser()
74 self.dom = defusedxml.minidom.parse(str(self.xml_path), parser)
75
76 def get_node(
77 self,

Callers

nothing calls this directly

Calls 2

parseMethod · 0.80

Tested by

no test coverage detected