Xml File#

MHI’s XML File

class mhi.xml.file.File(parser: XMLParser)#

Base-class for various XML files

set_modified()#

Flag the XML document as modified

property modified: bool#

Return the modified status of the XML document (read-only)

property path: Path | None#

The path of the XML document (read-only)

Note

The path is None if it has not been read from an actual file.

save()#

Write the updated XML document back to the file it was read from.

save_as(path: Path | str)#

Write the XML document to a file.

property used_ids: Set[int]#

The set of all id’s that have been used in this file instance

id_exists(id_: int) bool#

Test whether an <element id=’#’/> exists in the document

make_id() int#

Create a new (and unused) ID number

property root#

Fetch root node of file