process the specified type then process its children
(self, data, type, history)
| 62 | return data |
| 63 | |
| 64 | def process(self, data, type, history): |
| 65 | """ process the specified type then process its children """ |
| 66 | if type in history: |
| 67 | return |
| 68 | if type.enum(): |
| 69 | return |
| 70 | history.append(type) |
| 71 | resolved = type.resolve() |
| 72 | value = None |
| 73 | if type.unbounded(): |
| 74 | value = [] |
| 75 | else: |
| 76 | if len(resolved) > 0: |
| 77 | if resolved.mixed(): |
| 78 | value = Factory.property(resolved.name) |
| 79 | md = value.__metadata__ |
| 80 | md.sxtype = resolved |
| 81 | else: |
| 82 | value = Factory.object(resolved.name) |
| 83 | md = value.__metadata__ |
| 84 | md.sxtype = resolved |
| 85 | md.ordering = self.ordering(resolved) |
| 86 | setattr(data, type.name, value) |
| 87 | if value is not None: |
| 88 | data = value |
| 89 | if not isinstance(data, list): |
| 90 | self.add_attributes(data, resolved) |
| 91 | for child, ancestry in resolved.children(): |
| 92 | if self.skip_child(child, ancestry): |
| 93 | continue |
| 94 | self.process(data, child, history[:]) |
| 95 | |
| 96 | def add_attributes(self, data, type): |
| 97 | """ add required attributes """ |