From 93fad2a5c37cb747b60395e2b3847948abb8aa93 Mon Sep 17 00:00:00 2001 From: ArturTomczak Date: Thu, 8 Jul 2021 18:14:49 +0200 Subject: [PATCH] add ids constructor, fix ids bug --- src/ifcopenshell-python/ifcopenshell/ids.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/ids.py b/src/ifcopenshell-python/ifcopenshell/ids.py index f3a305e10c..cc26d06ff7 100644 --- a/src/ifcopenshell-python/ifcopenshell/ids.py +++ b/src/ifcopenshell-python/ifcopenshell/ids.py @@ -541,6 +541,16 @@ class ids: Represents the XML root node and its childNodes. """ + def __init__(self): + self.specifications = [] + self.info = None + #self.attributes = { + # '@xmlns:xs': 'http://www.w3.org/2001/XMLSchema', + # '@xmlns': 'http://standards.buildingsmart.org/IDS', + # '@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', + # '@xsi:schemaLocation': 'http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/ids.xsd', + # } + def asdict(self): ids_dict = {'@xmlns': 'http://standards.buildingsmart.org/IDS', '@xmlns:xs': 'http://www.w3.org/2001/XMLSchema', @@ -577,10 +587,9 @@ class ids: @staticmethod def parse(fn, ids_schema=ids_schema): ids_schema.validate(fn) - - ids_content = ids_schema.to_dict(fn) + ids_content = ids_schema.decode(fn) new_ids = ids() - new_ids.specifications = [specification(s) for s in ids_content['specification']] + new_ids.specifications = [specification.parse(s) for s in ids_content['specification']] return new_ids