| 308 | self.model = None |
| 309 | |
| 310 | def parse(self): |
| 311 | print("Parsing: ", self.path) |
| 312 | self.model = Model() |
| 313 | tree = ElementTree.parse(self.path) |
| 314 | root = tree.getroot() |
| 315 | self.add_extension_object() |
| 316 | self.add_data_type_definition() |
| 317 | for child in root: |
| 318 | tag = child.tag[40:] |
| 319 | if tag == 'StructuredType': |
| 320 | struct = self.parse_struct(child) |
| 321 | if struct.name != 'ExtensionObject': |
| 322 | self.model.structs.append(struct) |
| 323 | self.model.struct_list.append(struct.name) |
| 324 | elif tag == 'EnumeratedType': |
| 325 | enum = self.parse_enum(child) |
| 326 | self.model.enums.append(enum) |
| 327 | self.model.enum_list.append(enum.name) |
| 328 | # else: |
| 329 | # print("Not implemented node type: " + tag + "\n") |
| 330 | return self.model |
| 331 | |
| 332 | def add_extension_object(self): |
| 333 | obj = Struct() |