Skip to content

Commit

Permalink
Output a list of IATI spreadsheet headings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Aug 14, 2018
1 parent 0843693 commit 55ce7c0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions flattentool/sort_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_schema_element(self, tag_name, name_attribute):
return schema_element
return schema_element

def element_loop(self, element, path):
def element_loop(self, element):
"""
Return information about the children of the supplied element.
"""
Expand All @@ -95,14 +95,12 @@ def element_loop(self, element, path):
'xsd:complexType/xsd:all/xsd:element',
namespaces=namespaces)
+ type_elements)
child_tuples = []
for child in children:
a = child.attrib
if 'name' in a:
child_tuples.append((a['name'], child, None, a.get('minOccurs'), a.get('maxOccurs')))
yield a['name'], child, None, a.get('minOccurs'), a.get('maxOccurs')
else:
child_tuples.append((a['ref'], None, child, a.get('minOccurs'), a.get('maxOccurs')))
return child_tuples
yield a['ref'], None, child, a.get('minOccurs'), a.get('maxOccurs')

def create_schema_dict(self, parent_name, parent_element=None):
"""
Expand All @@ -114,7 +112,7 @@ def create_schema_dict(self, parent_name, parent_element=None):

return OrderedDict([
(name, self.create_schema_dict(name, element))
for name, element, _, _, _ in self.element_loop(parent_element, '')])
for name, element, _, _, _ in self.element_loop(parent_element)])


def sort_element(element, schema_subdict):
Expand Down

0 comments on commit 55ce7c0

Please sign in to comment.