added support for xml schemas

This commit is contained in:
2023-11-24 18:14:13 +01:00
parent 84b935c898
commit f5ddbf4a69
4 changed files with 139 additions and 2 deletions

View File

@@ -5,12 +5,13 @@ import yaml
from config import Config
from renderer import Renderer
from structure import Structure
from xml_loader import XMLLoader
class UnsupportedFormatException(Exception):
...
class InstructionSetSchema:
VALID_EXTENSIONS = ("yaml", "json")
VALID_EXTENSIONS = ("yaml", "json", "xml")
def __init__(self, path: str, configPath: str = "config.json") -> None:
self.config = Config(configPath)
@@ -31,6 +32,9 @@ class InstructionSetSchema:
elif ext == "json":
schema = json.load(f)
elif ext == "xml":
schema = XMLLoader.load(f)
self.structures = {}