manuskript/manuskript/io/xmlFile.py
TheJackiMonster 9078079241
Added remove function for file types
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
2021-05-14 19:46:39 +02:00

23 lines
528 B
Python

#!/usr/bin/env python
# --!-- coding: utf8 --!--
import os
from lxml import etree
from manuskript.io.abstractFile import AbstractFile
class XmlFile(AbstractFile):
def load(self):
with open(self.path, 'rb') as file:
return etree.parse(file)
def save(self, content):
with open(self.path, 'wb') as file:
content.write(file, encoding="utf-8", xml_declaration=True, pretty_print=True)
def remove(self):
if os.path.exists(self.path):
os.remove(self.path)