|
1
|
|
|
# pylint: disable=line-too-long,invalid-name,missing-module-docstring,missing-function-docstring |
|
2
|
|
|
def exportChildren(self, outfile, level, namespaceprefix_='', namespacedef_='xmlns:pc="http://schema.primaresearch.org/PAGE/gts/pagecontent/2019-07-15"', name_='OrderedGroupType', fromsubclass_=False, pretty_print=True): # pylint: disable=unused-argument,too-many-arguments |
|
3
|
|
|
namespaceprefix_ = 'pc:' |
|
4
|
|
|
if self.UserDefined is not None: |
|
5
|
|
|
self.UserDefined.export(outfile, level, namespaceprefix_, namespacedef_='', name_='UserDefined', pretty_print=pretty_print) |
|
6
|
|
|
for Labels_ in self.Labels: |
|
7
|
|
|
Labels_.export(outfile, level, namespaceprefix_, namespacedef_='', name_='Labels', pretty_print=pretty_print) |
|
8
|
|
|
cleaned = [] |
|
9
|
|
|
def replaceWithRRI(group): |
|
10
|
|
|
rri = RegionRefIndexedType.factory(parent_object_=self) # pylint: disable=undefined-variable |
|
|
|
|
|
|
11
|
|
|
rri.index = group.index |
|
12
|
|
|
rri.regionRef = group.regionRef |
|
13
|
|
|
cleaned.append(rri) |
|
14
|
|
|
# remove emtpy groups and replace with RegionRefIndexedType |
|
15
|
|
|
for entry in self.get_AllIndexed(): |
|
16
|
|
|
# pylint: disable=undefined-variable |
|
17
|
|
|
if isinstance(entry, (OrderedGroupIndexedType)) and not entry.get_AllIndexed(): |
|
|
|
|
|
|
18
|
|
|
replaceWithRRI(entry) |
|
19
|
|
|
elif isinstance(entry, UnorderedGroupIndexedType) and not entry.get_UnorderedGroupChildren(): |
|
|
|
|
|
|
20
|
|
|
replaceWithRRI(entry) |
|
21
|
|
|
else: |
|
22
|
|
|
cleaned.append(entry) |
|
23
|
|
|
for entry in cleaned: |
|
24
|
|
|
entry.export(outfile, level, namespaceprefix_, namespacedef_='', name_=entry.__class__.__name__[:-4], pretty_print=pretty_print) |
|
25
|
|
|
|